added fixed-rate and hourly-rate for customer, project and activity (#304)
This commit is contained in:
68
tests/Entity/ProjectTest.php
Normal file
68
tests/Entity/ProjectTest.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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\Activity;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Project;
|
||||
|
||||
/**
|
||||
* @covers \App\Entity\Project
|
||||
*/
|
||||
class ProjectTest extends AbstractEntityTest
|
||||
{
|
||||
public function testDefaultValues()
|
||||
{
|
||||
$sut = new Project();
|
||||
$this->assertNull($sut->getId());
|
||||
$this->assertNull($sut->getCustomer());
|
||||
$this->assertNull($sut->getName());
|
||||
$this->assertNull($sut->getOrderNumber());
|
||||
$this->assertNull($sut->getComment());
|
||||
$this->assertTrue($sut->getVisible());
|
||||
$this->assertEquals(0.0, $sut->getBudget());
|
||||
// activities
|
||||
$this->assertNull($sut->getFixedRate());
|
||||
$this->assertNull($sut->getHourlyRate());
|
||||
}
|
||||
|
||||
public function testSetterAndGetter()
|
||||
{
|
||||
$sut = new Project();
|
||||
|
||||
$customer = (new Customer())->setName('customer');
|
||||
$this->assertInstanceOf(Project::class, $sut->setCustomer($customer));
|
||||
$this->assertSame($customer, $sut->getCustomer());
|
||||
|
||||
$this->assertInstanceOf(Project::class, $sut->setName('123456789'));
|
||||
$this->assertEquals('123456789', (string) $sut);
|
||||
|
||||
$this->assertInstanceOf(Project::class, $sut->setOrderNumber('123456789'));
|
||||
$this->assertEquals('123456789', $sut->getOrderNumber());
|
||||
|
||||
$this->assertInstanceOf(Project::class, $sut->setComment('a comment'));
|
||||
$this->assertEquals('a comment', $sut->getComment());
|
||||
|
||||
$this->assertInstanceOf(Project::class, $sut->setVisible(false));
|
||||
$this->assertFalse($sut->getVisible());
|
||||
|
||||
$this->assertInstanceOf(Project::class, $sut->setBudget(12345.67));
|
||||
$this->assertEquals(12345.67, $sut->getBudget());
|
||||
|
||||
$activities = [(new Activity())->setName('foo')];
|
||||
$this->assertInstanceOf(Project::class, $sut->setActivities($activities));
|
||||
$this->assertSame($activities, $sut->getActivities());
|
||||
|
||||
$this->assertInstanceOf(Project::class, $sut->setFixedRate(13.47));
|
||||
$this->assertEquals(13.47, $sut->getFixedRate());
|
||||
$this->assertInstanceOf(Project::class, $sut->setHourlyRate(99));
|
||||
$this->assertEquals(99, $sut->getHourlyRate());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user