@wp-tester/phpunit 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache-fetch.d.ts +41 -0
- package/dist/cache-fetch.d.ts.map +1 -0
- package/dist/cache-fetch.js +114 -0
- package/dist/cache-fetch.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runner.d.ts +2 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +116 -49
- package/dist/runner.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wordpress-test-lib.d.ts +25 -0
- package/dist/wordpress-test-lib.d.ts.map +1 -0
- package/dist/wordpress-test-lib.js +280 -0
- package/dist/wordpress-test-lib.js.map +1 -0
- package/package.json +8 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ResolvedEnvironment } from '@wp-tester/config';
|
|
2
|
+
/**
|
|
3
|
+
* Download WordPress test library from GitHub and cache it locally
|
|
4
|
+
* Uses temp directory with atomic rename to prevent race conditions
|
|
5
|
+
*
|
|
6
|
+
* @param version - WordPress version (e.g., "6.9" or "6.4.1")
|
|
7
|
+
* @param baseCacheDir - Optional base cache directory (for testing)
|
|
8
|
+
* @returns Path to cached test library directory
|
|
9
|
+
*/
|
|
10
|
+
export declare function downloadWordPressTestLib(version: string, baseCacheDir?: string): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Mount WordPress test library to environment and add initialization steps
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: This function is designed for UNIT TESTS ONLY.
|
|
15
|
+
* For integration tests, use the standard WordPress installation (wp-load.php).
|
|
16
|
+
*
|
|
17
|
+
* The WordPress test library provides test utilities and a clean test database,
|
|
18
|
+
* but expects to control WordPress initialization itself. Integration tests that
|
|
19
|
+
* load WordPress before the test library's bootstrap can cause conflicts.
|
|
20
|
+
*
|
|
21
|
+
* @param environment - Environment configuration
|
|
22
|
+
* @returns Environment with test library mount and initialization steps added
|
|
23
|
+
*/
|
|
24
|
+
export declare function mountWordPressTestLibrary(environment: ResolvedEnvironment): Promise<ResolvedEnvironment>;
|
|
25
|
+
//# sourceMappingURL=wordpress-test-lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordpress-test-lib.d.ts","sourceRoot":"","sources":["../src/wordpress-test-lib.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAsH7D;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CA6HjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,mBAAmB,GAC/B,OAAO,CAAC,mBAAmB,CAAC,CAiE9B"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as crypto from 'node:crypto';
|
|
5
|
+
import * as yauzl from 'yauzl';
|
|
6
|
+
import { cacheFetch } from './cache-fetch.js';
|
|
7
|
+
import { resolveWordPressRelease } from '@wp-playground/wordpress';
|
|
8
|
+
/**
|
|
9
|
+
* Calculate checksum of a file
|
|
10
|
+
*/
|
|
11
|
+
function calculateFileChecksum(filePath) {
|
|
12
|
+
const content = fs.readFileSync(filePath);
|
|
13
|
+
return crypto.createHash('sha256').update(content).digest('hex');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Find the closest matching WordPress test library version tag
|
|
17
|
+
* WordPress might use 6.9, but wordpress-develop uses 6.9.0
|
|
18
|
+
*
|
|
19
|
+
* Falls back to assuming exact tag exists if GitHub API is unavailable
|
|
20
|
+
*/
|
|
21
|
+
async function findMatchingTag(requestedVersion) {
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch('https://api.github.com/repos/WordPress/wordpress-develop/tags?per_page=100', {
|
|
24
|
+
headers: {
|
|
25
|
+
'User-Agent': 'wp-tester',
|
|
26
|
+
'Accept': 'application/vnd.github.v3+json'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
// Check for non-200 status codes
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
console.warn(`GitHub API returned status ${response.status}. Attempting fallback version resolution.`);
|
|
32
|
+
const fallbackTag = inferTagName(requestedVersion);
|
|
33
|
+
if (fallbackTag) {
|
|
34
|
+
return fallbackTag;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`GitHub API returned status ${response.status} and could not infer tag name for version ${requestedVersion}`);
|
|
37
|
+
}
|
|
38
|
+
const tags = await response.json();
|
|
39
|
+
// Try exact match first
|
|
40
|
+
const exactMatch = tags.find(tag => tag.name === requestedVersion);
|
|
41
|
+
if (exactMatch) {
|
|
42
|
+
return exactMatch.name;
|
|
43
|
+
}
|
|
44
|
+
// Parse version to try X.Y.0 pattern
|
|
45
|
+
const versionMatch = requestedVersion.match(/^(\d+\.\d+)(?:\.(\d+))?$/);
|
|
46
|
+
if (versionMatch) {
|
|
47
|
+
const [, baseVersion, patch] = versionMatch;
|
|
48
|
+
// If no patch version provided (e.g., "6.9"), try X.Y.0
|
|
49
|
+
if (!patch) {
|
|
50
|
+
const tagWithZero = tags.find((tag) => tag.name === `${baseVersion}.0`);
|
|
51
|
+
if (tagWithZero) {
|
|
52
|
+
return tagWithZero.name;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Try to find closest patch version
|
|
56
|
+
const matchingTags = tags.filter((tag) => tag.name.startsWith(`${baseVersion}.`));
|
|
57
|
+
if (matchingTags.length > 0) {
|
|
58
|
+
const closest = matchingTags[0];
|
|
59
|
+
return closest.name;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
throw new Error(`No matching WordPress test library tag found for version ${requestedVersion}`);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
// Fallback on any error (network, parse, etc.)
|
|
66
|
+
if (error instanceof Error && error.message.includes('GitHub API returned status')) {
|
|
67
|
+
// Already handled above, just rethrow if no fallback
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
console.warn(`Failed to fetch GitHub tags: ${error instanceof Error ? error.message : 'Unknown error'}. Attempting fallback version resolution.`);
|
|
71
|
+
const fallbackTag = inferTagName(requestedVersion);
|
|
72
|
+
if (fallbackTag) {
|
|
73
|
+
return fallbackTag;
|
|
74
|
+
}
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Infer the tag name from a version string when GitHub API is unavailable
|
|
80
|
+
* Converts "6.9" to "6.9.0", keeps "6.4.1" as is
|
|
81
|
+
*/
|
|
82
|
+
function inferTagName(version) {
|
|
83
|
+
const versionMatch = version.match(/^(\d+\.\d+)(?:\.(\d+))?$/);
|
|
84
|
+
if (!versionMatch) {
|
|
85
|
+
return null; // Invalid version format
|
|
86
|
+
}
|
|
87
|
+
const [, baseVersion, patch] = versionMatch;
|
|
88
|
+
// If no patch version, assume .0
|
|
89
|
+
if (!patch) {
|
|
90
|
+
return `${baseVersion}.0`;
|
|
91
|
+
}
|
|
92
|
+
// Already has patch version, use as-is
|
|
93
|
+
return version;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Download WordPress test library from GitHub and cache it locally
|
|
97
|
+
* Uses temp directory with atomic rename to prevent race conditions
|
|
98
|
+
*
|
|
99
|
+
* @param version - WordPress version (e.g., "6.9" or "6.4.1")
|
|
100
|
+
* @param baseCacheDir - Optional base cache directory (for testing)
|
|
101
|
+
* @returns Path to cached test library directory
|
|
102
|
+
*/
|
|
103
|
+
export async function downloadWordPressTestLib(version, baseCacheDir) {
|
|
104
|
+
const cacheBase = baseCacheDir || path.join(os.homedir(), '.wp-tester', 'cache');
|
|
105
|
+
// Find the matching tag on GitHub (e.g., "6.9" -> "6.9.0")
|
|
106
|
+
const actualTag = await findMatchingTag(version);
|
|
107
|
+
const finalDir = path.join(cacheBase, 'test-lib', actualTag);
|
|
108
|
+
const checksumFile = path.join(finalDir, '.checksum');
|
|
109
|
+
const url = `https://github.com/WordPress/wordpress-develop/archive/refs/tags/${actualTag}.zip`;
|
|
110
|
+
// Download and cache the zip file (cache expires after 24 hours by default)
|
|
111
|
+
const zipPath = await cacheFetch({
|
|
112
|
+
baseCacheDir: cacheBase,
|
|
113
|
+
cacheKey: `test-lib-zip/${actualTag}`,
|
|
114
|
+
url,
|
|
115
|
+
});
|
|
116
|
+
// Calculate checksum of the zip file
|
|
117
|
+
const currentChecksum = calculateFileChecksum(zipPath);
|
|
118
|
+
// Check if we already have this exact version extracted
|
|
119
|
+
if (fs.existsSync(checksumFile)) {
|
|
120
|
+
const existingChecksum = fs.readFileSync(checksumFile, 'utf-8').trim();
|
|
121
|
+
if (existingChecksum === currentChecksum) {
|
|
122
|
+
// Already extracted with same checksum, return existing directory
|
|
123
|
+
return finalDir;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Extract to temporary directory first
|
|
127
|
+
const tempDir = fs.mkdtempSync(path.join(cacheBase, `temp-${actualTag}-`));
|
|
128
|
+
try {
|
|
129
|
+
// Extract zip file using yauzl (lightweight zip parser)
|
|
130
|
+
await new Promise((resolve, reject) => {
|
|
131
|
+
yauzl.open(zipPath, { lazyEntries: true }, (err, zipfile) => {
|
|
132
|
+
if (err || !zipfile) {
|
|
133
|
+
reject(err || new Error('Failed to open zip file'));
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const testPrefix = 'tests/phpunit/';
|
|
137
|
+
let extractedFiles = 0;
|
|
138
|
+
zipfile.readEntry();
|
|
139
|
+
zipfile.on('entry', (entry) => {
|
|
140
|
+
// Skip directories
|
|
141
|
+
if (/\/$/.test(entry.fileName)) {
|
|
142
|
+
zipfile.readEntry();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
// Only extract files from tests/phpunit/
|
|
146
|
+
if (entry.fileName.includes(testPrefix)) {
|
|
147
|
+
const idx = entry.fileName.indexOf(testPrefix);
|
|
148
|
+
if (idx !== -1) {
|
|
149
|
+
const relativePath = entry.fileName.substring(idx + testPrefix.length);
|
|
150
|
+
const targetPath = path.join(tempDir, relativePath);
|
|
151
|
+
// Ensure parent directory exists
|
|
152
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
153
|
+
// Extract file
|
|
154
|
+
zipfile.openReadStream(entry, (err, readStream) => {
|
|
155
|
+
if (err || !readStream) {
|
|
156
|
+
reject(err || new Error('Failed to read zip entry'));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const writeStream = fs.createWriteStream(targetPath);
|
|
160
|
+
readStream.pipe(writeStream);
|
|
161
|
+
writeStream.on('close', () => {
|
|
162
|
+
extractedFiles++;
|
|
163
|
+
zipfile.readEntry();
|
|
164
|
+
});
|
|
165
|
+
writeStream.on('error', reject);
|
|
166
|
+
readStream.on('error', reject);
|
|
167
|
+
});
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
zipfile.readEntry();
|
|
172
|
+
});
|
|
173
|
+
zipfile.on('end', () => {
|
|
174
|
+
if (extractedFiles === 0) {
|
|
175
|
+
reject(new Error('No test files found in archive'));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
resolve();
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
zipfile.on('error', reject);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
// Write checksum file
|
|
185
|
+
fs.writeFileSync(path.join(tempDir, '.checksum'), currentChecksum);
|
|
186
|
+
// Atomic operation: remove old directory and rename temp to final
|
|
187
|
+
// If final directory exists, remove it
|
|
188
|
+
if (fs.existsSync(finalDir)) {
|
|
189
|
+
fs.rmSync(finalDir, { recursive: true, force: true });
|
|
190
|
+
}
|
|
191
|
+
// Ensure parent directory exists
|
|
192
|
+
fs.mkdirSync(path.dirname(finalDir), { recursive: true });
|
|
193
|
+
// Rename is atomic on most filesystems - if multiple processes try this,
|
|
194
|
+
// only one will succeed, others will fail and retry
|
|
195
|
+
fs.renameSync(tempDir, finalDir);
|
|
196
|
+
return finalDir;
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
// Clean up temp directory on failure
|
|
200
|
+
if (fs.existsSync(tempDir)) {
|
|
201
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
202
|
+
}
|
|
203
|
+
throw new Error(`Failed to download WordPress test library version ${version} (tag: ${actualTag}). Please ensure the version exists in the WordPress repository: ${error.message}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Mount WordPress test library to environment and add initialization steps
|
|
208
|
+
*
|
|
209
|
+
* IMPORTANT: This function is designed for UNIT TESTS ONLY.
|
|
210
|
+
* For integration tests, use the standard WordPress installation (wp-load.php).
|
|
211
|
+
*
|
|
212
|
+
* The WordPress test library provides test utilities and a clean test database,
|
|
213
|
+
* but expects to control WordPress initialization itself. Integration tests that
|
|
214
|
+
* load WordPress before the test library's bootstrap can cause conflicts.
|
|
215
|
+
*
|
|
216
|
+
* @param environment - Environment configuration
|
|
217
|
+
* @returns Environment with test library mount and initialization steps added
|
|
218
|
+
*/
|
|
219
|
+
export async function mountWordPressTestLibrary(environment) {
|
|
220
|
+
// Resolve WordPress version from environment
|
|
221
|
+
const wpRelease = await resolveWordPressRelease(environment.blueprint.preferredVersions.wp);
|
|
222
|
+
const wpVersion = wpRelease.version;
|
|
223
|
+
// Download and cache test library
|
|
224
|
+
const cachePath = await downloadWordPressTestLib(wpVersion);
|
|
225
|
+
// Create wp-tests-config.php content
|
|
226
|
+
const wpTestsConfig = `<?php
|
|
227
|
+
/* Path to the WordPress codebase you'd like to test. */
|
|
228
|
+
define( 'ABSPATH', '/wordpress/' );
|
|
229
|
+
|
|
230
|
+
// Test Database - Use separate database to avoid conflicts with main WordPress installation
|
|
231
|
+
// The test library's install.php drops all tables, so we need isolation
|
|
232
|
+
define( 'DB_NAME', 'wordpress_test' );
|
|
233
|
+
define( 'DB_USER', 'root' );
|
|
234
|
+
define( 'DB_PASSWORD', '' );
|
|
235
|
+
define( 'DB_HOST', 'localhost' );
|
|
236
|
+
define( 'DB_CHARSET', 'utf8' );
|
|
237
|
+
define( 'DB_COLLATE', '' );
|
|
238
|
+
|
|
239
|
+
$table_prefix = 'wptests_';
|
|
240
|
+
|
|
241
|
+
// Use a generic domain that tests can override via update_option('home')
|
|
242
|
+
// Don't use Playground's actual domain here as it prevents tests from
|
|
243
|
+
// dynamically changing the home URL for mock HTTP requests
|
|
244
|
+
define( 'WP_TESTS_DOMAIN', 'example.org' );
|
|
245
|
+
define( 'WP_TESTS_EMAIL', 'admin@example.org' );
|
|
246
|
+
define( 'WP_TESTS_TITLE', 'Test Blog' );
|
|
247
|
+
|
|
248
|
+
define( 'WP_PHP_BINARY', 'php' );
|
|
249
|
+
define( 'WPLANG', '' );
|
|
250
|
+
`;
|
|
251
|
+
// Build blueprint steps for initialization
|
|
252
|
+
// For unit tests, we only need to write the wp-tests-config.php file
|
|
253
|
+
// WordPress initialization is handled by the user's bootstrap via test library's bootstrap
|
|
254
|
+
const initSteps = [
|
|
255
|
+
// Write wp-tests-config.php
|
|
256
|
+
{
|
|
257
|
+
step: 'writeFile',
|
|
258
|
+
path: '/tmp/wordpress-tests-lib/wp-tests-config.php',
|
|
259
|
+
data: wpTestsConfig,
|
|
260
|
+
},
|
|
261
|
+
];
|
|
262
|
+
// Add initialization steps to blueprint
|
|
263
|
+
const existingSteps = environment.blueprint.steps || [];
|
|
264
|
+
// Return environment copy with test library mount and initialization steps added
|
|
265
|
+
return {
|
|
266
|
+
...environment,
|
|
267
|
+
blueprint: {
|
|
268
|
+
...environment.blueprint,
|
|
269
|
+
steps: [...existingSteps, ...initSteps],
|
|
270
|
+
},
|
|
271
|
+
mounts: [
|
|
272
|
+
...environment.mounts,
|
|
273
|
+
{
|
|
274
|
+
hostPath: cachePath,
|
|
275
|
+
vfsPath: '/tmp/wordpress-tests-lib',
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=wordpress-test-lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordpress-test-lib.js","sourceRoot":"","sources":["../src/wordpress-test-lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAanE;;GAEG;AACH,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;GAKG;AACH,KAAK,UAAU,eAAe,CAAC,gBAAwB;IACrD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,4EAA4E,EAAE;YACzG,OAAO,EAAE;gBACP,YAAY,EAAE,WAAW;gBACzB,QAAQ,EAAE,gCAAgC;aAC3C;SACF,CAAC,CAAC;QAEH,iCAAiC;QACjC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,CAAC,8BAA8B,QAAQ,CAAC,MAAM,2CAA2C,CAAC,CAAC;Y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AAiF;IACjF,OAAO;QACL,GAAG,WAAW;QACd,SAAS,EAAE;YACT,GAAG,WAAW,CAAC,SAAS;YACxB,KAAK,EAAE,CAAC,GAAG,aAAa,EAAE,GAAG,SAAS,CAAC;SACxC;QACD,MAAM,EAAE;YACN,GAAG,WAAW,CAAC,MAAM;YACrB;gBACE,QAAQ,EAAE,SAAS;gBACnB,OAAO,EAAE,0BAA0B;aACpC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-tester/phpunit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "PHPUnit test runner for WordPress projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -20,15 +20,18 @@
|
|
|
20
20
|
"build": "node ../../scripts/build-package.js",
|
|
21
21
|
"test": "vitest run",
|
|
22
22
|
"test:watch": "vitest",
|
|
23
|
+
"test:real-world": "vitest run real-world-plugins",
|
|
24
|
+
"test:compatibility": "vitest run --config vitest.compatibility.config.ts",
|
|
23
25
|
"lint": "eslint .",
|
|
24
26
|
"lint:fix": "eslint . --fix",
|
|
25
27
|
"type-check": "tsc --noEmit"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|
|
28
|
-
"@wp-tester/config": "^0.0.
|
|
29
|
-
"@wp-tester/results": "^0.0.
|
|
30
|
-
"@wp-tester/runtime": "^0.0.
|
|
31
|
-
"xml2js": "^0.6.2"
|
|
30
|
+
"@wp-tester/config": "^0.0.2",
|
|
31
|
+
"@wp-tester/results": "^0.0.2",
|
|
32
|
+
"@wp-tester/runtime": "^0.0.2",
|
|
33
|
+
"xml2js": "^0.6.2",
|
|
34
|
+
"yauzl": "*"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
37
|
"@types/xml2js": "^0.4.14",
|