Release 1.29 (#3622)

This commit is contained in:
Kevin Papst
2022-11-06 20:44:30 +01:00
committed by GitHub
parent 323baa2d65
commit 608a45408a
6 changed files with 22 additions and 8 deletions

View File

@@ -17,11 +17,11 @@ class Constants
/** /**
* The current release version * The current release version
*/ */
public const VERSION = '1.28.1'; public const VERSION = '1.29.0';
/** /**
* The current release: major * 10000 + minor * 100 + patch * The current release: major * 10000 + minor * 100 + patch
*/ */
public const VERSION_ID = 12801; public const VERSION_ID = 12900;
/** /**
* The current release status, either "stable" or "dev" * The current release status, either "stable" or "dev"
*/ */

View File

@@ -525,13 +525,17 @@ final class InvoiceController extends AbstractController
foreach ($documentRepository->findBuiltIn() as $doc) { foreach ($documentRepository->findBuiltIn() as $doc) {
if ($doc->getId() === $id) { if ($doc->getId() === $id) {
throw new \Exception('Document is built-in and cannot be deleted'); $this->flashError('Document is built-in and cannot be deleted.');
return $this->redirectToRoute('admin_invoice_document_upload');
} }
} }
foreach ($this->templateRepository->findAll() as $template) { foreach ($this->templateRepository->findAll() as $template) {
if ($template->getRenderer() === $id) { if ($template->getRenderer() === $id) {
throw new \Exception('Document is used and cannot be deleted'); $this->flashError('Document is used and cannot be deleted.');
return $this->redirectToRoute('admin_invoice_document_upload');
} }
} }

View File

@@ -9,6 +9,7 @@
namespace App\Tests\Security; namespace App\Tests\Security;
use App\Security\ApiAuthenticator;
use App\Security\TokenAuthenticator; use App\Security\TokenAuthenticator;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@@ -22,7 +23,8 @@ class ApiAuthenticatorTest extends TestCase
public function testRememberMe() public function testRememberMe()
{ {
$factory = $this->createMock(EncoderFactoryInterface::class); $factory = $this->createMock(EncoderFactoryInterface::class);
$sut = new TokenAuthenticator($factory); $token = new TokenAuthenticator($factory);
$sut = new ApiAuthenticator($token);
self::assertFalse($sut->supportsRememberMe()); self::assertFalse($sut->supportsRememberMe());
} }
@@ -30,25 +32,30 @@ class ApiAuthenticatorTest extends TestCase
public function testSupports() public function testSupports()
{ {
$factory = $this->createMock(EncoderFactoryInterface::class); $factory = $this->createMock(EncoderFactoryInterface::class);
$sut = new TokenAuthenticator($factory); $token = new TokenAuthenticator($factory);
$sut = new ApiAuthenticator($token);
$request = new Request([], [], [], [], [], ['REQUEST_URI' => 'dfghj/api/doc/dfghj']); $request = new Request([], [], [], [], [], ['REQUEST_URI' => 'dfghj/api/doc/dfghj']);
self::assertFalse($sut->supports($request)); self::assertFalse($sut->supports($request));
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo']); $request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo']);
self::assertFalse($sut->supports($request)); self::assertTrue($sut->supports($request));
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-SESSION' => true]); $request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-SESSION' => true]);
self::assertFalse($sut->supports($request)); self::assertFalse($sut->supports($request));
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo', 'HTTP_X-AUTH-TOKEN' => 'bar']); $request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo', 'HTTP_X-AUTH-TOKEN' => 'bar']);
self::assertTrue($sut->supports($request)); self::assertTrue($sut->supports($request));
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo', 'HTTP_X-AUTH-TOKEN' => 'bar', 'HTTP_X-AUTH-SESSION' => true]);
self::assertFalse($sut->supports($request));
} }
public function testGetCredentials() public function testGetCredentials()
{ {
$factory = $this->createMock(EncoderFactoryInterface::class); $factory = $this->createMock(EncoderFactoryInterface::class);
$sut = new TokenAuthenticator($factory); $token = new TokenAuthenticator($factory);
$sut = new ApiAuthenticator($token);
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-SESSION' => true]); $request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-SESSION' => true]);
self::assertEquals(['user' => null, 'token' => null], $sut->getCredentials($request)); self::assertEquals(['user' => null, 'token' => null], $sut->getCredentials($request));

View File

@@ -43,6 +43,9 @@ class TokenAuthenticatorTest extends TestCase
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo', 'HTTP_X-AUTH-TOKEN' => 'bar']); $request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo', 'HTTP_X-AUTH-TOKEN' => 'bar']);
self::assertTrue($sut->supports($request)); self::assertTrue($sut->supports($request));
$request = new Request([], [], [], [], [], ['REQUEST_URI' => '/api/fooo', 'HTTP_X-AUTH-USER' => 'foo', 'HTTP_X-AUTH-TOKEN' => 'bar', 'HTTP_X-AUTH-SESSION' => true]);
self::assertTrue($sut->supports($request));
} }
public function testGetCredentials() public function testGetCredentials()