<commit_before><?php

namespace Chief;

class ChiefTest extends ChiefTestCase
{
    public function testInstantiable()
    {
        $this->assertTrue(new Chief instanceof CommandBus);
    }

    public function testExecuteFiresHandlerAttachedByInstance()
    {
        $chief = new Chief();
        $chief->pushHandler('Chief\ChiefTestCommandStub', new ChiefTestCommandStubHandler);
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }

    public function testExecuteFiresHandlerAttachedByCallable()
    {
        $chief = new Chief();
        $chief->pushHandler('Chief\ChiefTestCommandStub', function (Command $command) {
            $command->handled = true;
        });
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }

    public function testExecuteFiresHandlerAttachedByString()
    {
        $chief = new Chief();
        $chief->pushHandler('Chief\ChiefTestCommandStub', 'Chief\ChiefTestCommandStubHandler');
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }
}

class ChiefTestCommandStub implements Command {}
class ChiefTestCommandStubHandler implements CommandHandler
{
    /**
     * Handle a command execution
     *
     * @param Command $command
     * @return mixed
     */
    public function handle(Command $command)
    {
        $command->handled = true;
    }

}<commit_msg>Added failing test for executing a handler by auto resolution<commit_after><?php

namespace Chief;

class ChiefTest extends ChiefTestCase
{
    public function testInstantiable()
    {
        $this->assertTrue(new Chief instanceof CommandBus);
    }

    public function testExecuteFiresHandlerAttachedByInstance()
    {
        $chief = new Chief();
        $chief->pushHandler('Chief\ChiefTestCommandStub', new ChiefTestCommandStubHandler);
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }

    public function testExecuteFiresHandlerAttachedByCallable()
    {
        $chief = new Chief();
        $chief->pushHandler('Chief\ChiefTestCommandStub', function (Command $command) {
            $command->handled = true;
        });
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }

    public function testExecuteFiresHandlerAttachedByString()
    {
        $chief = new Chief();
        $chief->pushHandler('Chief\ChiefTestCommandStub', 'Chief\ChiefTestCommandStubHandler');
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }

    public function testExecuteFiresByAutoResolution()
    {
        $chief = new Chief();
        $command = new ChiefTestCommandStub;
        $chief->execute($command);
        $this->assertEquals($command->handled, true);
    }
}

class ChiefTestCommandStub implements Command {}
class ChiefTestCommandStubHandler implements CommandHandler
{
    /**
     * Handle a command execution
     *
     * @param Command $command
     * @return mixed
     */
    public function handle(Command $command)
    {
        $command->handled = true;
    }
}
{'fraction_non_alphanumeric': 0.11052477279390208, 'fraction_numerical': 0.0, 'mean_word_length': 3.0283353010625738, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '1833691', 'n_tokens_mistral': 920, 'n_tokens_neox': 899, 'n_words': 189}