bisschen tests fixen

This commit is contained in:
2026-02-23 16:00:04 +01:00
parent 99db252f60
commit 7b53faca37
5 changed files with 43 additions and 41 deletions

View File

@@ -111,15 +111,11 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
</div> </div>
<div data-tab-panel="master-data"> <div data-tab-panel="master-data">
<details name="general" open data-details-always-open> <label class="app-field">
<summary><?php e(t('General')); ?></summary> <span><?php e(t('App title')); ?> <span class="badge" data-variant="info"><?php e(t('Cached')); ?></span></span>
<hr> <input type="text" name="app_title" value="<?php e($appTitle); ?>" placeholder="<?php e(appTitle()); ?>" <?php e($readonlyAttr); ?>>
<label class="app-field"> <small><?php e(t($appTitleDesc)); ?></small>
<span><?php e(t('App title')); ?> <span class="badge" data-variant="info"><?php e(t('Cached')); ?></span></span> </label>
<input type="text" name="app_title" value="<?php e($appTitle); ?>" placeholder="<?php e(appTitle()); ?>" <?php e($readonlyAttr); ?>>
<small><?php e(t($appTitleDesc)); ?></small>
</label>
</details>
<hr> <hr>
<details name="internationalization" data-details-key="internationalization"> <details name="internationalization" data-details-key="internationalization">
<summary><?php e(t('Internationalization')); ?></summary> <summary><?php e(t('Internationalization')); ?></summary>
@@ -193,7 +189,6 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
</small> </small>
</label> </label>
</div> </div>
<label class="app-field"> <label class="app-field">
<span><?php e(t('Default role')); ?></span> <span><?php e(t('Default role')); ?></span>
<select name="default_role_id" <?php e($disabledAttr); ?>> <select name="default_role_id" <?php e($disabledAttr); ?>>
@@ -259,10 +254,7 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
</div> </div>
<div data-tab-panel="security"> <div data-tab-panel="security">
<details name="security" open> <fieldset>
<summary><?php e(t('Security')); ?></summary>
<hr>
<fieldset>
<legend> <legend>
<small> <small>
<?php e(t($appRegistrationDesc)); ?> <?php e(t($appRegistrationDesc)); ?>
@@ -306,14 +298,10 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
</button> </button>
<?php endif; ?> <?php endif; ?>
</fieldset> </fieldset>
</details>
</div> </div>
<div data-tab-panel="email"> <div data-tab-panel="email">
<details name="smtp" open> <div class="grid">
<summary><?php e(t('Email settings')); ?></summary>
<hr>
<div class="grid">
<label class="app-field"> <label class="app-field">
<span><?php e(t('SMTP host')); ?></span> <span><?php e(t('SMTP host')); ?></span>
<input type="text" name="smtp_host" value="<?php e($smtpHost); ?>" <?php e($readonlyAttr); ?>> <input type="text" name="smtp_host" value="<?php e($smtpHost); ?>" <?php e($readonlyAttr); ?>>
@@ -358,14 +346,10 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
<input type="text" name="smtp_from_name" value="<?php e($smtpFromName); ?>" <?php e($readonlyAttr); ?>> <input type="text" name="smtp_from_name" value="<?php e($smtpFromName); ?>" <?php e($readonlyAttr); ?>>
<small><?php e(t($smtpFromNameDesc)); ?></small> <small><?php e(t($smtpFromNameDesc)); ?></small>
</label> </label>
</details>
</div> </div>
<div data-tab-panel="api"> <div data-tab-panel="api">
<details name="api-settings" open> <p class="muted"><?php e(t('API tokens and default lifetimes are managed here.')); ?></p>
<summary><?php e(t('API settings')); ?></summary>
<hr>
<p class="muted"><?php e(t('API tokens and default lifetimes are managed here.')); ?></p>
<div class="grid"> <div class="grid">
<label class="app-field"> <label class="app-field">
<span><?php e(t('API token default lifetime (days)')); ?> <span class="badge" data-variant="info"><?php e(t('Cached')); ?></span></span> <span><?php e(t('API token default lifetime (days)')); ?> <span class="badge" data-variant="info"><?php e(t('Cached')); ?></span></span>
@@ -399,14 +383,10 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
</button> </button>
</fieldset> </fieldset>
<?php endif; ?> <?php endif; ?>
</details>
</div> </div>
<div data-tab-panel="integrations"> <div data-tab-panel="integrations">
<details name="microsoft-sso" open> <blockquote data-variant="info">
<summary><?php e(t('Microsoft SSO')); ?></summary>
<hr>
<blockquote data-variant="info">
<?php e(t('Shared Microsoft app credentials are used by tenants that enable "Use shared app credentials".')); ?> <?php e(t('Shared Microsoft app credentials are used by tenants that enable "Use shared app credentials".')); ?>
</blockquote> </blockquote>
<label class="app-field"> <label class="app-field">
@@ -424,15 +404,11 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
<input type="url" name="microsoft_authority" value="<?php e($microsoftAuthority); ?>" placeholder="https://login.microsoftonline.com/common/v2.0" <?php e($readonlyAttr); ?>> <input type="url" name="microsoft_authority" value="<?php e($microsoftAuthority); ?>" placeholder="https://login.microsoftonline.com/common/v2.0" <?php e($readonlyAttr); ?>>
<small><?php e(t($microsoftAuthorityDesc)); ?></small> <small><?php e(t($microsoftAuthorityDesc)); ?></small>
</label> </label>
</details>
</div> </div>
<?php if ($canUpdateSettings): ?> <?php if ($canUpdateSettings): ?>
<div data-tab-panel="danger"> <div data-tab-panel="danger">
<details name="danger-zone" open> <fieldset>
<summary><?php e(t('Danger zone')); ?></summary>
<hr>
<fieldset>
<legend><small><?php e(t('Login tokens')); ?></small></legend> <legend><small><?php e(t('Login tokens')); ?></small></legend>
<p class="muted"> <p class="muted">
<?php e(t('This will mark all remember-me tokens as expired. Users will need to sign in again.')); ?> <?php e(t('This will mark all remember-me tokens as expired. Users will need to sign in again.')); ?>
@@ -448,7 +424,6 @@ $disabledAttr = $isReadOnly ? 'disabled' : '';
<?php Session::getCsrfInput(); ?> <?php Session::getCsrfInput(); ?>
</form> </form>
</fieldset> </fieldset>
</details>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@@ -3,13 +3,14 @@
namespace MintyPHP\Tests\Service\Access; namespace MintyPHP\Tests\Service\Access;
use MintyPHP\Service\Access\PermissionGateway; use MintyPHP\Service\Access\PermissionGateway;
use MintyPHP\Service\Access\PermissionService;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class PermissionGatewayTest extends TestCase class PermissionGatewayTest extends TestCase
{ {
public function testUserHasDelegatesToService(): void public function testUserHasDelegatesToService(): void
{ {
$permissionService = $this->createMock('MintyPHP\\Service\\Access\\PermissionService'); $permissionService = $this->createMock(PermissionService::class);
$permissionService->expects($this->once()) $permissionService->expects($this->once())
->method('userHas') ->method('userHas')
->with(7, 'users.view') ->with(7, 'users.view')
@@ -21,7 +22,7 @@ class PermissionGatewayTest extends TestCase
public function testListPagedDelegatesToService(): void public function testListPagedDelegatesToService(): void
{ {
$permissionService = $this->createMock('MintyPHP\\Service\\Access\\PermissionService'); $permissionService = $this->createMock(PermissionService::class);
$permissionService->expects($this->once()) $permissionService->expects($this->once())
->method('listPaged') ->method('listPaged')
->with(['limit' => 10]) ->with(['limit' => 10])

View File

@@ -120,8 +120,7 @@ class ImportServiceTest extends TestCase
$stateStore = $stateStore ?? $this->createMock(ImportStateStoreService::class); $stateStore = $stateStore ?? $this->createMock(ImportStateStoreService::class);
$permissionGateway = $this->createMock(PermissionGateway::class); $permissionGateway = $this->createMock(PermissionGateway::class);
$permissionGateway->method('userHas')->willReturn(false); $permissionGateway->method('userHas')->willReturn(false);
$settingService = $this->createMock('MintyPHP\\Service\\Settings\\SettingService'); $settingGateway = $this->createMock(SettingGateway::class);
$settingGateway = new SettingGateway($settingService);
$userScopeGateway = $this->createMock(UserScopeGateway::class); $userScopeGateway = $this->createMock(UserScopeGateway::class);
$userScopeGateway->method('hasGlobalAccess')->willReturn(false); $userScopeGateway->method('hasGlobalAccess')->willReturn(false);
$userScopeGateway->method('getUserTenantIds')->willReturn([]); $userScopeGateway->method('getUserTenantIds')->willReturn([]);

View File

@@ -3,13 +3,14 @@
namespace MintyPHP\Tests\Service\Settings; namespace MintyPHP\Tests\Service\Settings;
use MintyPHP\Service\Settings\SettingGateway; use MintyPHP\Service\Settings\SettingGateway;
use MintyPHP\Service\Settings\SettingService;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class SettingGatewayTest extends TestCase class SettingGatewayTest extends TestCase
{ {
public function testGetDefaultTenantIdDelegatesToService(): void public function testGetDefaultTenantIdDelegatesToService(): void
{ {
$settingService = $this->createMock('MintyPHP\\Service\\Settings\\SettingService'); $settingService = $this->createMock(SettingService::class);
$settingService->expects($this->once()) $settingService->expects($this->once())
->method('getDefaultTenantId') ->method('getDefaultTenantId')
->willReturn(42); ->willReturn(42);
@@ -20,7 +21,7 @@ class SettingGatewayTest extends TestCase
public function testSetDefaultRoleIdDelegatesToService(): void public function testSetDefaultRoleIdDelegatesToService(): void
{ {
$settingService = $this->createMock('MintyPHP\\Service\\Settings\\SettingService'); $settingService = $this->createMock(SettingService::class);
$settingService->expects($this->once()) $settingService->expects($this->once())
->method('setDefaultRoleId') ->method('setDefaultRoleId')
->with(7, null) ->with(7, null)

View File

@@ -111,10 +111,36 @@
color: var(--app-color); color: var(--app-color);
} }
/* Reset all Pico CSS button styles that bleed into Swagger UI */
.swagger-ui button { .swagger-ui button {
cursor: pointer; cursor: pointer;
background: transparent; background: transparent;
border: 0; border: 0;
padding: 0;
margin: 0;
color: inherit;
font-size: inherit;
font-weight: inherit;
font-family: inherit;
line-height: inherit;
border-radius: 0;
box-shadow: none;
text-transform: none;
/* Reset CSS custom properties set by app base styles on all buttons */
--app-background-color: initial;
--app-border-color: initial;
--app-color: initial;
--app-box-shadow: initial;
}
/* Restore sizing/appearance for Swagger UI action buttons (.btn) */
.swagger-ui .btn {
padding: 6px 23px;
font-size: 14px;
font-weight: 700;
border: 2px solid transparent;
border-radius: var(--app-border-radius);
background: transparent;
} }
.swagger-ui .opblock .opblock-summary-description { .swagger-ui .opblock .opblock-summary-description {