Release 2.0.32 (#4256)

This commit is contained in:
Kevin Papst
2023-08-31 15:33:53 +02:00
committed by GitHub
parent 452de88e18
commit 31348da4c0
42 changed files with 412 additions and 130 deletions

View File

@@ -0,0 +1,41 @@
<?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\Calendar;
use App\Calendar\CalendarSource;
use App\Calendar\CalendarSourceType;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Calendar\CalendarSource
*/
class CalendarSourceTest extends TestCase
{
public function testSource(): void
{
$sut = new CalendarSource(CalendarSourceType::JSON, '0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', '#fffccc');
$sut->addOption('foo', 'bar');
$sut->addOption('hello', false);
$sut->addOption('world', 123);
$this->assertEquals(CalendarSourceType::JSON, $sut->getType());
$this->assertEquals('json', $sut->getTypeName());
$this->assertEquals('0815', $sut->getId());
$this->assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri());
$this->assertEquals('#fffccc', $sut->getColor());
$this->assertEquals(['foo' => 'bar', 'hello' => false, 'world' => 123], $sut->getOptions());
$sut = new CalendarSource(CalendarSourceType::TIMESHEET, '0815', 'askdjfhlaksjdhflaksjhdflkjasdlkfjh', null);
$this->assertEquals('0815', $sut->getId());
$this->assertEquals('askdjfhlaksjdhflaksjhdflkjasdlkfjh', $sut->getUri());
$this->assertNull($sut->getColor());
}
}

View File

@@ -0,0 +1,38 @@
<?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\Calendar\CalendarSource;
use App\Calendar\CalendarSourceType;
use App\Entity\User;
use App\Event\CalendarSourceEvent;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Event\CalendarSourceEvent
*/
class CalendarSourceEventTest extends TestCase
{
public function testEvent(): void
{
$user = new User();
$user->setAlias('foo');
$sut = new CalendarSourceEvent($user);
self::assertSame($user, $sut->getUser());
self::assertIsArray($sut->getSources());
self::assertEmpty($sut->getSources());
$sut->addSource(new CalendarSource(CalendarSourceType::TIMESHEET, '', ''));
self::assertCount(1, $sut->getSources());
}
}