fix: harden CHRNX theme foundation

This commit is contained in:
chrnx committed 2026-08-11 14:23:35 -05:00
1 parent b727d4148c
commit ab305c98d1
4 files changed
+49 -4

No files matched your search

+13 -2
View File
@@ -12,7 +12,7 @@ test('Composer provides the PHPUnit Polyfills version required by WordPress test
assert.equal(composer['require-dev']['phpunit/phpunit'], '^9.6');
assert.equal(
packageConfig.scripts['test:php'],
'wp-env run cli --env-cwd=wp-content/themes/chrnx composer exec phpunit',
'wp-env run cli --env-cwd=wp-content/themes/chrnx -- composer exec phpunit --',
);
});
@@ -32,10 +32,21 @@ test('style.css declares the supported WordPress theme contract', async () => {
assert.match(stylesheet, /^Requires PHP:\s*8\.1$/m);
});
test('the stylesheet and PHP asset versions remain synchronized', async () => {
const stylesheet = await readProjectFile('style.css');
const functions = await readProjectFile('functions.php');
const stylesheetVersion = stylesheet.match(/^Version:\s*(\S+)$/m)?.[1];
const phpVersion = functions.match(/define\( 'CHRNX_VERSION', '([^']+)' \);/)?.[1];
assert.ok(stylesheetVersion, 'style.css must declare Version metadata');
assert.ok(phpVersion, 'functions.php must define the literal CHRNX_VERSION constant');
assert.equal(phpVersion, stylesheetVersion);
});
test('theme.json declares the v3 schema and layout widths', async () => {
const theme = JSON.parse(await readProjectFile('theme.json'));
assert.equal(theme.$schema, 'https://schemas.wp.org/trunk/theme.json');
assert.equal(theme.$schema, 'https://schemas.wp.org/wp/6.9/theme.json');
assert.equal(theme.version, 3);
assert.equal(theme.settings.layout.contentSize, '720px');
assert.equal(theme.settings.layout.wideSize, '1120px');