<commit_before><?php

namespace Recurrence\tests\units\RruleTransformer;

require_once __DIR__.'/../../../../src/Recurrence/RruleTransformer/FreqTransformer.php';

use atoum;

/**
 * Class FreqTransformer
 * @package Recurrence\tests\units\RruleTransformer
 */
class FreqTransformer extends atoum
{
    /**
     * Failed : Missing frequency value
     */
    public function testMissingValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Failed : Use an invalid frequency value
     */
    public function testInvalidValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=INVALID;DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Success : Use an valid frequency value
     */
    public function testValidValue()
    {
        $frequency = (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=MONTHLY;DTSTART=20170520;INTERVAL=1');

        $this->assert
            ->string((string) $frequency)
            ->isEqualTo('MONTHLY')
        ;
    }
}<commit_msg>Increase code coverage on FrequencyTransformer<commit_after><?php

namespace Recurrence\tests\units\RruleTransformer;

require_once __DIR__.'/../../../../src/Recurrence/RruleTransformer/FreqTransformer.php';

use atoum;

/**
 * Class FreqTransformer
 * @package Recurrence\tests\units\RruleTransformer
 */
class FreqTransformer extends atoum
{
    /**
     * Failed : Missing frequency value
     */
    public function testMissingValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Failed : Use an invalid frequency value, but pattern match on first check
     */
    public function testInvalidValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=INVALID;DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Failed : Use an invalid frequency value, but patter do not match at all
     */
    public function testReallyInvalidValue()
    {
        $this->assert
            ->exception(function () {
                (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=666;DTSTART=20170520;INTERVAL=1');
            })
            ->isInstanceOf('InvalidArgumentException')
        ;
    }

    /**
     * Success : Use an valid frequency value
     */
    public function testValidValue()
    {
        $frequency = (new \Recurrence\RruleTransformer\FreqTransformer())->transform('FREQ=MONTHLY;DTSTART=20170520;INTERVAL=1');

        $this->assert
            ->string((string) $frequency)
            ->isEqualTo('MONTHLY')
        ;
    }
}
{'fraction_non_alphanumeric': 0.12899300273805903, 'fraction_numerical': 0.020079099482811075, 'mean_word_length': 2.3688524590163933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '6814241', 'n_tokens_mistral': 984, 'n_tokens_neox': 921, 'n_words': 145}