<commit_before>Feature: Developer is notified of which scenario caused a fatal error
  As a Developer
  I want to know in which scenario or example my script was running
  So that I can better trace where my changes caused a fatal error

  @isolated
  Scenario: Spec attempts to call an undeclared function and outputs to stdout
    Given the spec file "spec/Message/Fatal/FatalSpec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class FatalSpec extends ObjectBehavior
      {
          function it_fatals_when_calling_an_undeclared_function()
          {
              anything();
          }
      }

      """
    And the class file "src/Message/Fatal/Fatal.php" contains:
      """
      <?php

      namespace Message\Fatal;

      class Fatal
      {
          public function __construct($param)
          {
              if ($param == 'throw') {
                  throw new \Exception();
              }
          }
      }

      """
    When I run phpspec
    Then I should see "Fatal error happened while executing the following"
    And  I should see "it fatals when calling an undeclared function"

  @isolated @php-version @php5.3 @php5.4 @php5.5 @php5.6 @php7
  Scenario: Fatal error writer message not shown, when formatter does not support it, outputs to stderr.
    Given the spec file "spec/Message/Fatal/Fatal2Spec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class Fatal2Spec extends ObjectBehavior
      {
          function it_fatals_when_calling_an_undeclared_function()
          {
              anything();
          }
      }

      """
    And the class file "src/Message/Fatal/Fatal2.php" contains:
      """
      <?php

      namespace Message\Fatal;

      class Fatal2
      {
          public function __construct($param)
          {
              if ($param == 'throw') {
                  throw new \Exception();
              }
          }
      }

      """
    When I run phpspec with the "junit" formatter
    Then I should see "Call to undefined function"

  @isolated @hhvm
  Scenario: Fatal error writer message not shown, when formatter does not support it, outputs to stdout for hhvm.
    Given the spec file "spec/Message/Fatal/Fatal2Spec.php" contains:
    """
      <?php

      namespace spec\Message\Fatal;

      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class Fatal2Spec extends ObjectBehavior
      {
          function it_fatals_when_calling_an_undeclared_function()
          {
              anything();
          }
      }

      """
    And the class file "src/Message/Fatal/Fatal2.php" contains:
    """
      <?php

      namespace Message\Fatal;

      class Fatal2
      {
          public function __construct($param)
          {
              if ($param == 'throw') {
                  throw new \Exception();
              }
          }
      }

      """
    When I run phpspec with the "junit" formatter on hhvm
    Then I should see "Call to undefined function"<commit_msg>Fix string spacing issue in behat, preventing correct file creation<commit_after>Feature: Developer is notified of which scenario caused a fatal error
  As a Developer
  I want to know in which scenario or example my script was running
  So that I can better trace where my changes caused a fatal error

  @isolated
  Scenario: Spec attempts to call an undeclared function and outputs to stdout
    Given the spec file "spec/Message/Fatal/FatalSpec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class FatalSpec extends ObjectBehavior
      {
          function it_fatals_when_calling_an_undeclared_function()
          {
              anything();
          }
      }

      """
    And the class file "src/Message/Fatal/Fatal.php" contains:
      """
      <?php

      namespace Message\Fatal;

      class Fatal
      {
          public function __construct($param)
          {
              if ($param == 'throw') {
                  throw new \Exception();
              }
          }
      }

      """
    When I run phpspec
    Then I should see "Fatal error happened while executing the following"
    And  I should see "it fatals when calling an undeclared function"

  @isolated @php-version @php5.3 @php5.4 @php5.5 @php5.6 @php7
  Scenario: Fatal error writer message not shown, when formatter does not support it, outputs to stderr.
    Given the spec file "spec/Message/Fatal/Fatal2Spec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class Fatal2Spec extends ObjectBehavior
      {
          function it_fatals_when_calling_an_undeclared_function()
          {
              anything();
          }
      }

      """
    And the class file "src/Message/Fatal/Fatal2.php" contains:
      """
      <?php

      namespace Message\Fatal;

      class Fatal2
      {
          public function __construct($param)
          {
              if ($param == 'throw') {
                  throw new \Exception();
              }
          }
      }

      """
    When I run phpspec with the "junit" formatter
    Then I should see "Call to undefined function"
  
	@isolated @php-version @hhvm
  Scenario: Fatal error writer message not shown, when formatter does not support it, outputs to stdout for hhvm.
    Given the spec file "spec/Message/Fatal/FatalHhvmSpec.php" contains:
      """
      <?php

      namespace spec\Message\Fatal;

      use PhpSpec\ObjectBehavior;
      use Prophecy\Argument;

      class FatalHhvmSpec extends ObjectBehavior
      {
          function it_fatals_when_calling_an_undeclared_function()
          {
              anything();
          }
      }

      """
    And the class file "src/Message/Fatal/FatalHhvm.php" contains:
      """
      <?php

      namespace Message\Fatal;

      class FatalHhvm
      {
          public function __construct($param)
          {
              if ($param == 'throw') {
                  throw new \Exception();
              }
          }
      }

      """
    When I run phpspec with the "junit" formatter on hhvm
    Then I should see "Call to undefined function"
{'fraction_non_alphanumeric': 0.07667083073079325, 'fraction_numerical': 0.004684572142410993, 'mean_word_length': 1.8683385579937304, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '264162', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1707, 'n_words': 561}