Skip to content

🎥 Make videos programmatically with React

add test

Alex Fernandezdbed02ae551e
diff --git a/packages/it-tests/src/lambda/php-package.test.ts b/packages/it-tests/src/lambda/php-package.test.ts
new file mode 100644
index 0000000000..ee202c0221
--- /dev/null
+++ b/packages/it-tests/src/lambda/php-package.test.ts
@@ -0,0 +1,43 @@
+import { execSync } from "child_process";
+import { readFileSync, writeFileSync } from "fs";
+import path from "path";
+import { expect, test } from "vitest";
+import { LambdaInternals } from "@remotion/lambda";
+
+test("Set the right version for phpunit", () => {
+ const referenceVersion = readFileSync(
+ path.join(process.cwd(), "..", "core", "package.json"),
+ "utf-8"
+ );
+
+ const referenceVersionJson = JSON.parse(referenceVersion);
+ const version = referenceVersionJson.version;
+ expect(typeof version).toBe("string");
+
+ const VERSION = `<?php \nnamespace remotion;\n\nconst VERSION = "${version};"`;
+ writeFileSync(
+ path.join(process.cwd(), "..", "lambda-php", "Version.php"),
+ VERSION
+ );
+});
+
+test("PHP package should create the same payload as normal Lambda package", async () => {
+ const phpOutput = execSync("phpunit ./src/PHPClientTest.php", {
+ cwd: path.join(process.cwd(), "..", "lambda-php"),
+ });
+ const firstLine = phpOutput.toString().split("\n")[4];
+ expect(firstLine.substring(0, firstLine.indexOf("R"))).toEqual(`{"data":""}`);
+
+ const nativeVersion = await LambdaInternals.makeLambdaPayload({
+ region: "us-east-1",
+ composition: "react-svg",
+ functionName: "remotion-render",
+ serveUrl: "testbed",
+ codec: "h264",
+ });
+
+ //const parsed = JSON.parse(firstLine);
+ /*
+
+ expect(parsed).toEqual(nativeVersion); */
+});
diff --git a/packages/lambda-php/Version.php b/packages/lambda-php/Version.php
new file mode 100644
index 0000000000..7bfbf5c920
--- /dev/null
+++ b/packages/lambda-php/Version.php
@@ -0,0 +1,4 @@
+<?php
+namespace remotion;
+
+const VERSION = "3.3.90;"
\ No newline at end of file
diff --git a/packages/lambda-php/src/PHPClientTest.php b/packages/lambda-php/src/PHPClientTest.php
index 139111a9b1..c1f9411ecb 100644
--- a/packages/lambda-php/src/PHPClientTest.php
+++ b/packages/lambda-php/src/PHPClientTest.php
@@ -3,10 +3,13 @@
class PHPClientTest extends PHPUnit\Framework\TestCase
{
- public function testAdd()
+ public function testClient()
{
// $calculator = new Calculator();
//$result = $calculator->add(2, 3);
- $this->assertEquals(5, 5);
+ // $this->assertEquals(5, 5);
+ print(json_encode(array(
+ "data" => "",
+ )));
}
}