From de74585831add2bb884f5b48a56799c5f50a98f4 Mon Sep 17 00:00:00 2001
From: Liam Morland <lkmorlan@uwaterloo.ca>
Date: Mon, 1 Jun 2020 13:57:56 -0400
Subject: [PATCH] ISTWCMS-2220: Add testing script

---
 run-tests.php | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 run-tests.php

diff --git a/run-tests.php b/run-tests.php
new file mode 100644
index 000000000..33da3c294
--- /dev/null
+++ b/run-tests.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * @file
+ * Wrapper to run WCMS tests with Drupal's run-tests.sh.
+ */
+
+$site_to_test = $_SERVER['argv'][1] ?? NULL;
+if (!$site_to_test || in_array($site_to_test, ['-h', '--help', '-v', '--version'])) {
+  $script = basename($_SERVER['argv'][0]);
+  echo 'Usage: ' . $script . " URL-TO-TEST [ADDITIONAL-ARGUMENTS ...]\n";
+  echo "In Drupal 8, pass the argument --suppress-deprecations.\n";
+  exit;
+}
+
+// Keep copy of original arguments to add to those set by this script.
+$original_argv = $_SERVER['argv'];
+// Remove script name and site URL.
+array_shift($original_argv);
+array_shift($original_argv);
+
+$modules_to_test = [
+  'uw_base_profile',
+];
+
+// Arguments to set when running run-tests.sh.
+$_SERVER['argv'] = [
+  'run-tests.sh',
+  '--verbose',
+  '--color',
+  '--sqlite',
+  '/tmp/drupal/test.sqlite',
+  '--module',
+  implode(',', $modules_to_test),
+  '--url',
+  $site_to_test,
+];
+$_SERVER['argv'] = array_merge($_SERVER['argv'], $original_argv);
+
+// Run the tests.
+require __DIR__ . '/../../core/scripts/' . $_SERVER['argv'][0];
-- 
GitLab