folderweb/devel/tests/helpers/extract_raw_date_from_folder.phpt
Ruben 449e6f8e03 Update framework testing infrastructure and standards
- Add phpt test runner and suite for app functions
- Introduce testing workflow to AGENT.md
- Add tests for cache, content, context, helpers, hooks, plugins,
  rendering
- Mount tests directory in dev container
2026-03-17 12:51:07 +01:00

20 lines
585 B
PHP

--TEST--
extractRawDateFromFolder: extracts YYYY-MM-DD from date-prefixed folder names
--FILE--
<?php
require '/var/www/app/helpers.php';
echo extractRawDateFromFolder('2024-01-15-my-post') . "\n";
echo extractRawDateFromFolder('2024-12-31-year-end') . "\n";
echo (extractRawDateFromFolder('no-date-here') ?? 'null') . "\n";
echo (extractRawDateFromFolder('') ?? 'null') . "\n";
echo (extractRawDateFromFolder('2024-1-1-bad-format') ?? 'null') . "\n";
echo (extractRawDateFromFolder('20240115-no-separators') ?? 'null') . "\n";
?>
--EXPECT--
2024-01-15
2024-12-31
null
null
null
null