<commit_before><?php

/**
 * Very basic unit test engine which runs phpunit tests.
 *
 * @group unitrun
 */
class PHPUnitTestEngine extends ArcanistBaseUnitTestEngine {

  private $testDuration;

  public function run() {

    $this->results = array();
    $tests = array();
    foreach ($this->getPaths() as $path) {
      $extension = substr($path, strrpos($path, '.'));
      if (!preg_match('#include/(setup|config)|tests|features/#', $path)) {
        if (in_array($extension, array('.inc', '.class', '.php'))) {
          $test = "./tests/" . str_replace(array('.php', '.class', '.inc'), 'Test.php', $path);
          if (file_exists($test)) {
            $tests[$path] = $test;
          } elseif (!preg_match('#tools/|formdefs/#', $path)) {
            $result = new ArcanistUnitTestResult();
            $result->setName("Missing $test");
            $result->setResult(ArcanistUnitTestResult::RESULT_FAIL);
            $result->setUserData("         No tests found for $path");
            $this->results[] = $result;
          }
        }<commit_msg>do not cry if wwwdocs/api scripts have no phpunit tests, they should be tested using Behat or Karma<commit_after><?php

/**
 * Very basic unit test engine which runs phpunit tests.
 *
 * @group unitrun
 */
class PHPUnitTestEngine extends ArcanistBaseUnitTestEngine {

  private $testDuration;

  public function run() {

    $this->results = array();
    $tests = array();
    foreach ($this->getPaths() as $path) {
      $extension = substr($path, strrpos($path, '.'));
      if (!preg_match('#include/(setup|config)|tests|features/#', $path)) {
        if (in_array($extension, array('.inc', '.class', '.php'))) {
          $test = "./tests/" . str_replace(array('.php', '.class', '.inc'), 'Test.php', $path);
          if (file_exists($test)) {
            $tests[$path] = $test;
          } elseif (!preg_match('#tools/|formdefs/|wwwdocs/api#', $path)) {
            $result = new ArcanistUnitTestResult();
            $result->setName("Missing $test");
            $result->setResult(ArcanistUnitTestResult::RESULT_FAIL);
            $result->setUserData("         No tests found for $path");
            $this->results[] = $result;
          }
        }
{'fraction_non_alphanumeric': 0.17747747747747747, 'fraction_numerical': 0.0, 'mean_word_length': 2.726510067114094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '120568', 'n_tokens_mistral': 662, 'n_tokens_neox': 655, 'n_words': 153}