diff --git a/Dockerfile b/Dockerfile index cdb9cb2..5dce418 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ COPY ./app /usr/src/app RUN apk add --no-cache --virtual .gyp \ python \ make \ + php7 \ + php7-json \ g++ RUN cd /usr/src/app && \ diff --git a/app/templating/PhpEngine.js b/app/templating/PhpEngine.js new file mode 100644 index 0000000..ca9d094 --- /dev/null +++ b/app/templating/PhpEngine.js @@ -0,0 +1,45 @@ +const BaseEngine = require('./BaseEngine'); +const { spawnSync } = require('child_process'); +const path = require('path'); + +const type = 'php'; + +module.exports = class PhpEngine extends BaseEngine { + static get type() { + return type; + } + + getType() { + return type; + } + + render({bodyFilePath, body, endpoint, request, context }) { + const mockservr = JSON.stringify({ + request: { + url: request.url, + path: request.path, + method: request.method, + headers: request.headers, + query: request.query + }, + endpoint, + context + }); + const bodyFilePathDirname = path.dirname(bodyFilePath); + const absoluteBodyFilePath = path.resolve(bodyFilePath); + const phpRoot = `