support different formats in user timesheet exports (#1222)

This commit is contained in:
Kevin Papst
2019-11-08 16:10:38 +01:00
committed by GitHub
parent 0705c26513
commit fa1c79e15c
75 changed files with 1872 additions and 951 deletions

View File

@@ -21,7 +21,7 @@ class QueryBuilderPaginatorTest extends TestCase
{
public function testPaginator()
{
$em = $this->getMockBuilder(EntityManager::class)->disableOriginalConstructor()->getMock();
$em = $this->createMock(EntityManager::class);
$qb = new QueryBuilder($em);
$sut = new QueryBuilderPaginator($qb, 10);

View File

@@ -68,14 +68,14 @@ class BaseQueryTest extends TestCase
private function getFormBuilder(string $name)
{
return new FormBuilder($name, null, new EventDispatcher(), $this->getMockBuilder(FormFactoryInterface::class)->getMock(), []);
return new FormBuilder($name, null, new EventDispatcher(), $this->createMock(FormFactoryInterface::class), []);
}
protected function resetByFormError(BaseQuery $sut, array $invalidFields)
{
$formBuilder = $this->getFormBuilder('form');
$formBuilder->setCompound(true);
$formBuilder->setDataMapper($this->getMockBuilder(DataMapperInterface::class)->getMock());
$formBuilder->setDataMapper($this->createMock(DataMapperInterface::class));
$form = $formBuilder->getForm();

View File

@@ -24,7 +24,7 @@ class WidgetRepositoryTest extends TestCase
{
public function testHasWidget()
{
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
$repoMock = $this->createMock(TimesheetRepository::class);
$userMock = (new CurrentUserFactory($this))->create(new User());
$sut = new WidgetRepository($repoMock, $userMock, ['test' => []]);
@@ -38,7 +38,7 @@ class WidgetRepositoryTest extends TestCase
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot find widget "foo".');
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
$repoMock = $this->createMock(TimesheetRepository::class);
$userMock = (new CurrentUserFactory($this))->create(new User());
$sut = new WidgetRepository($repoMock, $userMock, ['test' => []]);
@@ -50,7 +50,7 @@ class WidgetRepositoryTest extends TestCase
$this->expectException(WidgetException::class);
$this->expectExceptionMessage('Unknown widget type "FooBar"');
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
$repoMock = $this->createMock(TimesheetRepository::class);
$userMock = (new CurrentUserFactory($this))->create(new User());
$sut = new WidgetRepository($repoMock, $userMock, ['test' => ['type' => 'FooBar', 'user' => false]]);
@@ -62,7 +62,7 @@ class WidgetRepositoryTest extends TestCase
$this->expectException(WidgetException::class);
$this->expectExceptionMessage('Widget type "App\Widget\Type\CompoundChart" is not an instance of "App\Widget\Type\AbstractWidgetType"');
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
$repoMock = $this->createMock(TimesheetRepository::class);
$userMock = (new CurrentUserFactory($this))->create(new User());
$sut = new WidgetRepository($repoMock, $userMock, ['test' => ['type' => CompoundChart::class, 'user' => false]]);
@@ -74,7 +74,7 @@ class WidgetRepositoryTest extends TestCase
*/
public function testGetWidget($data, $query, $dataType)
{
$repoMock = $this->getMockBuilder(TimesheetRepository::class)->disableOriginalConstructor()->getMock();
$repoMock = $this->createMock(TimesheetRepository::class);
$repoMock->method('getStatistic')->willReturn($data);
$userMock = (new CurrentUserFactory($this))->create(new User());