* make voters a final class * upgrade dependencies * sort project alphabetically in dashboard widget * open detail page on row click * do not break on null tag name * added max height to scrollable widgets on dashboard * added timesheet duplicate event * allow to deactivate browser title update * improve comment box * moved role permissions to own menu * removed tabs in user screen * fix user can remove super-admin from own account
60 lines
1.4 KiB
PHP
60 lines
1.4 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\Entity;
|
|
|
|
use App\Entity\Tag;
|
|
use App\Entity\Timesheet;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* @covers \App\Entity\Tag
|
|
*/
|
|
class TagTest extends TestCase
|
|
{
|
|
public function testDefaultValues()
|
|
{
|
|
$sut = new Tag();
|
|
$this->assertNull($sut->getId());
|
|
$this->assertNull($sut->getName());
|
|
$this->assertNull($sut->getColor());
|
|
}
|
|
|
|
public function testSetterAndGetter()
|
|
{
|
|
$sut = new Tag();
|
|
|
|
$this->assertInstanceOf(Tag::class, $sut->setName('foo'));
|
|
$this->assertEquals('foo', $sut->getName());
|
|
$this->assertEquals('foo', (string) $sut);
|
|
|
|
$sut->setName(null);
|
|
$this->assertNull($sut->getName());
|
|
|
|
$this->assertInstanceOf(Tag::class, $sut->setColor('#fffccc'));
|
|
$this->assertEquals('#fffccc', $sut->getColor());
|
|
}
|
|
|
|
public function testWithTimesheet()
|
|
{
|
|
$sut = new Tag();
|
|
$timesheet = new Timesheet();
|
|
|
|
$this->assertEmpty($timesheet->getTags());
|
|
|
|
$sut->setName('bar');
|
|
$sut->addTimesheet($timesheet);
|
|
|
|
$this->assertSame($sut, $timesheet->getTags()[0]);
|
|
|
|
$sut->removeTimesheet($timesheet);
|
|
$this->assertEmpty($timesheet->getTags());
|
|
}
|
|
}
|