Release 2.18 (#4878)
This commit is contained in:
@@ -287,6 +287,7 @@ abstract class APIControllerBaseTest extends ControllerBaseTest
|
||||
'id' => 'int',
|
||||
'name' => 'string',
|
||||
'color' => '@string',
|
||||
'color-safe' => 'string',
|
||||
'visible' => 'bool',
|
||||
];
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ class ApiDocControllerTest extends ControllerBaseTest
|
||||
'/api/activities/{id}/rates',
|
||||
'/api/activities/{id}/rates/{rateId}',
|
||||
'/api/config/timesheet',
|
||||
'/api/config/colors',
|
||||
'/api/customers',
|
||||
'/api/customers/{id}',
|
||||
'/api/customers/{id}/meta',
|
||||
@@ -78,6 +79,7 @@ class ApiDocControllerTest extends ControllerBaseTest
|
||||
'/api/version',
|
||||
'/api/plugins',
|
||||
'/api/tags',
|
||||
'/api/tags/find',
|
||||
'/api/tags/{id}',
|
||||
'/api/teams',
|
||||
'/api/teams/{id}',
|
||||
|
||||
@@ -25,7 +25,9 @@ class ConfigurationControllerTest extends APIControllerBaseTest
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/config/timesheet', 'GET');
|
||||
$result = json_decode($client->getResponse()->getContent(), true);
|
||||
$content = $client->getResponse()->getContent();
|
||||
$this->assertIsString($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
@@ -37,4 +39,53 @@ class ConfigurationControllerTest extends APIControllerBaseTest
|
||||
|
||||
$this->assertEquals($expectedKeys, $actual, 'Config structure does not match');
|
||||
}
|
||||
|
||||
public function testIsColorsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/api/config/colors');
|
||||
}
|
||||
|
||||
public function testGetColors(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/api/config/colors', 'GET');
|
||||
$content = $client->getResponse()->getContent();
|
||||
$this->assertIsString($content);
|
||||
$actual = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($actual);
|
||||
$this->assertNotEmpty($actual);
|
||||
$expected = [
|
||||
'Silver' => '#c0c0c0',
|
||||
'Gray' => '#808080',
|
||||
'Black' => '#000000',
|
||||
'Maroon' => '#800000',
|
||||
'Brown' => '#a52a2a',
|
||||
'Red' => '#ff0000',
|
||||
'Orange' => '#ffa500',
|
||||
'Gold' => '#ffd700',
|
||||
'Yellow' => '#ffff00',
|
||||
'Peach' => '#ffdab9',
|
||||
'Khaki' => '#f0e68c',
|
||||
'Olive' => '#808000',
|
||||
'Lime' => '#00ff00',
|
||||
'Jelly' => '#9acd32',
|
||||
'Green' => '#008000',
|
||||
'Teal' => '#008080',
|
||||
'Aqua' => '#00ffff',
|
||||
'LightBlue' => '#add8e6',
|
||||
'DeepSky' => '#00bfff',
|
||||
'Dodger' => '#1e90ff',
|
||||
'Blue' => '#0000ff',
|
||||
'Navy' => '#000080',
|
||||
'Purple' => '#800080',
|
||||
'Fuchsia' => '#ff00ff',
|
||||
'Violet' => '#ee82ee',
|
||||
'Rose' => '#ffe4e1',
|
||||
'Lavender' => '#E6E6FA',
|
||||
];
|
||||
$this->assertCount(\count($expected), $actual);
|
||||
|
||||
$this->assertEquals($expected, $actual, 'Color structure does not match');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,21 @@ class TagControllerTest extends APIControllerBaseTest
|
||||
$this->assertEquals('Test', $result[9]);
|
||||
}
|
||||
|
||||
public function testFindCollection(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->importTagFixtures();
|
||||
$this->assertAccessIsGranted($client, '/api/tags/find', 'GET', ['name' => '2018']);
|
||||
$content = $client->getResponse()->getContent();
|
||||
$this->assertNotFalse($content);
|
||||
$result = json_decode($content, true);
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertNotEmpty($result);
|
||||
$this->assertEquals(3, \count($result));
|
||||
self::assertApiResponseTypeStructure('TagEntity', $result[0]);
|
||||
}
|
||||
|
||||
public function testEmptyCollection(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
|
||||
Reference in New Issue
Block a user