<commit_before><?php
namespace RKA\ContentTypeRenderer\Tests;

use RKA\ContentTypeRenderer\Renderer;
use Zend\Diactoros\Request;
use Zend\Diactoros\Uri;
use Zend\Diactoros\Response;
use Zend\Diactoros\Stream;
use RuntimeException;

class RendererTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Test that a given array is rendered to the correct media type
     *
     * @dataProvider rendererProvider
     */
    public function testRenderer($mediaType, $data, $expectedMediaType, $expectedBody, $defaultMediaType)
    {
        $renderer = new Renderer();
        if ($defaultMediaType) {
            $renderer->setDefaultMediaType($defaultMediaType);
        }

        $request = (new Request())
            ->withUri(new Uri('http://example.com'))
            ->withAddedHeader('Accept', $mediaType);

        $response = new Response();

        $response  = $renderer->render($request, $response, $data);

        $this->assertSame($expectedMediaType, $response->getHeaderLine('Content-Type'));
        $this->assertSame($expectedBody, (string)$response->getBody());
        $this->assertInstanceOf(Stream::class, $response->getBody());
    }<commit_msg>Add serializableClass<commit_after><?php
namespace RKA\ContentTypeRenderer\Tests;

use RKA\ContentTypeRenderer\Renderer;
use Zend\Diactoros\Request;
use Zend\Diactoros\Uri;
use Zend\Diactoros\Response;
use Zend\Diactoros\Stream;
use RuntimeException;

class serializableClass implements \JsonSerializable {
    protected $data;

    public function __construct($data)
    {
        $this->data = $data;
    }

    public function jsonSerialize()
    {
        return $this->data;
    }
}


class RendererTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Test that a given array is rendered to the correct media type
     *
     * @dataProvider rendererProvider
     */
    public function testRenderer($mediaType, $data, $expectedMediaType, $expectedBody, $defaultMediaType)
    {
        $renderer = new Renderer();
        if ($defaultMediaType) {
            $renderer->setDefaultMediaType($defaultMediaType);
        }

        $request = (new Request())
            ->withUri(new Uri('http://<EMAIL>'))
            ->withAddedHeader('Accept', $mediaType);

        $response = new Response();

        $response  = $renderer->render($request, $response, $data);

        $this->assertSame($expectedMediaType, $response->getHeaderLine('Content-Type'));
        $this->assertSame($expectedBody, (string)$response->getBody());
        $this->assertInstanceOf(Stream::class, $response->getBody());
    }
{'fraction_non_alphanumeric': 0.1297443841982959, 'fraction_numerical': 0.0, 'mean_word_length': 3.3558178752107928, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 26, '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': '477565', 'n_tokens_mistral': 742, 'n_tokens_neox': 716, 'n_words': 149}