refactored page actions to event subscriber (#2420)

This commit is contained in:
Kevin Papst
2021-03-15 14:18:44 +01:00
committed by GitHub
parent 9a2fd9ba91
commit e1c9af795c
117 changed files with 2403 additions and 815 deletions

View File

@@ -1,33 +0,0 @@
<?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\Twig\Runtime;
use App\Export\ServiceExport;
use App\Twig\Runtime\ExporterExtension;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Twig\Runtime\ExporterExtension
*/
class ExporterExtensionTest extends TestCase
{
protected function getSut(): ExporterExtension
{
$service = new ServiceExport();
return new ExporterExtension($service);
}
public function testGetExporter()
{
$sut = $this->getSut();
self::assertEquals([], $sut->getTimesheetExporter());
}
}

View File

@@ -1,43 +0,0 @@
<?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\Twig\Runtime;
use App\Entity\User;
use App\Reporting\ReportingService;
use App\Twig\Runtime\ReportingExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
/**
* @covers \App\Twig\Runtime\ReportingExtension
*/
class ReportingExtensionTest extends TestCase
{
protected function getSut(bool $isGranted): ReportingExtension
{
$eventDispatcher = new EventDispatcher();
$authorization = $this->createMock(AuthorizationCheckerInterface::class);
$authorization->expects($this->any())->method('isGranted')->willReturn($isGranted);
$service = new ReportingService($eventDispatcher, $authorization);
return new ReportingExtension($service);
}
public function testRenderWidgetForInvalidValue()
{
$sut = $this->getSut(true);
$reports = $sut->getAvailableReports(new User());
$this->assertCount(4, $reports);
}
}

View File

@@ -41,11 +41,9 @@ class RuntimeExtensionsTest extends TestCase
'trigger',
'actions',
'javascript_translations',
'timesheet_exporter',
'active_timesheets',
'encore_entry_css_source',
'render_widget',
'available_reports'
];
$i = 0;