CRM-15011 - Add phpunit.xml and bootstrap.php
authorTim Otten <totten@civicrm.org>
Tue, 22 Jul 2014 07:45:34 +0000 (00:45 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 7 Aug 2014 19:08:01 +0000 (12:08 -0700)
phpunit.xml.dist [new file with mode: 0644]
tests/phpunit/CiviTest/bootstrap.php [new file with mode: 0644]

diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644 (file)
index 0000000..fb7ae22
--- /dev/null
@@ -0,0 +1,27 @@
+<phpunit backupGlobals="false"
+         backupStaticAttributes="false"
+         colors="true"
+         convertErrorsToExceptions="true"
+         convertNoticesToExceptions="true"
+         convertWarningsToExceptions="true"
+         processIsolation="false"
+         stopOnFailure="false"
+         syntaxCheck="false"
+         beStrictAboutTestsThatDoNotTestAnything="false"
+         bootstrap="tests/phpunit/CiviTest/bootstrap.php"
+>
+  <testsuites>
+    <testsuite name="CiviCRM Test Suite">
+      <directory>./tests/phpunit/</directory>
+    </testsuite>
+  </testsuites>
+
+  <filter>
+    <whitelist>
+      <directory suffix=".php">./CRM</directory>
+      <directory suffix=".php">./Civi</directory>
+      <directory suffix=".php">./api</directory>
+    </whitelist>
+  </filter>
+</phpunit>
+
diff --git a/tests/phpunit/CiviTest/bootstrap.php b/tests/phpunit/CiviTest/bootstrap.php
new file mode 100644 (file)
index 0000000..f32f6a4
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+// ADAPTED FROM tools/scripts/phpunit
+
+$GLOBALS['base_dir'] = dirname(dirname(dirname(__DIR__)));
+$tests_dir = $GLOBALS['base_dir']  . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'phpunit';
+$civi_pkgs_dir = $GLOBALS['base_dir'] .   DIRECTORY_SEPARATOR . 'packages';
+ini_set('safe_mode', 0);
+ini_set('include_path',
+        "{$GLOBALS['base_dir']}" . PATH_SEPARATOR .
+        "$tests_dir"            . PATH_SEPARATOR .
+        "$civi_pkgs_dir"        . PATH_SEPARATOR
+        . ini_get( 'include_path') );
+
+#  Relying on system timezone setting produces a warning,
+#  doing the following prevents the warning message
+if ( file_exists( '/etc/timezone' ) ) {
+    $timezone = trim( file_get_contents( '/etc/timezone' ) );
+    if ( ini_set('date.timezone', $timezone ) === false ) {
+        echo "ini_set( 'date.timezone', '$timezone' ) failed\n";
+    }
+}
+
+# Crank up the memory
+ini_set('memory_limit', '2G');
+
+require_once $GLOBALS['base_dir'] . '/packages/vendor/autoload.php';
+
+/*
+require $GLOBALS['base_dir'] . DIRECTORY_SEPARATOR .
+        'packages' . DIRECTORY_SEPARATOR .
+        'PHPUnit' . DIRECTORY_SEPARATOR .
+        'Autoload.php';
+*/
\ No newline at end of file