Files
kimai2/tests/API/Model/TimesheetConfigTest.php
Kevin Papst 19e4ebf88c several enhancements (#1808)
* show all fields in timesheet api docs
* fix action dropdown links #1806
* apply same validation rules for passwords and for api-tokens #1753
* added "duplicate team" action #1136
2020-07-10 03:57:15 +02:00

50 lines
1.8 KiB
PHP

<?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\TimesheetConfig;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\API\Model\TimesheetConfig
*/
class TimesheetConfigTest extends TestCase
{
public function testDefaultValues()
{
$sut = new TimesheetConfig();
$this->assertTrue($sut->isAllowFutureTimes());
$this->assertTrue($sut->isAllowOverlapping());
$this->assertEquals('now', $sut->getDefaultBeginTime());
$this->assertEquals('default', $sut->getTrackingMode());
$this->assertEquals(1, $sut->getActiveEntriesSoftLimit());
$this->assertEquals(1, $sut->getActiveEntriesHardLimit());
}
public function testSetter()
{
$sut = new TimesheetConfig();
$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));
$this->assertFalse($sut->isAllowFutureTimes());
$this->assertFalse($sut->isAllowOverlapping());
$this->assertEquals('08:00', $sut->getDefaultBeginTime());
$this->assertEquals('punch', $sut->getTrackingMode());
$this->assertEquals(2, $sut->getActiveEntriesSoftLimit());
$this->assertEquals(3, $sut->getActiveEntriesHardLimit());
}
}