Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test lowest version of dependencies #9

Merged
merged 4 commits into from
Jul 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
language: php

php:
- 5.3
- 5.4
- 5.5
matrix:
include:
- php: 5.3
env: DEPENDENCIES='low'
- php: 5.3
- php: 5.4
- php: 5.5
- php: 5.6
- php: hhvm
allow_failures:
- env: DEPENDENCIES='low'

before_install:
- composer self-update

install:
- export COMPOSER_ROOT_VERSION=dev-master
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" == "low" ]; then composer update --prefer-lowest; fi;

script:
- composer self-update
- composer update -n --prefer-source
- ./bin/phpspec run -f progress
- ./bin/phpspec run --format=pretty
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#PHP Humanizer

[![Build Status](https://travis-ci.org/coduo/php-humanizer.svg?branch=master)](https://travis-ci.org/coduo/php-humanizer)
[![Total Downloads](https://poser.pugx.org/coduo/php-humanizer/downloads.svg)](https://packagist.org/packages/coduo/php-humanizer)

[![Latest Stable Version](https://poser.pugx.org/coduo/php-humanizer/v/stable)](https://packagist.org/packages/coduo/php-humanizer)
[![Total Downloads](https://poser.pugx.org/coduo/php-humanizer/downloads)](https://packagist.org/packages/coduo/php-humanizer)
[![Latest Unstable Version](https://poser.pugx.org/coduo/php-humanizer/v/unstable)](https://packagist.org/packages/coduo/php-humanizer)
[![License](https://poser.pugx.org/coduo/php-humanizer/license)](https://packagist.org/packages/coduo/php-humanizer)

Humanize values to make them readable for regular people ;)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.1-dev"
}
}
}
17 changes: 17 additions & 0 deletions spec/Coduo/PHPHumanizer/DateTimeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,21 @@ function it_humanizes_precise_difference_between_dates()
}
}

function it_humanizes_precise_difference_between_dates_for_pl_locale()
{
$examples = array(
array("2014-04-26 13:00:00", "2014-04-26 12:58:15", '1 minuta, 45 sekund temu'),
array("2014-04-26 13:00:00", "2014-04-26 11:20:00", '1 godzina, 40 minut temu'),
array("2014-04-26 13:00:00", "2014-04-27 13:15:00", '1 dzień, 15 minut od teraz'),
array("2014-04-26 13:00:00", "2014-05-03 15:00:00", '7 dni, 2 godziny od teraz'),
array("2014-04-26 13:00:00", "2015-04-28 17:00:00", '1 rok, 2 dni, 4 godziny od teraz'),
array("2014-04-26 13:00:00", "2014-04-28 23:00:00", '2 dni, 10 godzin od teraz'),
array("2014-04-26 13:00:00", "2014-04-25 11:20:00", '1 dzień, 1 godzina, 40 minut temu'),
array("2014-04-26 13:00:00", "2016-04-27 13:00:00", '2 lata, 1 dzień od teraz'),
);

foreach ($examples as $example) {
$this->preciseDifference(new \DateTime($example[0]), new \DateTime($example[1]), 'pl')->shouldReturn($example[2]);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
just_now:
past: "just now"
future: "just now"
past: "[0,Inf] just now"
future: "[0,Inf] just now"
second:
past: "{1} %count% second ago|[2,Inf] %count% seconds ago"
future: "{1} %count% second from now|[2,Inf] %count% seconds from now"
Expand Down
17 changes: 14 additions & 3 deletions src/Coduo/PHPHumanizer/Resources/translations/difference.pl.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
just_now:
past: "w tym momencie"
future: "w tym momencie"
past: "[0,Inf] w tym momencie"
future: "[0,Inf] w tym momencie"
second:
past: "{1} sekundę temu|[2, 4] %count% sekundy temu|[5,Inf] %count% sekund temu"
future: "{1} za sekundę|[2, 4] za %count% sekund|[5,Inf] za %count% sekund"
Expand All @@ -21,4 +21,15 @@ month:
future: "{1} za miesiąc|[2, 4] za %count% miesiące|[5,Inf] za %count% miesięcy"
year:
past: "{1} rok temu|[2, 4] %count% lata temu|[5,Inf] %count% lat temu"
future: "{1} za rok|[2, 4] za %count% lata|[5,Inf] za %count% lat"
future: "{1} za rok|[2, 4] za %count% lata|[5,Inf] za %count% lat"

compound:
second: "{1} %count% sekunda|[2,4] %count% sekundy|[5,Inf] %count% sekund"
minute: "{1} %count% minuta|[2,4] %count% minuty|[5,Inf] %count% minut"
hour: "{1} %count% godzina|[2,4] %count% godziny|[5,Inf] %count% godzin"
day: "{1} %count% dzień|[2,Inf] %count% dni"
week: "{1} %count% tydzień|[2,4] %count% tygodnie|[5,Inf] %count% tygodni"
month: "{1} %count% miesiąc|[2,4] %count% miesiące|[5,Inf] %count% miesięcy"
year: "{1} %count% rok|[2,4] %count% lata|[5,Inf] %count% lat"
ago: "temu"
from_now: "od teraz"