added team permissions (#996)
This commit is contained in:
44
tests/Repository/Query/ActivityFormTypeQueryTest.php
Normal file
44
tests/Repository/Query/ActivityFormTypeQueryTest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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\Repository\Query;
|
||||
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Project;
|
||||
use App\Repository\Query\ActivityFormTypeQuery;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\ActivityFormTypeQuery
|
||||
*/
|
||||
class ActivityFormTypeQueryTest extends BaseQueryTest
|
||||
{
|
||||
public function testQuery()
|
||||
{
|
||||
$sut = new ActivityFormTypeQuery();
|
||||
|
||||
self::assertTrue($sut->isGlobalsOnly());
|
||||
|
||||
$project = new Project();
|
||||
self::assertNull($sut->getProject());
|
||||
self::assertInstanceOf(ActivityFormTypeQuery::class, $sut->setProject($project));
|
||||
self::assertSame($project, $sut->getProject());
|
||||
|
||||
$activity = new Activity();
|
||||
self::assertNull($sut->getActivity());
|
||||
self::assertInstanceOf(ActivityFormTypeQuery::class, $sut->setActivity($activity));
|
||||
self::assertSame($activity, $sut->getActivity());
|
||||
|
||||
self::assertFalse($sut->isGlobalsOnly());
|
||||
|
||||
$activity = new Activity();
|
||||
self::assertNull($sut->getActivityToIgnore());
|
||||
self::assertInstanceOf(ActivityFormTypeQuery::class, $sut->setActivityToIgnore($activity));
|
||||
self::assertSame($activity, $sut->getActivityToIgnore());
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Repository\Query\BaseQuery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -29,6 +30,7 @@ class BaseQueryTest extends TestCase
|
||||
$this->assertPageSize($sut);
|
||||
$this->assertOrderBy($sut, $orderBy);
|
||||
$this->assertOrder($sut);
|
||||
$this->assertTeams($sut);
|
||||
}
|
||||
|
||||
protected function assertResultType(BaseQuery $sut)
|
||||
@@ -49,6 +51,14 @@ class BaseQueryTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
protected function assertTeams(BaseQuery $sut)
|
||||
{
|
||||
self::assertEmpty($sut->getTeams());
|
||||
|
||||
self::assertInstanceOf(BaseQuery::class, $sut->addTeam(new Team()));
|
||||
self::assertEquals(1, count($sut->getTeams()));
|
||||
}
|
||||
|
||||
protected function assertPage(BaseQuery $sut)
|
||||
{
|
||||
$this->assertEquals(BaseQuery::DEFAULT_PAGE, $sut->getPage());
|
||||
|
||||
45
tests/Repository/Query/CustomerFormTypeQueryTest.php
Normal file
45
tests/Repository/Query/CustomerFormTypeQueryTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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\Repository\Query;
|
||||
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Repository\Query\CustomerFormTypeQuery;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\CustomerFormTypeQuery
|
||||
*/
|
||||
class CustomerFormTypeQueryTest extends BaseQueryTest
|
||||
{
|
||||
public function testQuery()
|
||||
{
|
||||
$sut = new CustomerFormTypeQuery();
|
||||
|
||||
self::assertEmpty($sut->getTeams());
|
||||
self::assertInstanceOf(CustomerFormTypeQuery::class, $sut->addTeam(new Team()));
|
||||
self::assertCount(1, $sut->getTeams());
|
||||
|
||||
$customer = new Customer();
|
||||
self::assertNull($sut->getCustomer());
|
||||
self::assertInstanceOf(CustomerFormTypeQuery::class, $sut->setCustomer($customer));
|
||||
self::assertSame($customer, $sut->getCustomer());
|
||||
|
||||
$customer = new Customer();
|
||||
self::assertNull($sut->getCustomerToIgnore());
|
||||
self::assertInstanceOf(CustomerFormTypeQuery::class, $sut->setCustomerToIgnore($customer));
|
||||
self::assertSame($customer, $sut->getCustomerToIgnore());
|
||||
|
||||
$user = new User();
|
||||
self::assertNull($sut->getUser());
|
||||
self::assertInstanceOf(CustomerFormTypeQuery::class, $sut->setUser($user));
|
||||
self::assertSame($user, $sut->getUser());
|
||||
}
|
||||
}
|
||||
51
tests/Repository/Query/ProjectFormTypeQueryTest.php
Normal file
51
tests/Repository/Query/ProjectFormTypeQueryTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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\Repository\Query;
|
||||
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Project;
|
||||
use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Repository\Query\ProjectFormTypeQuery;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\ProjectFormTypeQuery
|
||||
*/
|
||||
class ProjectFormTypeQueryTest extends BaseQueryTest
|
||||
{
|
||||
public function testQuery()
|
||||
{
|
||||
$sut = new ProjectFormTypeQuery();
|
||||
|
||||
self::assertEmpty($sut->getTeams());
|
||||
self::assertInstanceOf(ProjectFormTypeQuery::class, $sut->addTeam(new Team()));
|
||||
self::assertCount(1, $sut->getTeams());
|
||||
|
||||
$project = new Project();
|
||||
self::assertNull($sut->getProject());
|
||||
self::assertInstanceOf(ProjectFormTypeQuery::class, $sut->setProject($project));
|
||||
self::assertSame($project, $sut->getProject());
|
||||
|
||||
$project = new Project();
|
||||
self::assertNull($sut->getProjectToIgnore());
|
||||
self::assertInstanceOf(ProjectFormTypeQuery::class, $sut->setProjectToIgnore($project));
|
||||
self::assertSame($project, $sut->getProjectToIgnore());
|
||||
|
||||
$customer = new Customer();
|
||||
self::assertNull($sut->getCustomer());
|
||||
self::assertInstanceOf(ProjectFormTypeQuery::class, $sut->setCustomer($customer));
|
||||
self::assertSame($customer, $sut->getCustomer());
|
||||
|
||||
$user = new User();
|
||||
self::assertNull($sut->getUser());
|
||||
self::assertInstanceOf(ProjectFormTypeQuery::class, $sut->setUser($user));
|
||||
self::assertSame($user, $sut->getUser());
|
||||
}
|
||||
}
|
||||
34
tests/Repository/Query/UserFormTypeQueryTest.php
Normal file
34
tests/Repository/Query/UserFormTypeQueryTest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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\Repository\Query;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Repository\Query\UserFormTypeQuery;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\UserFormTypeQuery
|
||||
*/
|
||||
class UserFormTypeQueryTest extends BaseQueryTest
|
||||
{
|
||||
public function testQuery()
|
||||
{
|
||||
$sut = new UserFormTypeQuery();
|
||||
|
||||
self::assertEmpty($sut->getTeams());
|
||||
self::assertInstanceOf(UserFormTypeQuery::class, $sut->addTeam(new Team()));
|
||||
self::assertCount(1, $sut->getTeams());
|
||||
|
||||
$user = new User();
|
||||
self::assertNull($sut->getUser());
|
||||
self::assertInstanceOf(UserFormTypeQuery::class, $sut->setUser($user));
|
||||
self::assertSame($user, $sut->getUser());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user