<commit_before><?php

namespace MrClean\Test;

class CleanKeysTest extends TestCase
{

    /** @test */

    public function it_can_clean_only_one_key()
    {
        $result = $this->cleaner->cleaners(['name' => ['trim']])
                            ->scrub([
                                'name' => ' Joe',
                                'job'  => ' Developer'
                            ]);

        $scrubbed = [
                        'name' => 'Joe',
                        'job'  => ' Developer'
                    ];

        $this->assertSame($scrubbed, $result);
    }

    /** @test */

    public function it_can_clean_several_keys()
    {
        $result = $this->cleaner->cleaners([
                                        'name' => ['trim'],
                                        'job'  => ['htmlentities'],
                                    ])
                            ->scrub([
                                'name' => ' Joe',
                                'job'  => ' Developer & Such'
                            ]);

        $scrubbed = [
                        'name' => 'Joe',
                        'job'  => ' Developer &amp; Such'
                    ];

        $this->assertSame($scrubbed, $result);
    }

    /** @test */

    public function it_can_clean_several_keys_in_an_object()
    {
        $result = $this->cleaner->cleaners([
                                        'name' => ['trim'],
                                        'job'  => ['htmlentities'],
                                    ])
                            ->scrub((object) [
                                'name' => ' Joe',
                                'job'  => ' Developer & Such'
                            ]);

        $scrubbed = (object) [
                        'name' => 'Joe',
                        'job'  => ' Developer &amp; Such'
                    ];

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

    /** @test */

    public function it_can_run_cleaners_on_all_and_specific_keys()
    {
        $result = $this->cleaner->cleaners([
        								'strip_tags',
                                        'name' => ['trim'],
                                        'job'  => ['htmlentities'],
                                    ])
                            ->scrub([
                                'name' => ' <strong>Joe</strong>',
                                'job'  => ' <em>Developer</em> & Such'
                            ]);

        $scrubbed = [
                        'name' => 'Joe',
                        'job'  => ' Developer &amp; Such'<commit_msg>fixed up some spacing<commit_after><?php

namespace MrClean\Test;

class CleanKeysTest extends TestCase
{

    /** @test */

    public function it_can_clean_only_one_key()
    {
        $result = $this->cleaner->cleaners(['name' => ['trim']])
                                ->scrub([
                                    'name' => ' Joe',
                                    'job'  => ' Developer'
                                ]);

        $scrubbed = [
                        'name' => 'Joe',
                        'job'  => ' Developer'
                    ];

        $this->assertSame($scrubbed, $result);
    }

    /** @test */

    public function it_can_clean_several_keys()
    {
        $result = $this->cleaner->cleaners([
                                        'name' => ['trim'],
                                        'job'  => ['htmlentities'],
                                    ])
                                    ->scrub([
                                        'name' => ' Joe',
                                        'job'  => ' Developer & Such'
                                    ]);

        $scrubbed = [
                        'name' => 'Joe',
                        'job'  => ' Developer &amp; Such'
                    ];

        $this->assertSame($scrubbed, $result);
    }

    /** @test */

    public function it_can_clean_several_keys_in_an_object()
    {
        $result = $this->cleaner->cleaners([
                                        'name' => ['trim'],
                                        'job'  => ['htmlentities'],
                                    ])
                                    ->scrub((object) [
                                        'name' => ' Joe',
                                        'job'  => ' Developer & Such'
                                    ]);

        $scrubbed = (object) [
                        'name' => 'Joe',
                        'job'  => ' Developer &amp; Such'
                    ];

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

    /** @test */

    public function it_can_run_cleaners_on_all_and_specific_keys()
    {
        $result = $this->cleaner->cleaners([
        								'strip_tags',
                                        'name' => ['trim'],
                                        'job'  => ['htmlentities'],
                                    ])
                                    ->scrub([
                                        'name' => ' <strong>Joe</strong>',
                                        'job'  => ' <em>Developer</em> & Such'
                                    ]);

        $scrubbed = [
                        'name' => 'Joe',
                        'job'  => ' Developer &amp; Such'
{'fraction_non_alphanumeric': 0.13248976553777447, 'fraction_numerical': 0.0, 'mean_word_length': 0.7530984996738421, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 48, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '627054', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1219, 'n_words': 204}