From c5d26c27510d1392d529309e4e40e257a265dd9a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 22 Aug 2016 21:59:17 -0700 Subject: [PATCH] E2E_AllTests - Add suite for non-selenium end-to-end testing --- CRM/Core/ClassLoader.php | 2 +- tests/phpunit/E2E/AllTests.php | 58 ++++++++++++++++++++++++++++++++++ tools/scripts/phpunit | 8 +++-- 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 tests/phpunit/E2E/AllTests.php diff --git a/CRM/Core/ClassLoader.php b/CRM/Core/ClassLoader.php index 29af6818ec..cbd3799f29 100644 --- a/CRM/Core/ClassLoader.php +++ b/CRM/Core/ClassLoader.php @@ -181,7 +181,7 @@ class CRM_Core_ClassLoader { if ( // Only load classes that clearly belong to CiviCRM. // Note: api/v3 does not use classes, but api_v3's test-suite does - (0 === strncmp($class, 'CRM_', 4) || 0 === strncmp($class, 'api_v3_', 7) || 0 === strncmp($class, 'WebTest_', 8)) && + (0 === strncmp($class, 'CRM_', 4) || 0 === strncmp($class, 'api_v3_', 7) || 0 === strncmp($class, 'WebTest_', 8) || 0 === strncmp($class, 'E2E_', 4)) && // Do not load PHP 5.3 namespaced classes. // (in a future version, maybe) FALSE === strpos($class, '\\') diff --git a/tests/phpunit/E2E/AllTests.php b/tests/phpunit/E2E/AllTests.php new file mode 100644 index 0000000000..25c02333a5 --- /dev/null +++ b/tests/phpunit/E2E/AllTests.php @@ -0,0 +1,58 @@ +implSuite(__FILE__); + } + +} diff --git a/tools/scripts/phpunit b/tools/scripts/phpunit index 634f2bc386..8f034a2ee0 100755 --- a/tools/scripts/phpunit +++ b/tools/scripts/phpunit @@ -32,18 +32,20 @@ chdir(dirname(dirname(__DIR__))); // civicrm-core root dir array_shift($argv); // Convert class names to file names +$CIVICRM_UF = 'UnitTests'; foreach ($argv as $k => $v) { - if (preg_match('/^(CRM_|api_v3_|EnvTest|WebTest_)/', $v)) { + if (preg_match('/^(CRM_|api_v3_|EnvTest|WebTest_|E2E_)/', $v)) { $argv[$k] = 'tests/phpunit/' . strtr($v, '_', '/') . '.php'; } elseif (preg_match('/^Civi\\\\/', $v)) { $argv[$k] = 'tests/phpunit/' . strtr($v, '\\', '/') . '.php'; } - if (!preg_match('/^(WebTest)/', $v)) { - putenv('CIVICRM_UF=UnitTests'); + if (preg_match('/^(WebTest|E2E)/', $v)) { + $CIVICRM_UF=''; } } +putenv("CIVICRM_UF=$CIVICRM_UF"); // Transition: Make sure we use phpunit code from PATH, not // civicrm-packages. This will be unnecessary once civicrm-packages is -- 2.25.1