<commit_before><?php

use represent\builder\GenericRepresentationBuilder;
use represent\tests\fixtures\ParentTest;

class GenericRepresentationBuilderTest extends \PHPUnit_Framework_TestCase
{
    public function testBuildObjectRepresentationSimple()
    {
        $parent  = new ParentTest('first', 'last', 20, 'public');
        $builder = new GenericRepresentationBuilder();
        $result  = $builder->buildObjectRepresentation($parent);

        $expected = array(
            'firstName'  => 'first',
            'lastName'   => 'last',
            'age'        => 20,
            'publicTest' => 'public',
            'children'   => array()
        );

        $this->assertEquals($expected, $result);
    }

    public function testBuildObjectRepresentationWithChildren()
    {
        $parent = new ParentTest('first', 'last', 20, 'public');
        $parent->addChild(new \represent\tests\fixtures\ChildTest('first', 'last'));

        $builder = new GenericRepresentationBuilder();
        $result  = $builder->buildObjectRepresentation($parent);

        $expected = array(
            'firstName' => 'first',
            'lastName'  => 'last',
            'age'       => 20,
            'publicTest'=> 'public',
            'children'  => array(
                0 => array(
                    'firstName' => 'first',
                    'lastName'  => 'last'
                )
            )
        );

        $this->assertEquals($expected, $result);
    }
}<commit_msg>add test to handle nested arrays. Aparently they already worked<commit_after><?php

use represent\builder\GenericRepresentationBuilder;
use represent\tests\fixtures\ParentTest;

class GenericRepresentationBuilderTest extends \PHPUnit_Framework_TestCase
{
    public function testBuildObjectRepresentationSimple()
    {
        $parent  = new ParentTest('first', 'last', 20, 'public');
        $builder = new GenericRepresentationBuilder();
        $result  = $builder->buildObjectRepresentation($parent);

        $expected = array(
            'firstName'  => 'first',
            'lastName'   => 'last',
            'age'        => 20,
            'publicTest' => 'public',
            'children'   => array()
        );

        $this->assertEquals($expected, $result);
    }

    public function testBuildObjectRepresentationWithChildren()
    {
        $parent = new ParentTest('first', 'last', 20, 'public');
        $parent->addChild(new \represent\tests\fixtures\ChildTest('first', 'last'));

        $builder = new GenericRepresentationBuilder();
        $result  = $builder->buildObjectRepresentation($parent);

        $expected = array(
            'firstName' => 'first',
            'lastName'  => 'last',
            'age'       => 20,
            'publicTest'=> 'public',
            'children'  => array(
                0 => array(
                    'firstName' => 'first',
                    'lastName'  => 'last'
                )
            )
        );

        $this->assertEquals($expected, $result);
    }

    public function testBuildObjectRepresentationWithNormalArray()
    {
        $parent = new ParentTest('first', 'last', 20, array(1,2,array(3,4)));
        $parent->addChild(new \represent\tests\fixtures\ChildTest('first', 'last'));

        $builder = new GenericRepresentationBuilder();
        $result  = $builder->buildObjectRepresentation($parent);

        $expected = array(
            'firstName' => 'first',
            'lastName'  => 'last',
            'age'       => 20,
            'publicTest' => array(
                1,
                2,
                array(
                    3,4
                ),
            ),
            'children' => array(
                0 => array(
                    'firstName' => 'first',
                    'lastName'  => 'last'
                )
            )

        );

        $this->assertEquals($expected, $result);
    }
}
{'fraction_non_alphanumeric': 0.13653796982868832, 'fraction_numerical': 0.007926361544362055, 'mean_word_length': 1.8680351906158357, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, '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': '5831308', 'n_tokens_mistral': 1051, 'n_tokens_neox': 998, 'n_words': 198}