<commit_before><?php
namespace Dispatcher\Tests;

class DispatchableResourceTest extends \PHPUnit_Framework_TestCase
{
    public function mockRequest($method)
    {
        $mock = $this->getMock('Dispatcher\\Http\\HttpRequest');
        $mock->expects($this->any())
            ->method('getMethod')
            ->will($this->returnValue($method));
        return $mock;
    }

    /**
     * @test
     */
    public function get_WithNoUriSegments_ShouldCallReadCollectionWithResults()
    {
        $reqMock = $this->mockRequest('GET');

        $controller = $this->getMock('Dispatcher\\DispatchableResource',
            array('readCollection'));
        $controller->expects($this->any())
            ->method('readCollection')
            ->with($this->isInstanceOf(
                'Dispatcher\\Http\\HttpRequestInterface'))
            ->will($this->returnValue(array(
                array('username' => 'someone'), array('username' => 'someoneelse'))));

        $response = $controller->get($reqMock);

        $this->assertEquals(
            '{"meta":{"offset":0,"limit":20,"total":2},"objects":[{"username":"someone"},{"username":"someoneelse"}]}',
            $response->getContent());
    }

    /**
     * @test
     */
    public function get_WithNoUriSegments_ShouldCallReadCollectionWithEmptyResults()
    {
        $reqMock = $this->mockRequest('GET');

        $controller = $this->getMock('Dispatcher\\DispatchableResource',
            array('readCollection'));
        $controller->expects($this->any())
            ->method('readCollection')
            ->with($this->isInstanceOf(
            'Dispatcher\\Http\\HttpRequestInterface'))
            ->will($this->returnValue(array()));

        $response = $controller->get($reqMock);

        $this->assertEquals(
            '{"meta":{"offset":0,"limit":20,"total":0},"objects":[]}',
            $response->getContent());
    }
}<commit_msg>Deleted a useless test case<commit_after><?php
namespace Dispatcher\Tests;

class DispatchableResourceTest extends \PHPUnit_Framework_TestCase
{
    public function mockRequest($method)
    {
        $mock = $this->getMock('Dispatcher\\Http\\HttpRequest');
        $mock->expects($this->any())
            ->method('getMethod')
            ->will($this->returnValue($method));
        return $mock;
    }

    /**
     * @test
     */
    public function get_WithNoUriSegments_ShouldCallReadCollectionWithResults()
    {
        $reqMock = $this->mockRequest('GET');

        $controller = $this->getMock('Dispatcher\\DispatchableResource',
            array('readCollection'));
        $controller->expects($this->any())
            ->method('readCollection')
            ->with($this->isInstanceOf(
                'Dispatcher\\Http\\HttpRequestInterface'))
            ->will($this->returnValue(array(
                array('username' => 'someone'), array('username' => 'someoneelse'))));

        $response = $controller->get($reqMock);

        $this->assertEquals(
            '{"meta":{"offset":0,"limit":20,"total":2},"objects":[{"username":"someone"},{"username":"someoneelse"}]}',
            $response->getContent());
    }
}
{'fraction_non_alphanumeric': 0.17865061767500792, 'fraction_numerical': 0.003801076971808679, 'mean_word_length': 2.724056603773585, 'pattern_counts': {'":': 19, '<': 5, '<?xml version=': 0, '>': 55, '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': '974167', 'n_tokens_mistral': 861, 'n_tokens_neox': 821, 'n_words': 103}