added team permissions (#996)
This commit is contained in:
@@ -9,9 +9,10 @@
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Entity\User;
|
||||
use App\Repository\TimesheetRepository;
|
||||
use App\Repository\WidgetRepository;
|
||||
use App\Security\CurrentUser;
|
||||
use App\Tests\Mocks\Security\CurrentUserFactory;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,7 @@ class WidgetRepositoryTest extends TestCase
|
||||
public function testHasWidget()
|
||||
{
|
||||
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = $this->getMockBuilder(CurrentUser::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = (new CurrentUserFactory($this))->create(new User());
|
||||
|
||||
$sut = new WidgetRepository($repoMock, $userMock, ['test' => []]);
|
||||
|
||||
@@ -37,7 +38,7 @@ class WidgetRepositoryTest extends TestCase
|
||||
public function testGetWidgetThrowsExceptionOnNonExistingWidget()
|
||||
{
|
||||
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = $this->getMockBuilder(CurrentUser::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = (new CurrentUserFactory($this))->create(new User());
|
||||
|
||||
$sut = new WidgetRepository($repoMock, $userMock, ['test' => []]);
|
||||
$sut->get('foo');
|
||||
@@ -50,7 +51,7 @@ class WidgetRepositoryTest extends TestCase
|
||||
public function testGetWidgetThrowsExceptionOnInvalidType()
|
||||
{
|
||||
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = $this->getMockBuilder(CurrentUser::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = (new CurrentUserFactory($this))->create(new User());
|
||||
|
||||
$sut = new WidgetRepository($repoMock, $userMock, ['test' => ['type' => 'FooBar', 'user' => false]]);
|
||||
$sut->get('test');
|
||||
@@ -63,7 +64,7 @@ class WidgetRepositoryTest extends TestCase
|
||||
public function testGetWidgetTriggersExceptionOnWrongClass()
|
||||
{
|
||||
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = $this->getMockBuilder(CurrentUser::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = (new CurrentUserFactory($this))->create(new User());
|
||||
|
||||
$sut = new WidgetRepository($repoMock, $userMock, ['test' => ['type' => 'CompoundChart', 'user' => false]]);
|
||||
$sut->get('test');
|
||||
@@ -77,7 +78,7 @@ class WidgetRepositoryTest extends TestCase
|
||||
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
|
||||
$repoMock->method('getStatistic')->willReturn($data);
|
||||
|
||||
$userMock = $this->getMockBuilder(CurrentUser::class)->disableOriginalConstructor()->getMock();
|
||||
$userMock = (new CurrentUserFactory($this))->create(new User());
|
||||
|
||||
$widget = [
|
||||
'color' => 'sunny',
|
||||
|
||||
Reference in New Issue
Block a user