Release 2.45 (#5721)
Co-authored-by: Henning Klein <info@henningklein.de>
This commit is contained in:
@@ -304,12 +304,13 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'user' => ['result' => 'object', 'type' => '@User'],
|
||||
'dueDays' => 'int',
|
||||
'invoiceNumber' => 'string',
|
||||
'metaFields' => 'array',
|
||||
'paymentDate' => '@datetime',
|
||||
'status' => 'string',
|
||||
'tax' => 'float',
|
||||
'total' => 'float',
|
||||
'vat' => 'float',
|
||||
'overdue' => 'bool',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'CustomerMeta'],
|
||||
];
|
||||
|
||||
case 'PageActionItem':
|
||||
@@ -326,8 +327,7 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
return [
|
||||
'id' => 'int',
|
||||
'name' => 'string',
|
||||
'color' => '@string',
|
||||
'color-safe' => 'string',
|
||||
'color' => 'string',
|
||||
'visible' => 'bool',
|
||||
];
|
||||
|
||||
@@ -354,14 +354,19 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
return [
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'email' => 'string',
|
||||
'enabled' => 'bool',
|
||||
'apiToken' => 'bool',
|
||||
'color' => '@string',
|
||||
'systemAccount' => 'bool',
|
||||
'color' => 'string',
|
||||
'avatar' => '@string',
|
||||
'alias' => '@string',
|
||||
'accountNumber' => '@string',
|
||||
'initials' => '@string',
|
||||
'title' => '@string',
|
||||
'language' => 'string',
|
||||
'locale' => 'string',
|
||||
'timezone' => 'string',
|
||||
];
|
||||
|
||||
// if a user is loaded explicitly
|
||||
@@ -369,20 +374,23 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
return [
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'email' => 'string',
|
||||
'enabled' => 'bool',
|
||||
'apiToken' => 'bool',
|
||||
'alias' => '@string',
|
||||
'title' => '@string',
|
||||
'supervisor' => ['result' => 'object', 'type' => '@UserEntity'],
|
||||
'systemAccount' => 'bool',
|
||||
'color' => 'string',
|
||||
'avatar' => '@string',
|
||||
'color' => '@string',
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'roles' => ['result' => 'array', 'type' => 'string'],
|
||||
'alias' => '@string',
|
||||
'accountNumber' => '@string',
|
||||
'initials' => 'string',
|
||||
'title' => '@string',
|
||||
'language' => 'string',
|
||||
'locale' => 'string',
|
||||
'timezone' => 'string',
|
||||
'accountNumber' => '@string',
|
||||
// TODO more info in entity than in collection
|
||||
'supervisor' => ['result' => 'object', 'type' => '@UserEntity'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'roles' => ['result' => 'array', 'type' => 'string'],
|
||||
'memberships' => ['result' => 'array', 'type' => 'TeamMembership'],
|
||||
'preferences' => ['result' => 'array', 'type' => 'UserPreference'],
|
||||
];
|
||||
@@ -394,7 +402,7 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
return [
|
||||
'id' => 'int',
|
||||
'name' => 'string',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
];
|
||||
|
||||
// explicitly requested team
|
||||
@@ -402,8 +410,9 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
return [
|
||||
'id' => 'int',
|
||||
'name' => 'string',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'members' => ['result' => 'array', 'type' => 'TeamMember'],
|
||||
// TODO more info in entity than in collection
|
||||
'customers' => ['result' => 'array', 'type' => '@Customer'],
|
||||
'projects' => ['result' => 'array', 'type' => '@Project'],
|
||||
'activities' => ['result' => 'array', 'type' => '@Activity'],
|
||||
@@ -430,12 +439,18 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'number' => '@string',
|
||||
'comment' => '@string',
|
||||
'currency' => 'string', // since 2.40.0
|
||||
'country' => 'string', // since 2.40.0
|
||||
'company' => '@string', // since 2.40.0
|
||||
'currency' => 'string',
|
||||
'country' => 'string',
|
||||
'company' => '@string',
|
||||
'homepage' => '@string',
|
||||
'timezone' => 'string',
|
||||
'fax' => '@string',
|
||||
'mobile' => '@string',
|
||||
'phone' => '@string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'CustomerMeta'], // since 2.45
|
||||
];
|
||||
|
||||
// if a list of customers is loaded
|
||||
@@ -445,19 +460,19 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'boolean',
|
||||
'billable' => 'bool',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'number' => '@string',
|
||||
'comment' => '@string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'CustomerMeta'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'currency' => 'string', // since 1.10
|
||||
'currency' => 'string',
|
||||
'country' => 'string',
|
||||
'company' => '@string',
|
||||
'homepage' => '@string',
|
||||
'timezone' => 'string',
|
||||
'fax' => '@string',
|
||||
'mobile' => '@string',
|
||||
'phone' => '@string',
|
||||
'timezone' => 'string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'CustomerMeta'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
];
|
||||
|
||||
// if a customer is loaded explicitly
|
||||
@@ -467,32 +482,34 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'color' => '@string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'CustomerMeta'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'homepage' => '@string',
|
||||
'color' => 'string',
|
||||
'number' => '@string',
|
||||
'comment' => '@string',
|
||||
'company' => '@string',
|
||||
'contact' => '@string',
|
||||
'address' => '@string',
|
||||
'country' => 'string',
|
||||
'currency' => 'string',
|
||||
'phone' => '@string',
|
||||
'country' => 'string',
|
||||
'company' => '@string',
|
||||
'homepage' => '@string',
|
||||
'timezone' => 'string',
|
||||
'fax' => '@string',
|
||||
'mobile' => '@string',
|
||||
'phone' => '@string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'CustomerMeta'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
// TODO more info in entity than in collection
|
||||
'contact' => '@string',
|
||||
'email' => '@string',
|
||||
'timezone' => 'string',
|
||||
'vatId' => '@string',
|
||||
'addressLine1' => '@string',
|
||||
'addressLine2' => '@string',
|
||||
'addressLine3' => '@string',
|
||||
'city' => '@string',
|
||||
'postCode' => '@string',
|
||||
'buyerReference' => '@string',
|
||||
// only available in the entity itself
|
||||
'address' => '@string', // deprecated, do not expose in collection
|
||||
'budget' => 'float',
|
||||
'timeBudget' => 'int',
|
||||
'vatId' => '@string', // since 1.10
|
||||
'budgetType' => '@string', // since 1.15
|
||||
'addressLine1' => '@string', // since 2.32
|
||||
'addressLine2' => '@string', // since 2.32
|
||||
'addressLine3' => '@string', // since 2.32
|
||||
'city' => '@string', // since 2.32
|
||||
'postCode' => '@string', // since 2.32
|
||||
'buyerReference' => '@string', // since 2.41
|
||||
'budgetType' => '@string',
|
||||
];
|
||||
|
||||
// if a project is embedded
|
||||
@@ -502,14 +519,16 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'customer' => 'int',
|
||||
'number' => '@string',
|
||||
'orderNumber' => '@string',
|
||||
'orderDate' => '@date',
|
||||
'globalActivities' => 'bool',
|
||||
'comment' => '@string',
|
||||
'start' => '@datetime',
|
||||
'end' => '@datetime',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
];
|
||||
|
||||
// if a project is embedded in an expanded collection (here timesheet)
|
||||
@@ -519,14 +538,16 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'customer' => ['result' => 'object', 'type' => 'Customer'],
|
||||
'number' => '@string',
|
||||
'orderNumber' => '@string',
|
||||
'orderDate' => '@date',
|
||||
'globalActivities' => 'bool',
|
||||
'comment' => '@string',
|
||||
'start' => '@datetime',
|
||||
'end' => '@datetime',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
];
|
||||
|
||||
// if a collection of projects is loaded
|
||||
@@ -536,17 +557,18 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'color' => 'string',
|
||||
'customer' => 'int',
|
||||
'number' => '@string',
|
||||
'orderNumber' => '@string',
|
||||
'color' => '@string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
'parentTitle' => 'string',
|
||||
'orderDate' => '@date',
|
||||
'globalActivities' => 'bool',
|
||||
'comment' => '@string',
|
||||
'start' => '@datetime',
|
||||
'end' => '@datetime',
|
||||
'globalActivities' => 'bool',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'comment' => '@string',
|
||||
'parentTitle' => 'string',
|
||||
];
|
||||
|
||||
// if a project is explicitly loaded
|
||||
@@ -556,21 +578,22 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'name' => 'string',
|
||||
'visible' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'color' => 'string',
|
||||
'customer' => 'int',
|
||||
'number' => '@string',
|
||||
'color' => '@string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
'parentTitle' => 'string',
|
||||
'start' => '@date',
|
||||
'end' => '@date',
|
||||
'globalActivities' => 'bool',
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'comment' => '@string',
|
||||
'budget' => 'float',
|
||||
'timeBudget' => 'int',
|
||||
'orderNumber' => '@string',
|
||||
'orderDate' => '@date',
|
||||
'budgetType' => '@string', // since 1.15
|
||||
'globalActivities' => 'bool',
|
||||
'comment' => '@string',
|
||||
'start' => '@date',
|
||||
'end' => '@date',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'parentTitle' => 'string',
|
||||
// only available in the entity itself
|
||||
'budget' => 'float',
|
||||
'timeBudget' => 'int',
|
||||
'budgetType' => '@string',
|
||||
];
|
||||
|
||||
// embedded activities
|
||||
@@ -582,7 +605,8 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'billable' => 'bool',
|
||||
'project' => '@int',
|
||||
'number' => '@string',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'], // since 2.45
|
||||
'comment' => '@string',
|
||||
];
|
||||
|
||||
@@ -594,7 +618,8 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'billable' => 'bool',
|
||||
'project' => ['result' => 'object', 'type' => '@ProjectExpanded'],
|
||||
'number' => '@string',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'], // since 2.45
|
||||
'comment' => '@string',
|
||||
];
|
||||
|
||||
@@ -607,10 +632,10 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'billable' => 'bool',
|
||||
'project' => '@int',
|
||||
'number' => '@string',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
'parentTitle' => '@string',
|
||||
'comment' => '@string',
|
||||
'parentTitle' => '@string',
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
];
|
||||
|
||||
@@ -623,14 +648,15 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'billable' => 'bool',
|
||||
'project' => '@int',
|
||||
'number' => '@string',
|
||||
'color' => '@string',
|
||||
'color' => 'string',
|
||||
'metaFields' => ['result' => 'array', 'type' => 'ProjectMeta'],
|
||||
'parentTitle' => '@string',
|
||||
'comment' => '@string',
|
||||
'parentTitle' => '@string',
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
// only available in the entity itself
|
||||
'budget' => 'float',
|
||||
'timeBudget' => 'int',
|
||||
'teams' => ['result' => 'array', 'type' => 'Team'],
|
||||
'budgetType' => '@string', // since 1.15
|
||||
'budgetType' => '@string',
|
||||
];
|
||||
|
||||
case 'TimesheetEntity':
|
||||
@@ -651,7 +677,7 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'billable' => 'bool',
|
||||
'fixedRate' => '@float',
|
||||
'hourlyRate' => '@float',
|
||||
// TODO new fields: category
|
||||
'break' => 'int',
|
||||
];
|
||||
|
||||
case 'TimesheetExpanded':
|
||||
@@ -672,7 +698,7 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'billable' => 'bool',
|
||||
'fixedRate' => '@float',
|
||||
'hourlyRate' => '@float',
|
||||
// TODO new fields: category
|
||||
'break' => 'int',
|
||||
];
|
||||
|
||||
case 'TimesheetCollection':
|
||||
@@ -691,6 +717,7 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'internalRate' => 'float',
|
||||
'exported' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'break' => 'int',
|
||||
];
|
||||
|
||||
case 'TimesheetCollectionFull':
|
||||
@@ -709,6 +736,7 @@ abstract class APIControllerBaseTestCase extends AbstractControllerBaseTestCase
|
||||
'internalRate' => 'float',
|
||||
'exported' => 'bool',
|
||||
'billable' => 'bool',
|
||||
'break' => 'int',
|
||||
];
|
||||
|
||||
default:
|
||||
|
||||
@@ -258,7 +258,7 @@ class ActivityControllerTest extends APIControllerBaseTestCase
|
||||
self::assertNull($result['budgetType']);
|
||||
self::assertNull($result['number']);
|
||||
self::assertEquals('Test comment', $result['comment']);
|
||||
self::assertNull($result['color']);
|
||||
self::assertEquals('#5319e7', $result['color']);
|
||||
self::assertTrue($result['visible']);
|
||||
self::assertTrue($result['billable']);
|
||||
}
|
||||
@@ -297,7 +297,7 @@ class ActivityControllerTest extends APIControllerBaseTestCase
|
||||
self::assertEquals('Test', $result['parentTitle']);
|
||||
self::assertNotEmpty($result['id']);
|
||||
self::assertIsArray($result['teams']);
|
||||
self::assertEquals([['id' => 1, 'name' => 'Test team', 'color' => null]], $result['teams']);
|
||||
self::assertEquals([['id' => 1, 'name' => 'Test team', 'color' => '#03A9F4']], $result['teams']);
|
||||
self::assertIsArray($result['metaFields']);
|
||||
self::assertEquals([], $result['metaFields']);
|
||||
self::assertEquals('foo', $result['name']);
|
||||
|
||||
@@ -262,7 +262,7 @@ class CustomerControllerTest extends APIControllerBaseTestCase
|
||||
self::assertNull($result['homepage']);
|
||||
self::assertEquals('Europe/Berlin', $result['timezone']);
|
||||
self::assertNull($result['buyerReference']);
|
||||
self::assertNull($result['color']);
|
||||
self::assertEquals('#5319e7', $result['color']);
|
||||
self::assertTrue($result['visible']);
|
||||
self::assertTrue($result['billable']);
|
||||
}
|
||||
@@ -316,7 +316,7 @@ class CustomerControllerTest extends APIControllerBaseTestCase
|
||||
self::assertApiResponseTypeStructure('CustomerEntity', $result);
|
||||
self::assertNotEmpty($result['id']);
|
||||
self::assertIsArray($result['teams']);
|
||||
self::assertEquals([['id' => 1, 'name' => 'Test team', 'color' => null]], $result['teams']);
|
||||
self::assertEquals([['id' => 1, 'name' => 'Test team', 'color' => '#03A9F4']], $result['teams']);
|
||||
self::assertIsArray($result['metaFields']);
|
||||
self::assertEquals([], $result['metaFields']);
|
||||
self::assertEquals('foo', $result['name']);
|
||||
|
||||
@@ -329,7 +329,7 @@ class ProjectControllerTest extends APIControllerBaseTestCase
|
||||
self::assertNull($result['orderNumber']);
|
||||
self::assertNull($result['number']);
|
||||
self::assertNull($result['comment']);
|
||||
self::assertNull($result['color']);
|
||||
self::assertEquals('#2ECC40', $result['color']);
|
||||
self::assertTrue($result['globalActivities']);
|
||||
self::assertTrue($result['billable']);
|
||||
self::assertTrue($result['visible']);
|
||||
@@ -374,7 +374,7 @@ class ProjectControllerTest extends APIControllerBaseTestCase
|
||||
self::assertEquals('Test', $result['parentTitle']);
|
||||
self::assertNotEmpty($result['id']);
|
||||
self::assertIsArray($result['teams']);
|
||||
self::assertEquals([['id' => 1, 'name' => 'Test team', 'color' => null]], $result['teams']);
|
||||
self::assertEquals([['id' => 1, 'name' => 'Test team', 'color' => '#03A9F4']], $result['teams']);
|
||||
self::assertIsArray($result['metaFields']);
|
||||
self::assertEquals([], $result['metaFields']);
|
||||
self::assertEquals('foo', $result['name']);
|
||||
|
||||
@@ -34,6 +34,7 @@ class ActivityTest extends AbstractEntityTestCase
|
||||
self::assertTrue($sut->isBillable());
|
||||
self::assertTrue($sut->isGlobal());
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertIsString($sut->getColorSafe());
|
||||
self::assertFalse($sut->hasColor());
|
||||
self::assertInstanceOf(Collection::class, $sut->getMetaFields());
|
||||
self::assertEquals(0, $sut->getMetaFields()->count());
|
||||
@@ -71,6 +72,9 @@ class ActivityTest extends AbstractEntityTestCase
|
||||
$sut->setColor('#fffccc');
|
||||
self::assertEquals('#fffccc', $sut->getColor());
|
||||
self::assertTrue($sut->hasColor());
|
||||
self::assertNotEmpty($sut->getColorSafe());
|
||||
$sut->setName('alsjdkhfalsf');
|
||||
self::assertEquals('#fffccc', $sut->getColorSafe());
|
||||
|
||||
$sut->setColor(Constants::DEFAULT_COLOR);
|
||||
self::assertNull($sut->getColor());
|
||||
|
||||
@@ -53,6 +53,7 @@ class CustomerTest extends AbstractEntityTestCase
|
||||
self::assertNull($sut->getTimezone());
|
||||
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertEquals('#e135f4', $sut->getColorSafe());
|
||||
self::assertFalse($sut->hasColor());
|
||||
self::assertInstanceOf(Collection::class, $sut->getMetaFields());
|
||||
self::assertEquals(0, $sut->getMetaFields()->count());
|
||||
|
||||
@@ -38,6 +38,7 @@ class ProjectTest extends AbstractEntityTestCase
|
||||
self::assertTrue($sut->isBillable());
|
||||
self::assertTrue($sut->isGlobalActivities());
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertIsString($sut->getColorSafe());
|
||||
self::assertFalse($sut->hasColor());
|
||||
self::assertInstanceOf(Collection::class, $sut->getMetaFields());
|
||||
self::assertEquals(0, $sut->getMetaFields()->count());
|
||||
@@ -60,9 +61,21 @@ class ProjectTest extends AbstractEntityTestCase
|
||||
self::assertInstanceOf(Project::class, $sut->setCustomer($customer));
|
||||
self::assertSame($customer, $sut->getCustomer());
|
||||
|
||||
self::assertFalse($sut->hasColor());
|
||||
$sut->setColor('#fffccc');
|
||||
self::assertEquals('#fffccc', $sut->getColor());
|
||||
self::assertIsString($sut->getColorSafe());
|
||||
self::assertTrue($sut->hasColor());
|
||||
|
||||
$sut->setColor(Constants::DEFAULT_COLOR);
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertFalse($sut->hasColor());
|
||||
|
||||
self::assertInstanceOf(Project::class, $sut->setName('123456789'));
|
||||
self::assertEquals('123456789', (string) $sut);
|
||||
|
||||
self::assertEquals('#FF9800', $sut->getColorSafe());
|
||||
|
||||
self::assertInstanceOf(Project::class, $sut->setOrderNumber('123456789'));
|
||||
self::assertEquals('123456789', $sut->getOrderNumber());
|
||||
|
||||
@@ -88,15 +101,6 @@ class ProjectTest extends AbstractEntityTestCase
|
||||
$sut->setInvoiceText('very long invoice text comment 12324');
|
||||
self::assertEquals('very long invoice text comment 12324', $sut->getInvoiceText());
|
||||
|
||||
self::assertFalse($sut->hasColor());
|
||||
$sut->setColor('#fffccc');
|
||||
self::assertEquals('#fffccc', $sut->getColor());
|
||||
self::assertTrue($sut->hasColor());
|
||||
|
||||
$sut->setColor(Constants::DEFAULT_COLOR);
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertFalse($sut->hasColor());
|
||||
|
||||
self::assertInstanceOf(Project::class, $sut->setVisible(false));
|
||||
self::assertFalse($sut->isVisible());
|
||||
|
||||
|
||||
@@ -28,9 +28,11 @@ class TagTest extends TestCase
|
||||
{
|
||||
$sut = new Tag();
|
||||
|
||||
self::assertIsString($sut->getColorSafe());
|
||||
self::assertInstanceOf(Tag::class, $sut->setName('foo'));
|
||||
self::assertEquals('foo', $sut->getName());
|
||||
self::assertEquals('foo', (string) $sut);
|
||||
self::assertEquals('#e135f4', $sut->getColorSafe());
|
||||
|
||||
$sut->setName(null);
|
||||
self::assertNull($sut->getName());
|
||||
|
||||
@@ -43,6 +43,7 @@ class TeamTest extends TestCase
|
||||
{
|
||||
$sut = new Team('foo');
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertEquals('#e135f4', $sut->getColorSafe());
|
||||
self::assertFalse($sut->hasColor());
|
||||
|
||||
$sut->setColor(Constants::DEFAULT_COLOR);
|
||||
|
||||
@@ -155,26 +155,6 @@ class TimesheetTest extends TestCase
|
||||
self::assertTrue($sut->isBillable());
|
||||
}
|
||||
|
||||
public function testCategory(): void
|
||||
{
|
||||
$sut = new Timesheet();
|
||||
self::assertInstanceOf(Timesheet::class, $sut->setCategory(Timesheet::HOLIDAY));
|
||||
self::assertEquals('holiday', $sut->getCategory());
|
||||
self::assertInstanceOf(Timesheet::class, $sut->setCategory(Timesheet::WORK));
|
||||
self::assertEquals('work', $sut->getCategory());
|
||||
self::assertInstanceOf(Timesheet::class, $sut->setCategory(Timesheet::SICKNESS));
|
||||
self::assertEquals('sickness', $sut->getCategory());
|
||||
self::assertInstanceOf(Timesheet::class, $sut->setCategory(Timesheet::PARENTAL));
|
||||
self::assertEquals('parental', $sut->getCategory());
|
||||
self::assertInstanceOf(Timesheet::class, $sut->setCategory(Timesheet::OVERTIME));
|
||||
self::assertEquals('overtime', $sut->getCategory());
|
||||
|
||||
self::expectException(\InvalidArgumentException::class);
|
||||
self::expectExceptionMessage('Invalid timesheet category "foo" given, expected one of: work, holiday, sickness, parental, overtime');
|
||||
|
||||
$sut->setCategory('foo');
|
||||
}
|
||||
|
||||
public function testClone(): void
|
||||
{
|
||||
$sut = new Timesheet();
|
||||
|
||||
@@ -34,6 +34,7 @@ class UserTest extends TestCase
|
||||
self::assertInstanceOf(EquatableInterface::class, $user);
|
||||
self::assertInstanceOf(UserInterface::class, $user);
|
||||
self::assertInstanceOf(ArrayCollection::class, $user->getPreferences());
|
||||
self::assertEquals([], $user->getVisiblePreferences());
|
||||
self::assertNull($user->getTitle());
|
||||
self::assertNull($user->getAvatar());
|
||||
self::assertNull($user->getAlias());
|
||||
@@ -186,9 +187,13 @@ class UserTest extends TestCase
|
||||
self::assertNull($sut->getColor());
|
||||
self::assertFalse($sut->hasColor());
|
||||
|
||||
$sut->setUsername('foo test 123');
|
||||
self::assertEquals('#a972c9', $sut->getColorSafe());
|
||||
|
||||
$sut->setColor('#000000');
|
||||
self::assertEquals('#000000', $sut->getColor());
|
||||
self::assertTrue($sut->hasColor());
|
||||
self::assertEquals('#000000', $sut->getColorSafe());
|
||||
}
|
||||
|
||||
public function testWizards(): void
|
||||
@@ -268,6 +273,19 @@ class UserTest extends TestCase
|
||||
$prefs = $user->getPreferences();
|
||||
self::assertCount(3, $prefs);
|
||||
|
||||
$preference1 = new UserPreference('_aaaaa', 'bbbbb');
|
||||
$user->addPreference($preference1);
|
||||
|
||||
$preference2 = new UserPreference('AAAAAA', 'CCCCCC');
|
||||
$user->addPreference($preference2);
|
||||
|
||||
$prefs = $user->getPreferences();
|
||||
self::assertCount(5, $prefs);
|
||||
|
||||
$visiblePrefs = $user->getVisiblePreferences();
|
||||
self::assertCount(3, $visiblePrefs); // export_decimal and _aaaaa is skipped
|
||||
self::assertEquals([$user->getPreference('test'), $user->getPreference('test2'), $preference2], $visiblePrefs);
|
||||
|
||||
self::assertInstanceOf(UserPreference::class, $prefs[0]);
|
||||
self::assertEquals('test', $prefs[0]->getName());
|
||||
|
||||
|
||||
29
tests/Event/AbstractTeamEventTestCase.php
Normal file
29
tests/Event/AbstractTeamEventTestCase.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
|
||||
abstract class AbstractTeamEventTestCase extends TestCase
|
||||
{
|
||||
abstract protected function createTeamEvent(Team $team): AbstractTeamEvent;
|
||||
|
||||
public function testGetterAndSetter(): void
|
||||
{
|
||||
$team = new Team('foo');
|
||||
$sut = $this->createTeamEvent($team);
|
||||
|
||||
self::assertInstanceOf(Event::class, $sut);
|
||||
self::assertSame($team, $sut->getTeam());
|
||||
}
|
||||
}
|
||||
25
tests/Event/TeamCreateEventTest.php
Normal file
25
tests/Event/TeamCreateEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use App\Event\TeamCreateEvent;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(AbstractTeamEventTestCase::class)]
|
||||
#[CoversClass(TeamCreateEvent::class)]
|
||||
class TeamCreateEventTest extends AbstractTeamEventTestCase
|
||||
{
|
||||
protected function createTeamEvent(Team $team): AbstractTeamEvent
|
||||
{
|
||||
return new TeamCreateEvent($team);
|
||||
}
|
||||
}
|
||||
25
tests/Event/TeamCreatePostEventTest.php
Normal file
25
tests/Event/TeamCreatePostEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use App\Event\TeamCreatePostEvent;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(AbstractTeamEventTestCase::class)]
|
||||
#[CoversClass(TeamCreatePostEvent::class)]
|
||||
class TeamCreatePostEventTest extends AbstractTeamEventTestCase
|
||||
{
|
||||
protected function createTeamEvent(Team $team): AbstractTeamEvent
|
||||
{
|
||||
return new TeamCreatePostEvent($team);
|
||||
}
|
||||
}
|
||||
25
tests/Event/TeamCreatePreEventTest.php
Normal file
25
tests/Event/TeamCreatePreEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use App\Event\TeamCreatePreEvent;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(AbstractTeamEventTestCase::class)]
|
||||
#[CoversClass(TeamCreatePreEvent::class)]
|
||||
class TeamCreatePreEventTest extends AbstractTeamEventTestCase
|
||||
{
|
||||
protected function createTeamEvent(Team $team): AbstractTeamEvent
|
||||
{
|
||||
return new TeamCreatePreEvent($team);
|
||||
}
|
||||
}
|
||||
25
tests/Event/TeamDeleteEventTest.php
Normal file
25
tests/Event/TeamDeleteEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use App\Event\TeamDeleteEvent;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(AbstractTeamEventTestCase::class)]
|
||||
#[CoversClass(TeamDeleteEvent::class)]
|
||||
class TeamDeleteEventTest extends AbstractTeamEventTestCase
|
||||
{
|
||||
protected function createTeamEvent(Team $team): AbstractTeamEvent
|
||||
{
|
||||
return new TeamDeleteEvent($team);
|
||||
}
|
||||
}
|
||||
25
tests/Event/TeamUpdatePostEventTest.php
Normal file
25
tests/Event/TeamUpdatePostEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use App\Event\TeamUpdatePostEvent;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(AbstractTeamEventTestCase::class)]
|
||||
#[CoversClass(TeamUpdatePostEvent::class)]
|
||||
class TeamUpdatePostEventTest extends AbstractTeamEventTestCase
|
||||
{
|
||||
protected function createTeamEvent(Team $team): AbstractTeamEvent
|
||||
{
|
||||
return new TeamUpdatePostEvent($team);
|
||||
}
|
||||
}
|
||||
25
tests/Event/TeamUpdatePreEventTest.php
Normal file
25
tests/Event/TeamUpdatePreEventTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Event;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Event\AbstractTeamEvent;
|
||||
use App\Event\TeamUpdatePreEvent;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
|
||||
#[CoversClass(AbstractTeamEventTestCase::class)]
|
||||
#[CoversClass(TeamUpdatePreEvent::class)]
|
||||
class TeamUpdatePreEventTest extends AbstractTeamEventTestCase
|
||||
{
|
||||
protected function createTeamEvent(Team $team): AbstractTeamEvent
|
||||
{
|
||||
return new TeamUpdatePreEvent($team);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user