forked from oraoto/pib
-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathbasic.mjs
24 lines (17 loc) · 784 Bytes
/
basic.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { test } from 'node:test';
import { strict as assert } from 'node:assert';
import { PhpNode } from '../../../packages/php-wasm/PhpNode.mjs';
import { env } from 'node:process';
test('Zip Extension is enabled.', async () => {
const php = env.WITH_LIBZIP === 'dynamic'
? new PhpNode({sharedLibs:[`php${PhpNode.phpVersion}-zip.so`]})
: new PhpNode;
let stdOut = '', stdErr = '';
php.addEventListener('output', (event) => event.detail.forEach(line => void (stdOut += line)));
php.addEventListener('error', (event) => event.detail.forEach(line => void (stdErr += line)));
await php.binary;
const exitCode = await php.run(`<?php var_dump(extension_loaded('zip'));`);
assert.equal(exitCode, 0);
assert.equal(stdOut, `bool(true)\n`);
assert.equal(stdErr, '');
});