added avatars, show user teams in list, new team dashboard widgets (#1150)
This commit is contained in:
@@ -30,6 +30,16 @@ class BaseQueryTest extends TestCase
|
||||
$this->assertResetByFormError(new BaseQuery());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedDeprecation BaseQuery::getResultType() is deprecated and will be removed with 1.6
|
||||
* @group legacy
|
||||
*/
|
||||
public function testDeprecations()
|
||||
{
|
||||
$sut = new BaseQuery();
|
||||
$sut->getResultType();
|
||||
}
|
||||
|
||||
protected function assertResetByFormError(BaseQuery $sut, $orderBy = 'id', $order = 'ASC')
|
||||
{
|
||||
$sut->setOrder('ASK');
|
||||
@@ -49,7 +59,6 @@ class BaseQueryTest extends TestCase
|
||||
|
||||
protected function assertBaseQuery(BaseQuery $sut, $orderBy = 'id')
|
||||
{
|
||||
$this->assertResultType($sut);
|
||||
$this->assertPage($sut);
|
||||
$this->assertPageSize($sut);
|
||||
$this->assertOrderBy($sut, $orderBy);
|
||||
@@ -85,24 +94,6 @@ class BaseQueryTest extends TestCase
|
||||
$sut->resetByFormError($formErrors);
|
||||
}
|
||||
|
||||
protected function assertResultType(BaseQuery $sut)
|
||||
{
|
||||
self::assertEquals(BaseQuery::RESULT_TYPE_PAGER, $sut->getResultType());
|
||||
|
||||
$sut->setResultType(BaseQuery::RESULT_TYPE_QUERYBUILDER);
|
||||
self::assertEquals(BaseQuery::RESULT_TYPE_QUERYBUILDER, $sut->getResultType());
|
||||
|
||||
$sut->setResultType(BaseQuery::RESULT_TYPE_OBJECTS);
|
||||
self::assertEquals(BaseQuery::RESULT_TYPE_OBJECTS, $sut->getResultType());
|
||||
|
||||
try {
|
||||
$sut->setResultType('foo-bar');
|
||||
} catch (\Exception $exception) {
|
||||
$this->assertInstanceOf(\InvalidArgumentException::class, $exception);
|
||||
self::assertEquals('Unsupported query result type', $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected function assertTeams(BaseQuery $sut)
|
||||
{
|
||||
self::assertEmpty($sut->getTeams());
|
||||
|
||||
@@ -24,7 +24,6 @@ class ExportQueryTest extends BaseQueryTest
|
||||
{
|
||||
$sut = new ExportQuery();
|
||||
|
||||
$this->assertResultType($sut);
|
||||
$this->assertPage($sut);
|
||||
$this->assertPageSize($sut);
|
||||
$this->assertOrderBy($sut, 'begin');
|
||||
|
||||
@@ -24,7 +24,6 @@ class InvoiceQueryTest extends BaseQueryTest
|
||||
{
|
||||
$sut = new InvoiceQuery();
|
||||
|
||||
$this->assertResultType($sut);
|
||||
$this->assertPage($sut);
|
||||
$this->assertPageSize($sut);
|
||||
$this->assertOrderBy($sut, 'begin');
|
||||
|
||||
@@ -25,7 +25,6 @@ class TimesheetQueryTest extends BaseQueryTest
|
||||
{
|
||||
$sut = new TimesheetQuery();
|
||||
|
||||
$this->assertResultType($sut);
|
||||
$this->assertPage($sut);
|
||||
$this->assertPageSize($sut);
|
||||
$this->assertOrderBy($sut, 'begin');
|
||||
|
||||
@@ -16,7 +16,6 @@ use App\Entity\Timesheet;
|
||||
use App\Entity\User;
|
||||
use App\Repository\ActivityRepository;
|
||||
use App\Repository\ProjectRepository;
|
||||
use App\Repository\Query\BaseQuery;
|
||||
use App\Repository\Query\TimesheetQuery;
|
||||
use App\Repository\RepositoryException;
|
||||
use App\Repository\TimesheetRepository;
|
||||
@@ -58,7 +57,6 @@ class TimesheetRepositoryTest extends AbstractRepositoryTest
|
||||
$this->importFixture($em, $fixtures);
|
||||
|
||||
$query = new TimesheetQuery();
|
||||
$query->setResultType(BaseQuery::RESULT_TYPE_OBJECTS);
|
||||
$query->setUser($user);
|
||||
$query->setState(TimesheetQuery::STATE_STOPPED);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Entity\User;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Repository\WidgetRepository;
|
||||
use App\Tests\Mocks\Security\CurrentUserFactory;
|
||||
use App\Widget\Type\CompoundChart;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
@@ -46,7 +47,7 @@ class WidgetRepositoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* @expectedException \App\Widget\WidgetException
|
||||
* @expectedExceptionMessage Unknown widget type "\App\Widget\Type\FooBar"
|
||||
* @expectedExceptionMessage Unknown widget type "FooBar"
|
||||
*/
|
||||
public function testGetWidgetThrowsExceptionOnInvalidType()
|
||||
{
|
||||
@@ -59,14 +60,14 @@ class WidgetRepositoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* @expectedException \App\Widget\WidgetException
|
||||
* @expectedExceptionMessage Invalid widget type "\App\Widget\Type\CompoundChart" does not extend AbstractWidgetType
|
||||
* @expectedExceptionMessage Widget type "App\Widget\Type\CompoundChart" is not an instance of "App\Widget\Type\AbstractWidgetType"
|
||||
*/
|
||||
public function testGetWidgetTriggersExceptionOnWrongClass()
|
||||
{
|
||||
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = (new CurrentUserFactory($this))->create(new User());
|
||||
|
||||
$sut = new WidgetRepository($repoMock, $userMock, ['test' => ['type' => 'CompoundChart', 'user' => false]]);
|
||||
$sut = new WidgetRepository($repoMock, $userMock, ['test' => ['type' => CompoundChart::class, 'user' => false]]);
|
||||
$sut->get('test');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user