Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
<?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\API\Model;
|
||||
|
||||
use App\API\Model\I18nConfig;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Model\I18nConfig
|
||||
*/
|
||||
class I18nConfigTest extends TestCase
|
||||
{
|
||||
public function testSetter()
|
||||
{
|
||||
$sut = new I18nConfig();
|
||||
|
||||
$this->assertInstanceOf(I18nConfig::class, $sut->setIs24hours(false));
|
||||
$this->assertInstanceOf(I18nConfig::class, $sut->setDuration('foo'));
|
||||
$this->assertInstanceOf(I18nConfig::class, $sut->setDate('bar'));
|
||||
$this->assertInstanceOf(I18nConfig::class, $sut->setDateTime('hello'));
|
||||
$this->assertInstanceOf(I18nConfig::class, $sut->setFormDate('world'));
|
||||
$this->assertInstanceOf(I18nConfig::class, $sut->setTime('fun'));
|
||||
}
|
||||
}
|
||||
75
tests/API/Model/PageActionTest.php
Normal file
75
tests/API/Model/PageActionTest.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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\API\Model;
|
||||
|
||||
use App\API\Model\PageAction;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Model\PageAction
|
||||
*/
|
||||
class PageActionTest extends TestCase
|
||||
{
|
||||
public function testEmptySettings(): void
|
||||
{
|
||||
$options = [];
|
||||
|
||||
$sut = new PageAction('foo', $options);
|
||||
|
||||
$obj = new \ReflectionClass($sut);
|
||||
|
||||
self::assertEquals('foo', $obj->getProperty('id')->getValue($sut));
|
||||
self::assertEquals('foo', $obj->getProperty('title')->getValue($sut));
|
||||
self::assertEquals('', $obj->getProperty('url')->getValue($sut));
|
||||
self::assertEquals('', $obj->getProperty('class')->getValue($sut));
|
||||
self::assertFalse($obj->getProperty('divider')->getValue($sut));
|
||||
self::assertIsArray($obj->getProperty('attr')->getValue($sut));
|
||||
}
|
||||
|
||||
public function testWithSettings(): void
|
||||
{
|
||||
$options = [
|
||||
'title' => 'bar',
|
||||
'url' => 'http://sdkfjhaslkdjfhaskljh',
|
||||
'class' => 'btn-primary',
|
||||
];
|
||||
|
||||
$sut = new PageAction('trash', $options);
|
||||
|
||||
$obj = new \ReflectionClass($sut);
|
||||
|
||||
self::assertEquals('trash', $obj->getProperty('id')->getValue($sut));
|
||||
self::assertEquals('bar', $obj->getProperty('title')->getValue($sut));
|
||||
self::assertEquals('http://sdkfjhaslkdjfhaskljh', $obj->getProperty('url')->getValue($sut));
|
||||
self::assertEquals('btn-primary', $obj->getProperty('class')->getValue($sut));
|
||||
self::assertTrue($obj->getProperty('divider')->getValue($sut));
|
||||
self::assertIsArray($obj->getProperty('attr')->getValue($sut));
|
||||
}
|
||||
|
||||
public function testDivider(): void
|
||||
{
|
||||
$options = [
|
||||
'title' => 'bar',
|
||||
'url' => null,
|
||||
'class' => 'btn-primary',
|
||||
];
|
||||
|
||||
$sut = new PageAction('divider0', $options);
|
||||
|
||||
$obj = new \ReflectionClass($sut);
|
||||
|
||||
self::assertEquals('divider0', $obj->getProperty('id')->getValue($sut));
|
||||
self::assertEquals('bar', $obj->getProperty('title')->getValue($sut));
|
||||
self::assertNull($obj->getProperty('url')->getValue($sut));
|
||||
self::assertEquals('btn-primary', $obj->getProperty('class')->getValue($sut));
|
||||
self::assertTrue($obj->getProperty('divider')->getValue($sut));
|
||||
self::assertIsArray($obj->getProperty('attr')->getValue($sut));
|
||||
}
|
||||
}
|
||||
@@ -20,12 +20,18 @@ class TimesheetConfigTest extends TestCase
|
||||
public function testSetter()
|
||||
{
|
||||
$sut = new TimesheetConfig();
|
||||
$sut->setIsAllowFutureTimes(false);
|
||||
$sut->setIsAllowOverlapping(false);
|
||||
$sut->setDefaultBeginTime('08:00');
|
||||
$sut->setTrackingMode('punch');
|
||||
$sut->setActiveEntriesHardLimit(3);
|
||||
|
||||
$this->assertInstanceOf(TimesheetConfig::class, $sut->setIsAllowFutureTimes(false));
|
||||
$this->assertInstanceOf(TimesheetConfig::class, $sut->setIsAllowOverlapping(false));
|
||||
$this->assertInstanceOf(TimesheetConfig::class, $sut->setDefaultBeginTime('08:00'));
|
||||
$this->assertInstanceOf(TimesheetConfig::class, $sut->setTrackingMode('punch'));
|
||||
$this->assertInstanceOf(TimesheetConfig::class, $sut->setActiveEntriesSoftLimit(2));
|
||||
$this->assertInstanceOf(TimesheetConfig::class, $sut->setActiveEntriesHardLimit(3));
|
||||
$obj = new \ReflectionClass($sut);
|
||||
|
||||
self::assertFalse($obj->getProperty('isAllowFutureTimes')->getValue($sut));
|
||||
self::assertFalse($obj->getProperty('isAllowOverlapping')->getValue($sut));
|
||||
self::assertEquals('08:00', $obj->getProperty('defaultBeginTime')->getValue($sut));
|
||||
self::assertEquals('punch', $obj->getProperty('trackingMode')->getValue($sut));
|
||||
self::assertEquals(3, $obj->getProperty('activeEntriesHardLimit')->getValue($sut));
|
||||
}
|
||||
}
|
||||
|
||||
29
tests/API/Model/VersionTest.php
Normal file
29
tests/API/Model/VersionTest.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\API\Model;
|
||||
|
||||
use App\API\Model\Version;
|
||||
use App\Constants;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\API\Model\Version
|
||||
*/
|
||||
class VersionTest extends TestCase
|
||||
{
|
||||
public function testValues(): void
|
||||
{
|
||||
$sut = new Version();
|
||||
|
||||
self::assertEquals(Constants::VERSION, $sut->version);
|
||||
self::assertEquals(Constants::VERSION_ID, $sut->versionId);
|
||||
self::assertEquals(Constants::SOFTWARE . ' ' . Constants::VERSION . ' by Kevin Papst.', $sut->copyright);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user