Release 2.0.27 (#4107)

This commit is contained in:
Kevin Papst
2023-07-04 17:01:29 +02:00
committed by GitHub
parent 6a99ad41ca
commit 651f812da8
62 changed files with 506 additions and 427 deletions

View File

@@ -413,7 +413,7 @@ class ConfigurationTest extends TestCase
'connection' => [
'organization' => []
],
'provider' => null,
'provider' => 'default',
],
'company' => [
'financial_year' => null,

View File

@@ -96,12 +96,14 @@ class PageActionsEventTest extends TestCase
$sut->addCreate('foo5', true);
$sut->addCreate('foo6', false);
$sut->addQuickExport('foo7');
$sut->addEdit('trölölö');
$expected = [
'divider0' => null,
'columns' => ['modal' => '#foo2', 'title' => 'modal.columns.title'],
'create' => ['url' => 'foo5', 'class' => 'modal-ajax-form', 'title' => 'create', 'accesskey' => 'a'],
'download' => ['url' => 'foo7', 'class' => 'toolbar-action', 'title' => 'export'],
'edit' => ['url' => 'trölölö', 'class' => 'modal-ajax-form', 'translation_domain' => 'actions', 'title' => 'edit'],
'trash' => ['url' => 'foo3', 'class' => 'modal-ajax-form text-red', 'translation_domain' => 'actions'],
];
$this->assertEquals(\count($expected), $sut->countActions());

View File

@@ -22,7 +22,7 @@ class ThemeEventTest extends TestCase
{
$sut = new ThemeEvent();
$this->assertNull($sut->getUser());
$this->assertNull($sut->getPayload());
$this->assertIsArray($sut->getPayload());
$this->assertEquals('', $sut->getContent());
}
@@ -41,7 +41,7 @@ class ThemeEventTest extends TestCase
$user = new User();
$user->setAlias('foo');
$payload = [null, '', 'test', new \stdClass()];
$payload = ['foo' => null, '' => '', 'test' => 'test', 'class' => new \stdClass()];
$sut = new ThemeEvent($user, $payload);
$this->assertEquals($payload, $sut->getPayload());
@@ -62,10 +62,9 @@ class ThemeEventTest extends TestCase
$user = new User();
$user->setAlias('foo');
$payload = [null, '', 'test', new \stdClass()];
$payload = ['foo' => null, '' => '', 'test' => 'test', 'class' => new \stdClass()];
$sut = new ThemeEvent($user);
$sut->setPayload($payload);
$sut = new ThemeEvent($user, $payload);
$this->assertEquals($payload, $sut->getPayload());
}
}

View File

@@ -20,7 +20,7 @@ class DebugRenderer extends AbstractRenderer implements RendererInterface
/**
* @return string[]
*/
protected function getFileExtensions()
protected function getFileExtensions(): array
{
return [];
}
@@ -28,7 +28,7 @@ class DebugRenderer extends AbstractRenderer implements RendererInterface
/**
* @return string
*/
protected function getContentType()
protected function getContentType(): string
{
return 'array';
}

View File

@@ -0,0 +1,32 @@
<?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\Model;
use App\Model\PermissionSection;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Model\PermissionSection
*/
class PermissionSectionTest extends TestCase
{
public function testFilter(): void
{
$sut = new PermissionSection('A wonderful name', '_contract');
self::assertFalse($sut->filter('contract_settings'));
self::assertTrue($sut->filter('my_contract'));
self::assertTrue($sut->filter('my_contract_settings'));
$sut = new PermissionSection('A wonderful name', ['_contract', '_settings']);
self::assertFalse($sut->filter('contractor'));
self::assertTrue($sut->filter('contract_settings'));
self::assertTrue($sut->filter('my_contract_settings'));
}
}

View File

@@ -17,6 +17,7 @@ use App\Tests\Mocks\SystemConfigurationFactory;
use App\Twig\Runtime\ThemeExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\AppVariable;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
@@ -57,11 +58,14 @@ class ThemeEventExtensionTest extends TestCase
$translator = $this->getMockBuilder(TranslatorInterface::class)->getMock();
$translator->method('trans')->willReturn('foo');
$security = $this->getMockBuilder(Security::class)->disableOriginalConstructor()->getMock();
$security->method('getUser')->willReturn(null);
$configs = [];
$loader = new TestConfigLoader($configs);
$configuration = SystemConfigurationFactory::create($loader, $this->getDefaultSettings());
return new ThemeExtension($dispatcher, $translator, $configuration);
return new ThemeExtension($dispatcher, $translator, $configuration, $security);
}
protected function getEnvironment(): Environment