<commit_before><?php

namespace spec\Coduo\PHPHumanizer;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DateTimeSpec extends ObjectBehavior
{
    function it_humanize_difference_between_dates()
    {
        $examples = array(
            array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'just now'),
            array("2014-04-26 13:00:00", "2014-04-26 13:00:05", '5 seconds from now'),
            array("2014-04-26 13:00:00", "2014-04-26 12:59:00", '1 minute ago'),
            array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minutes ago'),
            array("2014-04-26 13:00:00", "2014-04-26 13:15:00", '15 minutes from now'),
            array("2014-04-26 13:00:00", "2014-04-26 14:00:00", '1 hour from now'),
            array("2014-04-26 13:00:00", "2014-04-26 15:00:00", '2 hours from now'),
            array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 hour ago'),
            array("2014-04-26", "2014-04-25", '1 day ago'),
            array("2014-04-26", "2014-04-24", '2 days ago'),
            array("2014-04-26", "2014-04-28", '2 days from now'),
            array("2014-04-01", "2014-04-15", '2 weeks from now'),
            array("2014-04-15", "2014-04-07", '1 week ago'),
            array("2014-01-01", "2014-04-01", '3 months from now'),
            array("2014-05-01", "2014-04-01", '1 month ago'),
            array("2015-05-01", "2014-04-01", '1 year ago'),
            array("2014-05-01", "2016-04-01", '2 years from now'),
        );

        foreach ($examples as $example) {
            $this->difference(new \DateTime($example[0]), new \DateTime($example[1]))->shouldReturn($example[2]);
        }
    }

    function it_humanize_difference_between_dates_for_pl_locale()
    {
        $examples = array(
            array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'w tym momencie'),
            array("2014-04-26 13:00:00", "2014-04-26 13:00:05", 'za 5 sekund'),
            array("2014-04-26 13:00:00", "2014-04-26 12:59:00", 'minutę temu'),
            array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minut temu'),
            array("2014-04-26 13:00:00", "2014-04-26 13:15:00", 'za 15 minut'),
            array("2014-04-26 13:00:00", "2014-04-26 14:00:00", 'za godzinę'),
            array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'za 2 godziny'),
            array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'godzinę temu'),
            array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'za 2 godziny'),
            array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'godzinę temu'),
            array("2014-04-26", "2014-04-25", 'wczoraj'),
            array("2014-04-26", "2014-04-24", '2 dni temu'),
            array("2014-04-26", "2014-04-28", 'za 2 dni'),
            array("2014-04-01", "2014-04-15", 'za 2 tygodnie'),
            array("2014-04-15", "2014-04-07", 'tydzień temu'),
            array("2014-01-01", "2014-04-01", 'za 3 miesiące'),
            array("2014-05-01", "2014-04-01", 'miesiąc temu'),
            array("2015-05-01", "2014-04-01", 'rok temu'),
            array("2014-05-01", "2016-04-01", 'za 2 lata'),
            array("2014-05-01", "2009-04-01", '5 lat temu'),
        );

        foreach ($examples as $example) {
            $this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'pl')->shouldReturn($example[2]);
        }
    }

    function it_humanizes_precise_difference_between_dates()
    {
        $examples = array(
            array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minute, 45 seconds ago'),
            array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 hour, 40 minutes ago'),
            array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 day, 15 minutes from now'),
            array("2014-04-26 13:00:00", "2014-05-26 17:00:00", '1 month, 4 hours from now'),
            array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 year, 1 week, 4 days, 4 hours from now'),
            array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 days, 10 hours from now'),
            array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 day, 1 hour, 40 minutes ago'),
            array("2014-04-26 13:00:00", "2014-03-25 11:20:00", '1 month, 2 days, 40 minutes ago'),
            array("2014-04-26 13:00:00", "2014-01-25 11:20:00", '3 months, 1 day, 40 minutes ago'),
        );
<commit_msg>Updating specs<commit_after><?php

namespace spec\Coduo\PHPHumanizer;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DateTimeSpec extends ObjectBehavior
{
    function it_humanize_difference_between_dates()
    {
        $examples = array(
            array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'just now'),
            array("2014-04-26 13:00:00", "2014-04-26 13:00:05", '5 seconds from now'),
            array("2014-04-26 13:00:00", "2014-04-26 12:59:00", '1 minute ago'),
            array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minutes ago'),
            array("2014-04-26 13:00:00", "2014-04-26 13:15:00", '15 minutes from now'),
            array("2014-04-26 13:00:00", "2014-04-26 14:00:00", '1 hour from now'),
            array("2014-04-26 13:00:00", "2014-04-26 15:00:00", '2 hours from now'),
            array("2014-04-26 13:00:00", "2014-04-26 12:00:00", '1 hour ago'),
            array("2014-04-26", "2014-04-25", '1 day ago'),
            array("2014-04-26", "2014-04-24", '2 days ago'),
            array("2014-04-26", "2014-04-28", '2 days from now'),
            array("2014-04-01", "2014-04-15", '2 weeks from now'),
            array("2014-04-15", "2014-04-07", '1 week ago'),
            array("2014-01-01", "2014-04-01", '3 months from now'),
            array("2014-05-01", "2014-04-01", '1 month ago'),
            array("2015-05-01", "2014-04-01", '1 year ago'),
            array("2014-05-01", "2016-04-01", '2 years from now'),
        );

        foreach ($examples as $example) {
            $this->difference(new \DateTime($example[0]), new \DateTime($example[1]))->shouldReturn($example[2]);
        }
    }

    function it_humanize_difference_between_dates_for_pl_locale()
    {
        $examples = array(
            array("2014-04-26 13:00:00", "2014-04-26 13:00:00", 'w tym momencie'),
            array("2014-04-26 13:00:00", "2014-04-26 13:00:05", 'za 5 sekund'),
            array("2014-04-26 13:00:00", "2014-04-26 12:59:00", 'minutę temu'),
            array("2014-04-26 13:00:00", "2014-04-26 12:45:00", '15 minut temu'),
            array("2014-04-26 13:00:00", "2014-04-26 13:15:00", 'za 15 minut'),
            array("2014-04-26 13:00:00", "2014-04-26 14:00:00", 'za godzinę'),
            array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'za 2 godziny'),
            array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'godzinę temu'),
            array("2014-04-26 13:00:00", "2014-04-26 15:00:00", 'za 2 godziny'),
            array("2014-04-26 13:00:00", "2014-04-26 12:00:00", 'godzinę temu'),
            array("2014-04-26", "2014-04-25", 'wczoraj'),
            array("2014-04-26", "2014-04-24", '2 dni temu'),
            array("2014-04-26", "2014-04-28", 'za 2 dni'),
            array("2014-04-01", "2014-04-15", 'za 2 tygodnie'),
            array("2014-04-15", "2014-04-07", 'tydzień temu'),
            array("2014-01-01", "2014-04-01", 'za 3 miesiące'),
            array("2014-05-01", "2014-04-01", 'miesiąc temu'),
            array("2015-05-01", "2014-04-01", 'rok temu'),
            array("2014-05-01", "2016-04-01", 'za 2 lata'),
            array("2014-05-01", "2009-04-01", '5 lat temu'),
        );

        foreach ($examples as $example) {
            $this->difference(new \DateTime($example[0]), new \DateTime($example[1]), 'pl')->shouldReturn($example[2]);
        }
    }

    function it_humanizes_precise_difference_between_dates()
    {
        $examples = array(
            array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minute, 45 seconds ago'),
            array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 hour, 40 minutes ago'),
            array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 day, 15 minutes from now'),
            array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '1 week, 2 hours from now'),
            array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 year, 1 week, 4 days, 4 hours from now'),
            array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 days, 10 hours from now'),
            array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 day, 1 hour, 40 minutes ago'),
        );

{'fraction_non_alphanumeric': 0.21046457062412013, 'fraction_numerical': 0.25692163303613325, 'mean_word_length': 2.451417004048583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7474110', 'n_tokens_mistral': 4544, 'n_tokens_neox': 3152, 'n_words': 687}