<commit_before><?php
namespace Dispatcher\Tests;

class DispatchableControllerTest extends \PHPUnit_Framework_Testcase
{
    /**
     * @var \Dispatcher\DispatchableController
     */
    private $controller;

    public function test_GET_OnRequestWithSimpleControllerStub_ShouldReturn200ResponseWithIndexViews()
    {
        $requestMock = $this->getMock('Dispatcher\\HttpRequestInterface');
        $ctrl = $this->getMockForAbstractClass(
            'Dispatcher\\DispatchableController',
            array(),
            '',
            true,
            true,
            true,
            array('getViews'));
        $ctrl->expects($this->once())
            ->method('getViews')
            ->will($this->returnValue(array('index')));

        $response = $ctrl->get($requestMock);

        $this->assertEquals(200, $response->getStatusCode());
        $this->assertContains('index', $response->getViews());
    }
}<commit_msg>Added test case for DispatchableControllerTest.php<commit_after><?php
namespace Dispatcher\Tests;

class DispatchableControllerTest extends \PHPUnit_Framework_Testcase
{
    /**
     * @var \Dispatcher\DispatchableController
     */
    private $controller;

    public function test_GET_OnRequest_ShouldReturn200ResponseWithIndexViews()
    {
        $requestMock = $this->getMock('Dispatcher\\HttpRequestInterface');
        $ctrl = $this->getMockForAbstractClass(
            'Dispatcher\\DispatchableController',
            array(),
            '',
            true,
            true,
            true,
            array('getViews'));
        $ctrl->expects($this->once())
            ->method('getViews')
            ->will($this->returnValue(array('index')));

        $response = $ctrl->get($requestMock);

        $this->assertEquals(200, $response->getStatusCode());
        $this->assertContains('index', $response->getViews());
    }

    public function test_doDispatch_OnInvalidRequestMethod_ShouldReturnError404()
    {
        $requestMock = $this->getMock('Dispatcher\\HttpRequest',
            array('getMethod'));
        $requestMock->expects($this->any())
            ->method('getMethod')
            ->will($this->returnValue('SOMETHING'));

        $ctrl = $this->getMockForAbstractClass(
            'Dispatcher\\DispatchableController',
            array(),
            '',
            true,
            true,
            true,
            array('getViews'));
        $ctrl->expects($this->never())
            ->method('getViews')
            ->will($this->returnValue(array('index')));

        $response = $ctrl->doDispatch($requestMock, array(), true);
        $this->assertEquals(404, $response->getStatusCode());
    }
}
{'fraction_non_alphanumeric': 0.14408041697691734, 'fraction_numerical': 0.006701414743112435, 'mean_word_length': 2.4715762273901807, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 42, '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': '1688087', 'n_tokens_mistral': 710, 'n_tokens_neox': 686, 'n_words': 96}