@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai package.
|
||||
*
|
||||
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\AppBundle\Repository\Query;
|
||||
|
||||
use AppBundle\Repository\Query\VisibilityInterface;
|
||||
use AppBundle\Repository\Query\VisibilityTrait;
|
||||
|
||||
/**
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class VisibilityTraitImplementation implements VisibilityInterface
|
||||
{
|
||||
use VisibilityTrait;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai package.
|
||||
*
|
||||
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\AppBundle\Repository\Query;
|
||||
|
||||
use AppBundle\Repository\Query\VisibilityInterface;
|
||||
use AppBundle\Repository\Query\VisibilityTrait;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \AppBundle\Repository\Query\VisibilityTrait
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class VisibilityTraitTest extends TestCase
|
||||
{
|
||||
public function testVisibilityTrait()
|
||||
{
|
||||
$sut = new VisibilityTraitImplementation();
|
||||
|
||||
$this->assertFalse($sut->isExclusiveVisibility());
|
||||
$this->assertEquals(VisibilityTraitImplementation::SHOW_VISIBLE, $sut->getVisibility());
|
||||
|
||||
$sut->setExclusiveVisibility(true);
|
||||
$this->assertTrue($sut->isExclusiveVisibility());
|
||||
|
||||
$sut->setVisibility('foo-bar');
|
||||
$this->assertEquals(VisibilityTraitImplementation::SHOW_VISIBLE, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility(VisibilityTraitImplementation::SHOW_BOTH);
|
||||
$this->assertEquals(VisibilityTraitImplementation::SHOW_BOTH, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility(VisibilityTraitImplementation::SHOW_HIDDEN);
|
||||
$this->assertEquals(VisibilityTraitImplementation::SHOW_HIDDEN, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility(VisibilityTraitImplementation::SHOW_VISIBLE);
|
||||
$this->assertEquals(VisibilityTraitImplementation::SHOW_VISIBLE, $sut->getVisibility());
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\AppBundle\Controller;
|
||||
namespace App\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
@@ -9,17 +9,15 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\TimesheetBundle\Repository\Query;
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use AppBundle\Repository\Query\VisibilityInterface;
|
||||
use AppBundle\Repository\Query\VisibilityTrait;
|
||||
use KimaiTest\AppBundle\Repository\Query\BaseQueryTest;
|
||||
use TimesheetBundle\Entity\Customer;
|
||||
use TimesheetBundle\Entity\Project;
|
||||
use TimesheetBundle\Repository\Query\ActivityQuery;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Project;
|
||||
use App\Repository\Query\ActivityQuery;
|
||||
use App\Repository\Query\VisibilityQuery;
|
||||
|
||||
/**
|
||||
* @covers \TimesheetBundle\Repository\Query\ActivityQuery
|
||||
* @covers \App\Repository\Query\ActivityQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class ActivityQueryTest extends BaseQueryTest
|
||||
@@ -29,8 +27,7 @@ class ActivityQueryTest extends BaseQueryTest
|
||||
$sut = new ActivityQuery();
|
||||
|
||||
$this->assertBaseQuery($sut);
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
$this->assertArrayHasKey(VisibilityTrait::class, class_uses($sut));
|
||||
$this->assertInstanceOf(VisibilityQuery::class, $sut);
|
||||
|
||||
$this->assertNull($sut->getCustomer());
|
||||
$this->assertNull($sut->getProject());
|
||||
@@ -9,14 +9,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\AppBundle\Repository\Query;
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use AppBundle\Entity\User;
|
||||
use AppBundle\Repository\Query\BaseQuery;
|
||||
use App\Entity\User;
|
||||
use App\Repository\Query\BaseQuery;
|
||||
use \PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \AppBundle\Repository\Query\BaseQuery
|
||||
* @covers \App\Repository\Query\BaseQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class BaseQueryTest extends TestCase
|
||||
30
tests/Repository/Query/CustomerQueryTest.php
Normal file
30
tests/Repository/Query/CustomerQueryTest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai package.
|
||||
*
|
||||
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||
*
|
||||
* 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\Repository\Query\VisibilityQuery;
|
||||
use App\Repository\Query\CustomerQuery;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\CustomerQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class CustomerQueryTest extends BaseQueryTest
|
||||
{
|
||||
public function testQuery()
|
||||
{
|
||||
$sut = new CustomerQuery();
|
||||
|
||||
$this->assertBaseQuery($sut);
|
||||
$this->assertInstanceOf(VisibilityQuery::class, $sut);
|
||||
}
|
||||
}
|
||||
@@ -9,16 +9,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\TimesheetBundle\Repository\Query;
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use AppBundle\Repository\Query\VisibilityInterface;
|
||||
use AppBundle\Repository\Query\VisibilityTrait;
|
||||
use KimaiTest\AppBundle\Repository\Query\BaseQueryTest;
|
||||
use TimesheetBundle\Entity\Customer;
|
||||
use TimesheetBundle\Repository\Query\ProjectQuery;
|
||||
use App\Entity\Customer;
|
||||
use App\Repository\Query\ProjectQuery;
|
||||
use App\Repository\Query\VisibilityQuery;
|
||||
|
||||
/**
|
||||
* @covers \TimesheetBundle\Repository\Query\ProjectQuery
|
||||
* @covers \App\Repository\Query\ProjectQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class ProjectQueryTest extends BaseQueryTest
|
||||
@@ -28,8 +26,7 @@ class ProjectQueryTest extends BaseQueryTest
|
||||
$sut = new ProjectQuery();
|
||||
|
||||
$this->assertBaseQuery($sut);
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
$this->assertArrayHasKey(VisibilityTrait::class, class_uses($sut));
|
||||
$this->assertInstanceOf(VisibilityQuery::class, $sut);
|
||||
|
||||
$this->assertNull($sut->getCustomer());
|
||||
|
||||
@@ -9,17 +9,17 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\TimesheetBundle\Repository\Query;
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use AppBundle\Entity\User;
|
||||
use KimaiTest\AppBundle\Repository\Query\BaseQueryTest;
|
||||
use TimesheetBundle\Entity\Activity;
|
||||
use TimesheetBundle\Entity\Customer;
|
||||
use TimesheetBundle\Entity\Project;
|
||||
use TimesheetBundle\Repository\Query\TimesheetQuery;
|
||||
use App\Entity\User;
|
||||
use App\Tests\Repository\Query\BaseQueryTest;
|
||||
use App\Entity\Activity;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Project;
|
||||
use App\Repository\Query\TimesheetQuery;
|
||||
|
||||
/**
|
||||
* @covers \TimesheetBundle\Repository\Query\TimesheetQuery
|
||||
* @covers \App\Repository\Query\TimesheetQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class TimesheetQueryTest extends BaseQueryTest
|
||||
@@ -9,14 +9,13 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\AppBundle\Repository\Query;
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use AppBundle\Repository\Query\UserQuery;
|
||||
use AppBundle\Repository\Query\VisibilityInterface;
|
||||
use AppBundle\Repository\Query\VisibilityTrait;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\Query\VisibilityQuery;
|
||||
|
||||
/**
|
||||
* @covers \AppBundle\Repository\Query\UserQuery
|
||||
* @covers \App\Repository\Query\UserQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class UserQueryTest extends BaseQueryTest
|
||||
@@ -25,8 +24,7 @@ class UserQueryTest extends BaseQueryTest
|
||||
{
|
||||
$sut = new UserQuery();
|
||||
$this->assertBaseQuery($sut);
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
$this->assertArrayHasKey(VisibilityTrait::class, class_uses($sut));
|
||||
$this->assertInstanceOf(VisibilityQuery::class, $sut);
|
||||
$this->assertRole($sut);
|
||||
}
|
||||
|
||||
51
tests/Repository/Query/VisibilityQueryTest.php
Normal file
51
tests/Repository/Query/VisibilityQueryTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai package.
|
||||
*
|
||||
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||
*
|
||||
* 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\Repository\Query\VisibilityQuery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\VisibilityQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class VisibilityQueryTest extends TestCase
|
||||
{
|
||||
public function testVisibilityQuery()
|
||||
{
|
||||
$sut = new VisibilityQuery();
|
||||
|
||||
$this->assertFalse($sut->isExclusiveVisibility());
|
||||
$this->assertEquals(VisibilityQuery::SHOW_VISIBLE, $sut->getVisibility());
|
||||
|
||||
$sut->setExclusiveVisibility(true);
|
||||
$this->assertTrue($sut->isExclusiveVisibility());
|
||||
|
||||
$sut->setVisibility('foo-bar');
|
||||
$this->assertEquals(VisibilityQuery::SHOW_VISIBLE, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility('2');
|
||||
$this->assertEquals(VisibilityQuery::SHOW_HIDDEN, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility('0'); // keep the value that was previously set
|
||||
$this->assertEquals(VisibilityQuery::SHOW_HIDDEN, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility(VisibilityQuery::SHOW_BOTH);
|
||||
$this->assertEquals(VisibilityQuery::SHOW_BOTH, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility(VisibilityQuery::SHOW_HIDDEN);
|
||||
$this->assertEquals(VisibilityQuery::SHOW_HIDDEN, $sut->getVisibility());
|
||||
|
||||
$sut->setVisibility(VisibilityQuery::SHOW_VISIBLE);
|
||||
$this->assertEquals(VisibilityQuery::SHOW_VISIBLE, $sut->getVisibility());
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai package.
|
||||
*
|
||||
* (c) Kevin Papst <kevin@kevinpapst.de>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\TimesheetBundle\Repository\Query;
|
||||
|
||||
use AppBundle\Repository\Query\VisibilityInterface;
|
||||
use AppBundle\Repository\Query\VisibilityTrait;
|
||||
use KimaiTest\AppBundle\Repository\Query\BaseQueryTest;
|
||||
use TimesheetBundle\Repository\Query\CustomerQuery;
|
||||
|
||||
/**
|
||||
* @covers \TimesheetBundle\Repository\Query\CustomerQuery
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class CustomerQueryTest extends BaseQueryTest
|
||||
{
|
||||
public function testQuery()
|
||||
{
|
||||
$sut = new CustomerQuery();
|
||||
|
||||
$this->assertBaseQuery($sut);
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
$this->assertArrayHasKey(VisibilityTrait::class, class_uses($sut));
|
||||
}
|
||||
}
|
||||
@@ -9,19 +9,19 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace KimaiTest\TimesheetBundle\Voter;
|
||||
namespace App\Tests\Voter;
|
||||
|
||||
use AppBundle\Entity\User;
|
||||
use App\Entity\User;
|
||||
use \PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
|
||||
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
||||
use TimesheetBundle\Entity\Customer;
|
||||
use TimesheetBundle\Entity\Timesheet;
|
||||
use TimesheetBundle\Voter\TimesheetVoter;
|
||||
use App\Entity\Customer;
|
||||
use App\Entity\Timesheet;
|
||||
use App\Voter\TimesheetVoter;
|
||||
|
||||
/**
|
||||
* @covers \TimesheetBundle\Voter\TimesheetVoter
|
||||
* @covers \App\Voter\TimesheetVoter
|
||||
* @author Kevin Papst <kevin@kevinpapst.de>
|
||||
*/
|
||||
class TimesheetVoterTest extends TestCase
|
||||
Reference in New Issue
Block a user