✨ Story 1.3: templates php base
This commit is contained in:
@@ -2,4 +2,5 @@
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
& (Join-Path $here 'structure.test.ps1')
|
||||
& (Join-Path $here 'tailwind.test.ps1')
|
||||
& (Join-Path $here 'templates.test.ps1')
|
||||
'OK'
|
||||
@@ -31,7 +31,11 @@ Assert-True (Test-Path 'logs/.gitkeep') 'Missing logs/.gitkeep'
|
||||
Assert-True (Test-Path 'index.php') 'Missing index.php'
|
||||
$index = Get-Content -Raw 'index.php'
|
||||
Assert-True ($index -match 'Hello World') 'index.php missing Hello World'
|
||||
Assert-True ($index -match 'meta name="viewport"') 'index.php missing viewport meta'
|
||||
if (-not ($index -match 'meta name="viewport"')) {
|
||||
Assert-True (Test-Path 'templates/header.php') 'Missing templates/header.php for viewport meta'
|
||||
$header = Get-Content -Raw 'templates/header.php'
|
||||
Assert-True ($header -match 'meta name="viewport"') 'Header missing viewport meta'
|
||||
}
|
||||
|
||||
Assert-True (Test-Path '.gitignore') 'Missing .gitignore'
|
||||
$gitignore = Get-Content -Raw '.gitignore'
|
||||
@@ -40,7 +44,6 @@ $required = @(
|
||||
'vendor/',
|
||||
'node_modules/',
|
||||
'logs/*.log',
|
||||
'assets/css/output.css',
|
||||
'.idea/',
|
||||
'.vscode/',
|
||||
'.DS_Store'
|
||||
|
||||
33
tests/templates.test.ps1
Normal file
33
tests/templates.test.ps1
Normal file
@@ -0,0 +1,33 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Assert-True {
|
||||
param(
|
||||
[bool]$Condition,
|
||||
[string]$Message
|
||||
)
|
||||
if (-not $Condition) { throw $Message }
|
||||
}
|
||||
|
||||
Assert-True (Test-Path 'includes/functions.php') 'Missing includes/functions.php'
|
||||
$functions = Get-Content -Raw 'includes/functions.php'
|
||||
Assert-True ($functions -match 'function\s+include_template') 'Missing include_template function'
|
||||
|
||||
Assert-True (Test-Path 'templates/header.php') 'Missing templates/header.php'
|
||||
$header = Get-Content -Raw 'templates/header.php'
|
||||
Assert-True ($header -match '<!DOCTYPE html>') 'Header missing doctype'
|
||||
Assert-True ($header -match 'meta name="viewport"') 'Header missing viewport meta'
|
||||
Assert-True ($header -match 'output\.css') 'Header missing output.css link'
|
||||
Assert-True ($header -match '\$pageTitle') 'Header missing pageTitle'
|
||||
|
||||
Assert-True (Test-Path 'templates/footer.php') 'Missing templates/footer.php'
|
||||
$footer = Get-Content -Raw 'templates/footer.php'
|
||||
Assert-True ($footer -match 'main\.js') 'Footer missing main.js'
|
||||
Assert-True ($footer -match '</body>') 'Footer missing closing body'
|
||||
|
||||
Assert-True (Test-Path 'index.php') 'Missing index.php'
|
||||
$index = Get-Content -Raw 'index.php'
|
||||
Assert-True ($index -match 'include_template\(') 'index.php missing include_template usage'
|
||||
|
||||
Assert-True (Test-Path 'assets/js/main.js') 'Missing assets/js/main.js'
|
||||
|
||||
'OK'
|
||||
Reference in New Issue
Block a user