<commit_before><?php

class GracefulDeathTest extends GracefulDeathBaseTest
{
    public function setUp()
    {
        $this->catched = null;
    }

    public function testAfterViolentDeathWillCatchAViolentDeath()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->afterViolentDeath(function($status) {
            $this->catched = 'Catched';
        })
        ->run();

        $this->assertEquals('Catched', $this->catched);
    }

    public function testAfterNaturalDeathWillCatchANaturalDeath()
    {
        GracefulDeath::around(function() {
            $this->doSomethingUnharmful();
        })
        ->afterNaturalDeath(function($status) {
            $this->catched = 'Catched';
        })
        ->run();

        $this->assertEquals('Catched', $this->catched);
    }

    public function testAfterDeathWillCatchANaturalDeath()
    {
        GracefulDeath::around(function() {
            $this->doSomethingUnharmful();
        })
        ->afterDeath(function($status) {
            $this->catched = 'Catched';
        })
        ->run();

        $this->assertEquals('Catched', $this->catched);
    }

    public function testAfterDeathWillCatchAViolentDeath()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->afterDeath(function($status) {
            $this->catched = 'Catched';
        })
        ->run();

        $this->assertEquals('Catched', $this->catched);
    }

    public function testSayGoodbyeToYourLovedOnceIsAnAlisOfAfterDeathIfYouWhatToBeFunny()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->sayGoodbyeToYourLovedOnce(function($status) {
            $this->catched = 'Catched';
        })
        ->run();

        $this->assertEquals('Catched', $this->catched);
    }

    public function testByDefaultAViolentDeathIsIgnored()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->run();
    }

    public function testByDefaultANaturalDeathIsIgnored()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->run();
    }

    public function testAroundWillReturnWhatIsReturnedByTheDeathHandler()
    {
        $result = GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->afterDeath(function() {
            return '<NAME>';
        })
        ->run();

        $this->assertEquals('<NAME>', $result);
    }

    public function testAroundByDefaultReturnsNull()
    {
        $result = GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->run();

        $this->assertNull($result);
    }
}
<commit_msg>As suggested catched -> caught<commit_after><?php

class GracefulDeathTest extends GracefulDeathBaseTest
{
    public function setUp()
    {
        $this->caught = null;
    }

    public function testAfterViolentDeathWillCatchAViolentDeath()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->afterViolentDeath(function($status) {
            $this->caught = 'Caught';
        })
        ->run();

        $this->assertEquals('Caught', $this->caught);
    }

    public function testAfterNaturalDeathWillCatchANaturalDeath()
    {
        GracefulDeath::around(function() {
            $this->doSomethingUnharmful();
        })
        ->afterNaturalDeath(function($status) {
            $this->caught = 'Caught';
        })
        ->run();

        $this->assertEquals('Caught', $this->caught);
    }

    public function testAfterDeathWillCatchANaturalDeath()
    {
        GracefulDeath::around(function() {
            $this->doSomethingUnharmful();
        })
        ->afterDeath(function($status) {
            $this->caught = 'Caught';
        })
        ->run();

        $this->assertEquals('Caught', $this->caught);
    }

    public function testAfterDeathWillCatchAViolentDeath()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->afterDeath(function($status) {
            $this->caught = 'Caught';
        })
        ->run();

        $this->assertEquals('Caught', $this->caught);
    }

    public function testSayGoodbyeToYourLovedOnceIsAnAlisOfAfterDeathIfYouWhatToBeFunny()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->sayGoodbyeToYourLovedOnce(function($status) {
            $this->caught = 'Caught';
        })
        ->run();

        $this->assertEquals('Caught', $this->caught);
    }

    public function testByDefaultAViolentDeathIsIgnored()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->run();
    }

    public function testByDefaultANaturalDeathIsIgnored()
    {
        GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->run();
    }

    public function testAroundWillReturnWhatIsReturnedByTheDeathHandler()
    {
        $result = GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->afterDeath(function() {
            return '<NAME>';
        })
        ->run();

        $this->assertEquals('<NAME>', $result);
    }

    public function testAroundByDefaultReturnsNull()
    {
        $result = GracefulDeath::around(function() {
            $this->raiseFatalError();
        })
        ->run();

        $this->assertNull($result);
    }
}

{'fraction_non_alphanumeric': 0.14255167498218105, 'fraction_numerical': 0.0, 'mean_word_length': 2.135754189944134, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 92, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5655333', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1569, 'n_words': 197}