Release 2.50 (#5835)
* replace p-0 class with fullsize embed option * bump parsedown package * remove support for file:// urls * fix missing macro in export print template * fix weekly hours with breaks
This commit is contained in:
@@ -15,13 +15,17 @@ use App\Form\Type\QuickEntryTimesheetType;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Form\FormExtensionInterface;
|
||||
use Symfony\Component\Form\PreloadedExtension;
|
||||
use Symfony\Component\Form\Test\TypeTestCase;
|
||||
|
||||
#[CoversClass(QuickEntryTimesheetType::class)]
|
||||
class QuickEntryTimesheetTypeTest extends TypeTestCase
|
||||
{
|
||||
protected function getExtensions()
|
||||
/**
|
||||
* @return FormExtensionInterface[]
|
||||
*/
|
||||
protected function getExtensions(): array
|
||||
{
|
||||
$auth = $this->createMock(Security::class);
|
||||
$auth->method('getUser')->willReturn(new User());
|
||||
@@ -36,18 +40,19 @@ class QuickEntryTimesheetTypeTest extends TypeTestCase
|
||||
|
||||
public static function getTestData()
|
||||
{
|
||||
yield [4.5, 16200];
|
||||
yield ['4,5', 16200];
|
||||
yield ['4:30', 16200];
|
||||
yield ['4h30m', 16200];
|
||||
yield [4.5, 0, 16200];
|
||||
yield ['4,5', 0, 16200];
|
||||
yield ['4:30', 0, 16200];
|
||||
yield ['4h30m', 0, 16200];
|
||||
yield ['4h30m', 1800, 16200]; // it is important, that the duration does not change with breaks
|
||||
}
|
||||
|
||||
#[DataProvider('getTestData')]
|
||||
public function testSubmitValidData($value, $expectedDuration): void
|
||||
public function testSubmitValidData(string|float $value, int $break, int $expectedDuration): void
|
||||
{
|
||||
$data = ['duration' => $value];
|
||||
|
||||
$model = $this->createDefaultModel();
|
||||
$model = $this->createDefaultModel($expectedDuration, $break);
|
||||
|
||||
$form = $this->factory->create(QuickEntryTimesheetType::class, $model);
|
||||
|
||||
@@ -56,16 +61,19 @@ class QuickEntryTimesheetTypeTest extends TypeTestCase
|
||||
self::assertTrue($form->isSynchronized());
|
||||
self::assertEquals($expectedDuration, $model->getDuration());
|
||||
self::assertEquals($expectedDuration, $model->getDuration(true));
|
||||
self::assertEquals($break, $model->getBreak());
|
||||
}
|
||||
|
||||
private function createDefaultModel(): Timesheet
|
||||
private function createDefaultModel(int $duration = 0, int $break = 0): Timesheet
|
||||
{
|
||||
$begin = new \DateTime('2020-02-15 12:30:00');
|
||||
$end = new \DateTime('2020-02-15 14:00:00');
|
||||
|
||||
$model = new Timesheet();
|
||||
$model->setBegin($begin);
|
||||
//$model->setDuration($duration);
|
||||
$model->setEnd($end);
|
||||
$model->setBreak($break);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class MarkdownTest extends TestCase
|
||||
asdfasdfa</p>
|
||||
<pre><code>ssdfsdf</code></pre>
|
||||
<p><a href="http://example.com/foo-bar.html" target="_blank">http://example.com/foo-bar.html</a><br />
|
||||
<a href="file:///home/kimai/images/beautiful-flower.png" target="_blank">file:///home/kimai/images/beautiful-flower.png</a></p>
|
||||
file:///home/kimai/images/beautiful-flower.png</p>
|
||||
<p>sdfsdf <a href="#test-1">asdfasdf</a> asdfasdf</p>
|
||||
<p># test<br />
|
||||
aasdfasdf<br />
|
||||
|
||||
@@ -21,7 +21,7 @@ class ParsedownExtensionTest extends TestCase
|
||||
public function testTableContainsCssClasses(): void
|
||||
{
|
||||
$sut = new ParsedownExtension();
|
||||
$html = $sut->parse('
|
||||
$html = $sut->text('
|
||||
| Item | Price |
|
||||
|---|---|
|
||||
| Something | $ 472,78 |
|
||||
@@ -34,7 +34,7 @@ class ParsedownExtensionTest extends TestCase
|
||||
public function testHeaderIsNotConverted(): void
|
||||
{
|
||||
$sut = new ParsedownExtension();
|
||||
$html = $sut->parse('
|
||||
$html = $sut->text('
|
||||
# Foo
|
||||
');
|
||||
self::assertEquals('<p># Foo</p>', $html);
|
||||
|
||||
@@ -19,7 +19,7 @@ class ParsedownTest extends TestCase
|
||||
public function testTableContainsCssClasses(): void
|
||||
{
|
||||
$sut = new Parsedown();
|
||||
$html = $sut->parse('
|
||||
$html = $sut->text('
|
||||
| Item | Price |
|
||||
|---|---|
|
||||
| Something | $ 472,78 |
|
||||
@@ -32,7 +32,7 @@ class ParsedownTest extends TestCase
|
||||
public function testHeaderContainsId(): void
|
||||
{
|
||||
$sut = new Parsedown();
|
||||
$html = $sut->parse('
|
||||
$html = $sut->text('
|
||||
# Foo
|
||||
');
|
||||
self::assertEquals('<h1 id="foo">Foo</h1>', $html);
|
||||
@@ -41,7 +41,7 @@ class ParsedownTest extends TestCase
|
||||
public function testHeaderContainsIdDoesNotDuplicate(): void
|
||||
{
|
||||
$sut = new Parsedown();
|
||||
$html = $sut->parse('
|
||||
$html = $sut->text('
|
||||
# Foo
|
||||
# Foo
|
||||
# Foo
|
||||
|
||||
@@ -1346,26 +1346,11 @@ parameters:
|
||||
count: 1
|
||||
path: Form/Type/DurationTypeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Type\\\\QuickEntryTimesheetTypeTest\\:\\:getExtensions\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/Type/QuickEntryTimesheetTypeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Type\\\\QuickEntryTimesheetTypeTest\\:\\:getTestData\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/Type/QuickEntryTimesheetTypeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Type\\\\QuickEntryTimesheetTypeTest\\:\\:testSubmitValidData\\(\\) has parameter \\$expectedDuration with no type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/Type/QuickEntryTimesheetTypeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Form\\\\Type\\\\QuickEntryTimesheetTypeTest\\:\\:testSubmitValidData\\(\\) has parameter \\$value with no type specified\\.$#"
|
||||
count: 1
|
||||
path: Form/Type/QuickEntryTimesheetTypeTest.php
|
||||
|
||||
-
|
||||
message: "#^Method App\\\\Tests\\\\Invoice\\\\Calculator\\\\AbstractCalculatorTestCase\\:\\:assertDescription\\(\\) has parameter \\$addActivity with no type specified\\.$#"
|
||||
count: 1
|
||||
|
||||
Reference in New Issue
Block a user