Release 2.0.2 (#3856)
* allow to overwrite global spreadsheet styles * bump version * fix deprecations in vcard download * bump composer packages * added help page for all registered locales * fix menu id's, cleanup times route, fix configurable homepage redirect * format duration without leading zero in hours (unify javascript with php behavior) * fix active records in all screen sizes * improved responsiveness in XS * fixed invoice number for customer null fields * fix javascript respects multiple recent-activity dropdowns * show recent activities on small screens * fix user-profile layout column in XS * fix search is always marked as active
This commit is contained in:
@@ -17,12 +17,12 @@ use App\Tests\DataFixtures\TimesheetFixtures;
|
||||
*/
|
||||
class FavoriteControllerTest extends ControllerBaseTest
|
||||
{
|
||||
public function testIsSecure()
|
||||
public function testIsSecure(): void
|
||||
{
|
||||
$this->assertUrlIsSecured('/favorite/timesheet/');
|
||||
}
|
||||
|
||||
public function testIndexAction()
|
||||
public function testIndexAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$start = new \DateTime('first day of this month');
|
||||
@@ -38,7 +38,9 @@ class FavoriteControllerTest extends ControllerBaseTest
|
||||
$this->assertTrue($client->getResponse()->isSuccessful());
|
||||
|
||||
$content = $client->getResponse()->getContent();
|
||||
self::assertStringContainsString('<div class="nav-item dropdown d-none d-md-flex me-3 notifications-menu" data-reload="/en/favorite/timesheet/">', $content);
|
||||
self::assertStringContainsString('<div class="card-header">Restart one of your last activities</div>', $content);
|
||||
self::assertNotFalse($content);
|
||||
self::assertStringContainsString('<div class="nav-item dropdown d-flex me-sm-3 me-1 notifications-menu" data-reload="/en/favorite/timesheet/">', $content);
|
||||
self::assertStringContainsString('<div class="card-header">', $content);
|
||||
self::assertStringContainsString('Restart one of your last activities', $content);
|
||||
}
|
||||
}
|
||||
|
||||
25
tests/Controller/HelpControllerTest.php
Normal file
25
tests/Controller/HelpControllerTest.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\Controller;
|
||||
|
||||
use App\Entity\User;
|
||||
|
||||
/**
|
||||
* @group integration
|
||||
*/
|
||||
class HelpControllerTest extends ControllerBaseTest
|
||||
{
|
||||
public function testHelpLocalesAction(): void
|
||||
{
|
||||
$client = $this->getClientForAuthenticatedUser(User::ROLE_USER);
|
||||
$this->assertAccessIsGranted($client, '/help/locales');
|
||||
$this->assertDataTableRowCount($client, 'datatable_help_locales', 25); // @see services_test.yaml
|
||||
}
|
||||
}
|
||||
@@ -42,9 +42,7 @@ class HomepageControllerTest extends ControllerBaseTest
|
||||
|
||||
$em->persist($pref);
|
||||
$user->addPreference($pref);
|
||||
|
||||
$user->setLanguage('ar');
|
||||
|
||||
$em->flush();
|
||||
|
||||
$this->request($client, '/homepage');
|
||||
|
||||
@@ -31,7 +31,7 @@ class ConfigureMainMenuEventTest extends TestCase
|
||||
self::assertNull($sut->getInvoiceMenu());
|
||||
self::assertNull($sut->getReportingMenu());
|
||||
|
||||
$timesheet = new MenuItemModel('timesheet', 'timesheet');
|
||||
$timesheet = new MenuItemModel('times', 'timesheet');
|
||||
$sut->getMenu()->addChild($timesheet);
|
||||
self::assertNotNull($sut->getTimesheetMenu());
|
||||
self::assertSame($timesheet, $sut->getTimesheetMenu());
|
||||
@@ -41,9 +41,19 @@ class ConfigureMainMenuEventTest extends TestCase
|
||||
self::assertNotNull($sut->getInvoiceMenu());
|
||||
self::assertSame($invoice, $sut->getInvoiceMenu());
|
||||
|
||||
self::assertNull($sut->findById('reporting'));
|
||||
self::assertNull($sut->findById('foo'));
|
||||
self::assertNull($sut->findById('bar'));
|
||||
|
||||
$reporting = new MenuItemModel('reporting', 'reporting');
|
||||
$sut->getMenu()->addChild($reporting);
|
||||
$reporting->addChild(new MenuItemModel('foo', 'foo'));
|
||||
$reporting->addChild(new MenuItemModel('bar', 'bar'));
|
||||
self::assertNotNull($sut->getReportingMenu());
|
||||
self::assertSame($reporting, $sut->getReportingMenu());
|
||||
|
||||
self::assertSame($reporting, $sut->findById('reporting'));
|
||||
self::assertNotNull($sut->findById('foo'));
|
||||
self::assertNotNull($sut->findById('bar'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,14 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class DateRangeTest extends TestCase
|
||||
{
|
||||
public function testDefaultValues()
|
||||
public function testDefaultValues(): void
|
||||
{
|
||||
$sut = new DateRange();
|
||||
self::assertNull($sut->getBegin());
|
||||
self::assertNull($sut->getEnd());
|
||||
}
|
||||
|
||||
public function testSetterAndGetter()
|
||||
public function testSetterAndGetter(): void
|
||||
{
|
||||
$begin = new \DateTime('now');
|
||||
$end = new \DateTime('2018-11-25 18:45:32');
|
||||
@@ -34,7 +34,73 @@ class DateRangeTest extends TestCase
|
||||
self::assertInstanceOf(DateRange::class, $sut->setBegin($begin));
|
||||
self::assertInstanceOf(DateRange::class, $sut->setEnd($end));
|
||||
|
||||
self::assertInstanceOf(\DateTime::class, $sut->getBegin());
|
||||
self::assertInstanceOf(\DateTime::class, $sut->getEnd());
|
||||
|
||||
self::assertEquals($begin->format('Y-m-d') . ' 00:00:00', $sut->getBegin()->format('Y-m-d H:i:s'));
|
||||
self::assertEquals('2018-11-25 23:59:59', $sut->getEnd()->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
public function testEquatableInterface(): void
|
||||
{
|
||||
self::assertTrue((new DateRange())->isEqualTo(new DateRange()));
|
||||
|
||||
$sut = new DateRange();
|
||||
$sut->setBegin(new \DateTime('now'));
|
||||
$sut->setEnd(new \DateTime('+2 minutes'));
|
||||
|
||||
$sut1 = new DateRange();
|
||||
$sut1->setBegin(new \DateTime('+2 minutes'));
|
||||
$sut1->setEnd(new \DateTime('now'));
|
||||
|
||||
self::assertTrue($sut->isEqualTo($sut1));
|
||||
self::assertTrue($sut1->isEqualTo($sut));
|
||||
|
||||
$sut = new DateRange(false);
|
||||
$sut->setBegin(new \DateTime('now'));
|
||||
$sut->setEnd(new \DateTime('+2 minutes'));
|
||||
|
||||
$sut1 = new DateRange();
|
||||
$sut1->setBegin(new \DateTime('+2 minutes'));
|
||||
$sut1->setEnd(new \DateTime('now'));
|
||||
|
||||
self::assertFalse($sut->isEqualTo($sut1));
|
||||
self::assertFalse($sut1->isEqualTo($sut));
|
||||
|
||||
$sut = new DateRange();
|
||||
$sut->setBegin(new \DateTime('now'));
|
||||
|
||||
$sut1 = new DateRange();
|
||||
$sut1->setBegin(new \DateTime('+1 day'));
|
||||
|
||||
self::assertFalse($sut->isEqualTo($sut1));
|
||||
self::assertFalse($sut1->isEqualTo($sut));
|
||||
|
||||
$sut = new DateRange();
|
||||
$sut->setBegin(new \DateTime('now'));
|
||||
|
||||
$sut1 = new DateRange();
|
||||
$sut1->setEnd(new \DateTime('now'));
|
||||
|
||||
self::assertFalse($sut->isEqualTo($sut1));
|
||||
self::assertFalse($sut1->isEqualTo($sut));
|
||||
|
||||
$sut = new DateRange();
|
||||
$sut->setBegin(new \DateTime('now'));
|
||||
|
||||
$sut1 = new DateRange();
|
||||
$sut1->setBegin(new \DateTime('now'));
|
||||
|
||||
self::assertTrue($sut->isEqualTo($sut1));
|
||||
self::assertTrue($sut1->isEqualTo($sut));
|
||||
|
||||
$sut = new DateRange();
|
||||
$sut->setEnd(new \DateTime('now'));
|
||||
|
||||
$sut1 = new DateRange();
|
||||
$sut1->setEnd(new \DateTime('now'));
|
||||
|
||||
self::assertTrue($sut->isEqualTo($sut1));
|
||||
self::assertTrue($sut1->isEqualTo($sut));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class ConfigurableNumberGeneratorTest extends TestCase
|
||||
{
|
||||
private function getSut(string $format, int $counter = 1)
|
||||
private function getSut(string $format, int $counter = 1): ConfigurableNumberGenerator
|
||||
{
|
||||
$config = SystemConfigurationFactory::createStub(['invoice' => ['number_format' => $format]]);
|
||||
|
||||
@@ -53,7 +53,10 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
return new ConfigurableNumberGenerator($repository, $config);
|
||||
}
|
||||
|
||||
public function getTestData()
|
||||
/**
|
||||
* @return array<int, array<int, string|\DateTime|int>>
|
||||
*/
|
||||
public function getTestData(): array
|
||||
{
|
||||
$invoiceDate = new \DateTime();
|
||||
|
||||
@@ -143,7 +146,7 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getTestData
|
||||
*/
|
||||
public function testGetInvoiceNumber(string $format, string $expectedInvoiceNumber, \DateTime $invoiceDate, int $counter = 1)
|
||||
public function testGetInvoiceNumber(string $format, string $expectedInvoiceNumber, \DateTime $invoiceDate, int $counter = 1): void
|
||||
{
|
||||
$customer = new Customer('Acme company');
|
||||
$customer->setNumber('0815');
|
||||
@@ -163,7 +166,10 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
$this->assertEquals('default', $sut->getId());
|
||||
}
|
||||
|
||||
public function getInvalidTestData()
|
||||
/**
|
||||
* @return array<int, array<int, string|\DateTime>>
|
||||
*/
|
||||
public function getInvalidTestData(): array
|
||||
{
|
||||
$invoiceDate = new \DateTime();
|
||||
|
||||
@@ -188,7 +194,7 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
/**
|
||||
* @dataProvider getInvalidTestData
|
||||
*/
|
||||
public function testInvalidGetInvoiceNumber(string $format, \DateTime $invoiceDate, string $brokenPart)
|
||||
public function testInvalidGetInvoiceNumber(string $format, \DateTime $invoiceDate, string $brokenPart): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage(sprintf('Unknown %s found', $brokenPart));
|
||||
@@ -201,4 +207,40 @@ class ConfigurableNumberGeneratorTest extends TestCase
|
||||
|
||||
$sut->getInvoiceNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array<int, string>>
|
||||
*/
|
||||
public function getMissingFieldTestData(): array
|
||||
{
|
||||
return [
|
||||
['{Y}/{cnumber}_{ccy,3}', 'Customer has no number, replacer {cnumber} failed evaluation'],
|
||||
['{Y}/{cname}_{ccy,3}', 'Customer has no name, replacer {cname} failed evaluation'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getMissingFieldTestData
|
||||
*/
|
||||
public function testCustomerHasMissingField(string $format, string $message): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage($message);
|
||||
|
||||
$user = $this->createMock(User::class);
|
||||
$user->method('getId')->willReturn(13);
|
||||
$user->method('getAccountNumber')->willReturn('0815');
|
||||
|
||||
$customer = new Customer('');
|
||||
$customer->setName(null);
|
||||
|
||||
$sut = $this->getSut($format);
|
||||
$model = (new InvoiceModelFactoryFactory($this))->create()->createModel(new DebugFormatter());
|
||||
$model->setInvoiceDate(new \DateTime());
|
||||
$model->setCustomer($customer);
|
||||
$model->setUser($user);
|
||||
$sut->setModel($model);
|
||||
|
||||
$sut->getInvoiceNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3342,21 +3342,6 @@ parameters:
|
||||
count: 2
|
||||
path: Controller/ExportControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\FavoriteControllerTest\\:\\:testIndexAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/FavoriteControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\FavoriteControllerTest\\:\\:testIsSecure\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Controller/FavoriteControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|false given\\.$#"
|
||||
count: 2
|
||||
path: Controller/FavoriteControllerTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Controller\\\\HomepageControllerTest\\:\\:testIndexAction\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
@@ -6957,21 +6942,6 @@ parameters:
|
||||
count: 1
|
||||
path: Form/Extension/IconExtensionTest.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method format\\(\\) on DateTime\\|null\\.$#"
|
||||
count: 2
|
||||
path: Form/Model/DateRangeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Model\\\\DateRangeTest\\:\\:testDefaultValues\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/Model/DateRangeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Model\\\\DateRangeTest\\:\\:testSetterAndGetter\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/Model/DateRangeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Model\\\\SystemConfigurationTest\\:\\:testDefaultValues\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
@@ -7507,31 +7477,6 @@ parameters:
|
||||
count: 1
|
||||
path: Invoice/InvoiceModelTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\NumberGenerator\\\\ConfigurableNumberGeneratorTest\\:\\:getInvalidTestData\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/NumberGenerator/ConfigurableNumberGeneratorTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\NumberGenerator\\\\ConfigurableNumberGeneratorTest\\:\\:getSut\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/NumberGenerator/ConfigurableNumberGeneratorTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\NumberGenerator\\\\ConfigurableNumberGeneratorTest\\:\\:getTestData\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/NumberGenerator/ConfigurableNumberGeneratorTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\NumberGenerator\\\\ConfigurableNumberGeneratorTest\\:\\:testGetInvoiceNumber\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/NumberGenerator/ConfigurableNumberGeneratorTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\NumberGenerator\\\\ConfigurableNumberGeneratorTest\\:\\:testInvalidGetInvoiceNumber\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Invoice/NumberGenerator/ConfigurableNumberGeneratorTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\NumberGenerator\\\\DateNumberGeneratorTest\\:\\:getSut\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
|
||||
Reference in New Issue
Block a user