reorder folders for easy 1:1 upload to boogie server
This commit is contained in:
1 parent
de5895f558
commit
6c16e16354
20 files changed
+171
-52
No files matched your search
@@ -0,0 +1,16 @@
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$deployBatchPath = Join-Path $projectRoot 'scripts\Deploy-Perspektivwerk.bat'
|
||||
$htaccessPath = Join-Path $projectRoot 'public\.htaccess'
|
||||
|
||||
Describe 'Perspektivwerk deployment' {
|
||||
It 'deploys the complete Perspektivwerk document root and its sibling configuration file' {
|
||||
$script = Get-Content -LiteralPath $deployBatchPath -Raw
|
||||
$htaccess = Get-Content -LiteralPath $htaccessPath -Raw
|
||||
|
||||
$script | Should Match 'public\\booking-config\.php'
|
||||
$script | Should Match 'public\\perspektivwerk"'
|
||||
$script | Should Match 'boogie:html/perspektivwerk/'
|
||||
$htaccess | Should Match '<Files "booking-config\.php">'
|
||||
$htaccess | Should Match 'Require all denied'
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ $projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$mockupPath = Join-Path $projectRoot 'public\perspektivwerk\index.html'
|
||||
$bookingScriptPath = Join-Path $projectRoot 'public\perspektivwerk\js\booking.js'
|
||||
$bookingStylesPath = Join-Path $projectRoot 'public\perspektivwerk\js\booking.css'
|
||||
$contaoBookingScriptPath = Join-Path $projectRoot 'public\booking\booking.js'
|
||||
$contaoBookingStylesPath = Join-Path $projectRoot 'public\booking\booking.css'
|
||||
$deploymentBookingScriptPath = Join-Path $projectRoot 'public\perspektivwerk\booking\booking.js'
|
||||
$deploymentBookingStylesPath = Join-Path $projectRoot 'public\perspektivwerk\booking\booking.css'
|
||||
$htaccessPath = Join-Path $projectRoot 'public\.htaccess'
|
||||
|
||||
Describe 'Perspektivwerk static route' {
|
||||
@@ -19,26 +19,28 @@ Describe 'Perspektivwerk static route' {
|
||||
$mockup | Should Match 'href="js/booking\.css"'
|
||||
$mockup | Should Match 'data-sufw-booking data-project="perspektivwerk"'
|
||||
$mockup | Should Match 'data-sufw-booking data-project="produktionsschule"'
|
||||
$mockup | Should Match 'data-api-url="booking/api\.php"'
|
||||
$mockup | Should Not Match 'data-api-url="/booking/api\.php"'
|
||||
$mockup.IndexOf('data-project="perspektivwerk"') | Should BeLessThan $mockup.IndexOf('data-project="produktionsschule"')
|
||||
$mockup | Should Match 'src="js/booking\.js"'
|
||||
}
|
||||
|
||||
It 'keeps the Contao and static-preview asset copies identical' {
|
||||
(Test-Path -LiteralPath $contaoBookingScriptPath) | Should Be $true
|
||||
(Test-Path -LiteralPath $contaoBookingStylesPath) | Should Be $true
|
||||
(Get-FileHash -LiteralPath $bookingScriptPath).Hash | Should Be (Get-FileHash -LiteralPath $contaoBookingScriptPath).Hash
|
||||
(Get-FileHash -LiteralPath $bookingStylesPath).Hash | Should Be (Get-FileHash -LiteralPath $contaoBookingStylesPath).Hash
|
||||
It 'keeps the deployed API assets and static-preview copies identical' {
|
||||
(Test-Path -LiteralPath $deploymentBookingScriptPath) | Should Be $true
|
||||
(Test-Path -LiteralPath $deploymentBookingStylesPath) | Should Be $true
|
||||
(Get-FileHash -LiteralPath $bookingScriptPath).Hash | Should Be (Get-FileHash -LiteralPath $deploymentBookingScriptPath).Hash
|
||||
(Get-FileHash -LiteralPath $bookingStylesPath).Hash | Should Be (Get-FileHash -LiteralPath $deploymentBookingStylesPath).Hash
|
||||
}
|
||||
|
||||
It 'keeps the enabled submit button visibly rendered' {
|
||||
$script = Get-Content -LiteralPath $contaoBookingScriptPath -Raw
|
||||
$script = Get-Content -LiteralPath $deploymentBookingScriptPath -Raw
|
||||
|
||||
$script | Should Match "submitButton\.style\.visibility = 'visible'"
|
||||
$script | Should Match "actions\.style\.position = 'sticky'"
|
||||
}
|
||||
|
||||
It 'defines colours for the booking form action buttons' {
|
||||
$styles = Get-Content -LiteralPath $contaoBookingStylesPath -Raw
|
||||
$styles = Get-Content -LiteralPath $deploymentBookingStylesPath -Raw
|
||||
|
||||
$styles | Should Match '\.sufw-booking__form-actions button\s*\{[^}]*background-color:\s*#08752a'
|
||||
$styles | Should Match '\.sufw-booking__form-actions button\s*\{[^}]*color:\s*#fff'
|
||||
@@ -47,9 +49,12 @@ Describe 'Perspektivwerk static route' {
|
||||
It 'routes /perspektivwerk to the static entry point before the Contao fallback' {
|
||||
$htaccess = Get-Content -LiteralPath $htaccessPath -Raw
|
||||
$staticRouteIndex = $htaccess.IndexOf('RewriteRule ^perspektivwerk/?$ perspektivwerk/index.html [L]')
|
||||
$adminRouteIndex = $htaccess.IndexOf('RewriteRule ^perspektivwerk/booking-admin/?$ perspektivwerk/booking-admin/index.php [L]')
|
||||
$fallbackIndex = $htaccess.IndexOf('RewriteRule ^ %{ENV:BASE}/index.php [L]')
|
||||
|
||||
$staticRouteIndex | Should BeGreaterThan -1
|
||||
$staticRouteIndex | Should BeLessThan $fallbackIndex
|
||||
$adminRouteIndex | Should BeGreaterThan -1
|
||||
$adminRouteIndex | Should BeLessThan $fallbackIndex
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require __DIR__.'/../public/perspektivwerk/booking/backend.php';
|
||||
|
||||
function expectSame(string $expected, string $actual, string $message): void
|
||||
{
|
||||
if ($expected !== $actual) {
|
||||
throw new RuntimeException($message."\nExpected: $expected\nActual: $actual");
|
||||
}
|
||||
}
|
||||
|
||||
$configFile = tempnam(sys_get_temp_dir(), 'sufw-booking-config-');
|
||||
if ($configFile === false) throw new RuntimeException('Temporary configuration file could not be created.');
|
||||
|
||||
try {
|
||||
file_put_contents($configFile, "<?php\nreturn ['database_url' => 'mysql://fallback:secret@database:3306/booking'];\n");
|
||||
|
||||
expectSame(
|
||||
'mysql://fallback:secret@database:3306/booking',
|
||||
bookingDatabaseUrl('', $configFile),
|
||||
'The configuration file must be used when DATABASE_URL is empty.'
|
||||
);
|
||||
expectSame(
|
||||
'mysql://environment:secret@database:3306/booking',
|
||||
bookingDatabaseUrl('mysql://environment:secret@database:3306/booking', $configFile),
|
||||
'DATABASE_URL must take precedence over the configuration file.'
|
||||
);
|
||||
} finally {
|
||||
unlink($configFile);
|
||||
}
|
||||
|
||||
echo "booking backend configuration tests passed\n";
|
||||
@@ -13,9 +13,9 @@ test('liefert eine externe, idempotente Anfangsmigration für Termine und Anmeld
|
||||
|
||||
test('hält die statische Vorschaukopie der Buchungsassets identisch', async () => {
|
||||
const [componentScript, previewScript, componentStyle, previewStyle] = await Promise.all([
|
||||
readFile(new URL('../public/booking/booking.js', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../public/perspektivwerk/booking/booking.js', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../public/perspektivwerk/js/booking.js', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../public/booking/booking.css', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../public/perspektivwerk/booking/booking.css', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../public/perspektivwerk/js/booking.css', import.meta.url), 'utf8'),
|
||||
]);
|
||||
|
||||
@@ -61,12 +61,8 @@ test('liefert zusätzliche lokale Demo-Termine für Juli und August', async () =
|
||||
});
|
||||
|
||||
test('liefert die unabhängige Verwaltung unter booking-admin mit getrennten Bereichen', async () => {
|
||||
const [routes, admin] = await Promise.all([
|
||||
readFile(new URL('../public/.htaccess', import.meta.url), 'utf8'),
|
||||
readFile(new URL('../public/booking-admin/index.php', import.meta.url), 'utf8'),
|
||||
]);
|
||||
const admin = await readFile(new URL('../public/perspektivwerk/booking-admin/index.php', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(routes, /\^booking-admin\/\?\$ booking-admin\/index\.php/);
|
||||
assert.match(admin, /view === 'registrations'/);
|
||||
assert.match(admin, /view === 'export'/);
|
||||
assert.doesNotMatch(admin, /getenv\(/);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
import { bookingConfirmationMessage, canSubmitBookingForm, formatDateKey, formatEventDuration, getSlotsForDate, requiresIntroductionDetails, validateBookingForm } from '../public/booking/booking.js';
|
||||
import { bookingConfirmationMessage, canSubmitBookingForm, formatDateKey, formatEventDuration, getSlotsForDate, requiresIntroductionDetails, validateBookingForm } from '../public/perspektivwerk/booking/booking.js';
|
||||
|
||||
const events = [
|
||||
{ id: 'one', project: 'perspektivwerk', startsAt: '2026-09-14 08:00:00', endsAt: '2026-09-18 16:00:00', status: 'available' },
|
||||
|
||||
Reference in new issue
Block a user