run-tests.php 1.07 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
<?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";
13
  echo "(The argument is not needed for Drupal 9.)\n";
14
  exit(1);
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

// 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];