release 2.0 beta 2 (#3757)
* do not traverse into invoice template subdirectories (#3735) * fix security open api definition * fix currency can be null, removed fluent interface * merged release 1.30.3 * allow to pre-fill timesheet metafields via URL * fix api description * added test accounts with simpler names and password * upgrade to Symfony 6.2 * removed FrameworkExtraBundle (by Sensio) and replaced with new native SF annotations * fixed symfony 6.2 deprecations * fixed #3768
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?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\DependencyInjection\Compiler;
|
||||
|
||||
use App\DependencyInjection\Compiler\WidgetCompilerPass;
|
||||
use App\Kernel;
|
||||
use App\Widget\Type\ActiveTimesheets;
|
||||
use App\Widget\Type\ActiveUsersMonth;
|
||||
use App\Widget\WidgetService;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
/**
|
||||
* @covers \App\DependencyInjection\Compiler\WidgetCompilerPass
|
||||
*/
|
||||
class WidgetCompilerPassTest extends TestCase
|
||||
{
|
||||
private function getContainer(): ContainerBuilder
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$definition = new Definition(WidgetService::class);
|
||||
$container->setDefinition(WidgetService::class, $definition);
|
||||
|
||||
$widgets = [ActiveTimesheets::class, ActiveUsersMonth::class];
|
||||
foreach ($widgets as $widget) {
|
||||
$container->register($widget)->addTag(Kernel::TAG_WIDGET);
|
||||
}
|
||||
|
||||
return $container;
|
||||
}
|
||||
|
||||
public function testCallsAreAdded(): void
|
||||
{
|
||||
$container = $this->getContainer();
|
||||
$sut = new WidgetCompilerPass();
|
||||
$sut->process($container);
|
||||
|
||||
$definition = $container->findDefinition(WidgetService::class);
|
||||
$methods = $definition->getMethodCalls();
|
||||
|
||||
self::assertCount(2, $methods);
|
||||
self::assertTrue($definition->hasMethodCall('registerWidget'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user