diff --git a/src/Carbon/Carbon.php b/src/Carbon/Carbon.php index 80a50009a5..280598aec3 100644 --- a/src/Carbon/Carbon.php +++ b/src/Carbon/Carbon.php @@ -1187,8 +1187,9 @@ public static function getLocale() */ public static function setLocale($locale) { - $locale = preg_replace_callback('/\b([a-z]{2})[-_](?:([a-z]{4})[-_])?([a-z]{2})\b/', function ($matches) { - return $matches[1].'_'.(!empty($matches[2]) ? ucfirst($matches[2]).'_' : '').strtoupper($matches[3]); + $locale = preg_replace_callback('/[-_]([a-z]{2,})/', function ($matches) { + // _2-letters is a region, _3+-letters is a variant + return '_'.call_user_func(strlen($matches[1]) > 2 ? 'ucfirst' : 'strtoupper', $matches[1]); }, strtolower($locale)); if (file_exists($filename = __DIR__.'/Lang/'.$locale.'.php')) { diff --git a/src/Carbon/Lang/ar_shakl.php b/src/Carbon/Lang/ar_Shakl.php similarity index 100% rename from src/Carbon/Lang/ar_shakl.php rename to src/Carbon/Lang/ar_Shakl.php diff --git a/src/Carbon/Lang/sr.php b/src/Carbon/Lang/sr.php index 70915a27de..5a1064212e 100644 --- a/src/Carbon/Lang/sr.php +++ b/src/Carbon/Lang/sr.php @@ -28,4 +28,10 @@ 'from_now' => ':time od sada', 'after' => 'nakon :time', 'before' => 'pre :time', + + 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', + + 'week_from_now' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', + 'week_ago' => '{1} :count nedelju|{2,3,4} :count nedelje|[5,Inf[ :count nedelja', ); diff --git a/src/Carbon/Lang/sr_Cyrl.php b/src/Carbon/Lang/sr_Cyrl.php index 92bb1db783..e0596f8d39 100644 --- a/src/Carbon/Lang/sr_Cyrl.php +++ b/src/Carbon/Lang/sr_Cyrl.php @@ -13,7 +13,7 @@ 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[ :count година', 'y' => ':count г.', 'month' => '{1} :count месец|{2,3,4}:count месеца|[5,Inf[ :count месеци', - 'm' => ':count мј.', + 'm' => ':count м.', 'week' => '{1} :count недеља|{2,3,4}:count недеље|[5,Inf[ :count недеља', 'w' => ':count нед.', 'day' => '{1,21,31} :count дан|[2,Inf[ :count дана', diff --git a/src/Carbon/Lang/sr_ME.php b/src/Carbon/Lang/sr_ME.php index d0aaee37c8..7ebf6f041e 100644 --- a/src/Carbon/Lang/sr_ME.php +++ b/src/Carbon/Lang/sr_ME.php @@ -9,30 +9,4 @@ * file that was distributed with this source code. */ -return array( - 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count godine|[0,Inf[ :count godina', - 'y' => ':count g.', - 'month' => '{1} :count mjesec|{2,3,4}:count mjeseca|[5,Inf[ :count mjeseci', - 'm' => ':count mj.', - 'week' => '{1} :count nedjelja|{2,3,4}:count nedjelje|[5,Inf[ :count nedjelja', - 'w' => ':count ned.', - 'day' => '{1,21,31} :count dan|[2,Inf[ :count dana', - 'd' => ':count d.', - 'hour' => '{1,21} :count sat|{2,3,4,22,23,24}:count sata|[5,Inf[ :count sati', - 'h' => ':count č.', - 'minute' => '{1,21,31,41,51} :count minut|[2,Inf[ :count minuta', - 'min' => ':count min.', - 'second' => '{1,21,31,41,51} :count sekund|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count sekunde|[5,Inf[:count sekundi', - 's' => ':count sek.', - 'ago' => 'prije :time', - 'from_now' => 'za :time', - 'after' => ':time nakon', - 'before' => ':time prije', - - 'year_from_now' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', - 'year_ago' => '{1,21,31,41,51} :count godinu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} :count godine|[5,Inf[ :count godina', - - 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', - 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', - -); +return require __DIR__.'/sr_Latn_ME.php'; diff --git a/tests/Carbon/LocalizationTest.php b/tests/Carbon/LocalizationTest.php index 81622fd842..7ac015b5f9 100644 --- a/tests/Carbon/LocalizationTest.php +++ b/tests/Carbon/LocalizationTest.php @@ -36,7 +36,7 @@ public function providerLocales() return array( array('af'), array('ar'), - array('ar_shakl'), + array('ar_Shakl'), array('az'), array('bg'), array('bn'), @@ -84,6 +84,7 @@ public function providerLocales() array('sl'), array('sq'), array('sr'), + array('sr_Cyrl'), array('sr_Cyrl_ME'), array('sr_Latn_ME'), array('sr_ME'), diff --git a/tests/Localization/ArShaklTest.php b/tests/Localization/ArShaklTest.php index 2f0a60943e..424d41c6df 100644 --- a/tests/Localization/ArShaklTest.php +++ b/tests/Localization/ArShaklTest.php @@ -18,7 +18,7 @@ class ArShaklTest extends AbstractTestCase { public function testDiffForHumansLocalizedInArb() { - Carbon::setLocale('ar_shakl'); + Carbon::setLocale('ar_Shakl'); $scope = $this; $this->wrapWithNonDstDate(function () use ($scope) { diff --git a/tests/Localization/LanguagesCoverageTest.php b/tests/Localization/LanguagesCoverageTest.php index 1262d10fca..8027b37348 100644 --- a/tests/Localization/LanguagesCoverageTest.php +++ b/tests/Localization/LanguagesCoverageTest.php @@ -21,13 +21,18 @@ public function testAllLanguagesAreTested() $tests = array_map(function ($file) { return strtolower(substr(basename($file), 0, -8)); }, glob(__DIR__.'/*Test.php')); - $missingLanguages = count(array_filter($languages, function ($language) use ($tests) { - return !in_array( - str_replace(array('_', '-'), '', strtolower(substr(basename($language), 0, -4))), + $tester = $this; + $missingLanguages = array_filter($languages, function ($language) use ($tester, $tests) { + $file = basename($language); + $covered = in_array( + str_replace(array('_', '-'), '', strtolower(substr($file, 0, -4))), $tests ); - })); + $tester->assertTrue($covered, "Expect $file language file to be covered."); - $this->assertSame(0, $missingLanguages); + return !$covered; + }); + + $this->assertCount(0, $missingLanguages, 'Expect to have 0 languages uncovered.'); } } diff --git a/tests/Localization/SrCyrlMeTest.php b/tests/Localization/SrCyrlMeTest.php index a8bdc06cdb..8362b186d1 100644 --- a/tests/Localization/SrCyrlMeTest.php +++ b/tests/Localization/SrCyrlMeTest.php @@ -16,7 +16,7 @@ class SrCyrlMeTest extends AbstractTestCase { - public function testDiffForHumansLocalizedInSrCyrlMe() + public function testDiffForHumansLocalizedInCyrillicSerbianMe() { Carbon::setLocale('sr_Cyrl_ME'); diff --git a/tests/Localization/SrCyrlTest.php b/tests/Localization/SrCyrlTest.php new file mode 100644 index 0000000000..2e53728f33 --- /dev/null +++ b/tests/Localization/SrCyrlTest.php @@ -0,0 +1,475 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Tests\Localization; + +use Carbon\Carbon; +use Tests\AbstractTestCase; + +class SrCyrlTest extends AbstractTestCase +{ + public function testDiffForHumansLocalizedInCyrillicSerbian() + { + Carbon::setLocale('sr_Cyrl'); + $scope = $this; + $this->wrapWithNonDstDate(function () use ($scope) { + $d = Carbon::now()->subSeconds(1); + $scope->assertSame('пре 1 секунд', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(2); + $scope->assertSame('пре 2 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(3); + $scope->assertSame('пре 3 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(4); + $scope->assertSame('пре 4 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(5); + $scope->assertSame('пре 5 секунди', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(21); + $scope->assertSame('пре 21 секунд', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(22); + $scope->assertSame('пре 22 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(23); + $scope->assertSame('пре 23 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(24); + $scope->assertSame('пре 24 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(31); + $scope->assertSame('пре 31 секунд', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(32); + $scope->assertSame('пре 32 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(33); + $scope->assertSame('пре 33 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(34); + $scope->assertSame('пре 34 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(41); + $scope->assertSame('пре 41 секунд', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(42); + $scope->assertSame('пре 42 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(43); + $scope->assertSame('пре 43 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(44); + $scope->assertSame('пре 44 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(51); + $scope->assertSame('пре 51 секунд', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(52); + $scope->assertSame('пре 52 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(53); + $scope->assertSame('пре 53 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subSeconds(54); + $scope->assertSame('пре 54 секунде', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(1); + $scope->assertSame('пре 1 минут', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(2); + $scope->assertSame('пре 2 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(3); + $scope->assertSame('пре 3 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(4); + $scope->assertSame('пре 4 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(5); + $scope->assertSame('пре 5 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(21); + $scope->assertSame('пре 21 минут', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(22); + $scope->assertSame('пре 22 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(23); + $scope->assertSame('пре 23 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(24); + $scope->assertSame('пре 24 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(31); + $scope->assertSame('пре 31 минут', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(32); + $scope->assertSame('пре 32 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(33); + $scope->assertSame('пре 33 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(34); + $scope->assertSame('пре 34 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(41); + $scope->assertSame('пре 41 минут', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(42); + $scope->assertSame('пре 42 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(43); + $scope->assertSame('пре 43 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(44); + $scope->assertSame('пре 44 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(51); + $scope->assertSame('пре 51 минут', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(52); + $scope->assertSame('пре 52 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(53); + $scope->assertSame('пре 53 минута', $d->diffForHumans()); + + $d = Carbon::now()->subMinutes(54); + $scope->assertSame('пре 54 минута', $d->diffForHumans()); + + $d = Carbon::now()->subHours(1); + $scope->assertSame('пре 1 сат', $d->diffForHumans()); + + $d = Carbon::now()->subHours(2); + $scope->assertSame('пре 2 сата', $d->diffForHumans()); + + $d = Carbon::now()->subHours(3); + $scope->assertSame('пре 3 сата', $d->diffForHumans()); + + $d = Carbon::now()->subHours(4); + $scope->assertSame('пре 4 сата', $d->diffForHumans()); + + $d = Carbon::now()->subHours(5); + $scope->assertSame('пре 5 сати', $d->diffForHumans()); + + $d = Carbon::now()->subHours(21); + $scope->assertSame('пре 21 сат', $d->diffForHumans()); + + $d = Carbon::now()->subHours(22); + $scope->assertSame('пре 22 сата', $d->diffForHumans()); + + $d = Carbon::now()->subHours(23); + $scope->assertSame('пре 23 сата', $d->diffForHumans()); + + $d = Carbon::now()->subHours(24); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(31); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(32); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(33); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(34); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(41); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(42); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(43); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(44); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subHours(51); + $scope->assertSame('пре 2 дана', $d->diffForHumans()); + + $d = Carbon::now()->subHours(52); + $scope->assertSame('пре 2 дана', $d->diffForHumans()); + + $d = Carbon::now()->subHours(53); + $scope->assertSame('пре 2 дана', $d->diffForHumans()); + + $d = Carbon::now()->subHours(54); + $scope->assertSame('пре 2 дана', $d->diffForHumans()); + + $d = Carbon::now()->subDays(1); + $scope->assertSame('пре 1 дан', $d->diffForHumans()); + + $d = Carbon::now()->subDays(2); + $scope->assertSame('пре 2 дана', $d->diffForHumans()); + + $d = Carbon::now()->subDays(3); + $scope->assertSame('пре 3 дана', $d->diffForHumans()); + + $d = Carbon::now()->subDays(4); + $scope->assertSame('пре 4 дана', $d->diffForHumans()); + + $d = Carbon::now()->subDays(5); + $scope->assertSame('пре 5 дана', $d->diffForHumans()); + + $d = Carbon::now()->subDays(21); + $scope->assertSame('пре 3 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subDays(22); + $scope->assertSame('пре 3 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subDays(23); + $scope->assertSame('пре 3 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subDays(24); + $scope->assertSame('пре 3 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subDays(31); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(32); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(33); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(34); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(41); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(42); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(43); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(44); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(51); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(52); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(53); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subDays(54); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(1); + $scope->assertSame('пре 1 недељу', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(2); + $scope->assertSame('пре 2 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(3); + $scope->assertSame('пре 3 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(4); + $scope->assertSame('пре 4 недеље', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(5); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(21); + $scope->assertSame('пре 4 месеца', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(22); + $scope->assertSame('пре 5 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(23); + $scope->assertSame('пре 5 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(24); + $scope->assertSame('пре 5 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(31); + $scope->assertSame('пре 7 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(32); + $scope->assertSame('пре 7 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(33); + $scope->assertSame('пре 7 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(34); + $scope->assertSame('пре 7 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(41); + $scope->assertSame('пре 9 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(42); + $scope->assertSame('пре 9 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(43); + $scope->assertSame('пре 9 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(44); + $scope->assertSame('пре 10 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(51); + $scope->assertSame('пре 11 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(52); + $scope->assertSame('пре 11 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(53); + $scope->assertSame('пре 1 годину', $d->diffForHumans()); + + $d = Carbon::now()->subWeeks(54); + $scope->assertSame('пре 1 годину', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(1); + $scope->assertSame('пре 1 месец', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(2); + $scope->assertSame('пре 2 месеца', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(3); + $scope->assertSame('пре 3 месеца', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(4); + $scope->assertSame('пре 4 месеца', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(5); + $scope->assertSame('пре 5 месеци', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(21); + $scope->assertSame('пре 1 годину', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(22); + $scope->assertSame('пре 1 годину', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(23); + $scope->assertSame('пре 1 годину', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(24); + $scope->assertSame('пре 2 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(31); + $scope->assertSame('пре 2 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(32); + $scope->assertSame('пре 2 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(33); + $scope->assertSame('пре 2 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(34); + $scope->assertSame('пре 2 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(41); + $scope->assertSame('пре 3 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(42); + $scope->assertSame('пре 3 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(43); + $scope->assertSame('пре 3 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(44); + $scope->assertSame('пре 3 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(51); + $scope->assertSame('пре 4 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(52); + $scope->assertSame('пре 4 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(53); + $scope->assertSame('пре 4 године', $d->diffForHumans()); + + $d = Carbon::now()->subMonths(54); + $scope->assertSame('пре 4 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(1); + $scope->assertSame('пре 1 годину', $d->diffForHumans()); + + $d = Carbon::now()->subYears(2); + $scope->assertSame('пре 2 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(3); + $scope->assertSame('пре 3 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(4); + $scope->assertSame('пре 4 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(5); + $scope->assertSame('пре 5 година', $d->diffForHumans()); + + $d = Carbon::now()->subYears(21); + $scope->assertSame('пре 21 годину', $d->diffForHumans()); + + $d = Carbon::now()->subYears(22); + $scope->assertSame('пре 22 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(23); + $scope->assertSame('пре 23 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(24); + $scope->assertSame('пре 24 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(31); + $scope->assertSame('пре 31 годину', $d->diffForHumans()); + + $d = Carbon::now()->subYears(32); + $scope->assertSame('пре 32 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(33); + $scope->assertSame('пре 33 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(34); + $scope->assertSame('пре 34 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(41); + $scope->assertSame('пре 41 годину', $d->diffForHumans()); + + $d = Carbon::now()->subYears(42); + $scope->assertSame('пре 42 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(43); + $scope->assertSame('пре 43 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(44); + $scope->assertSame('пре 44 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(51); + $scope->assertSame('пре 51 годину', $d->diffForHumans()); + + $d = Carbon::now()->subYears(52); + $scope->assertSame('пре 52 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(53); + $scope->assertSame('пре 53 године', $d->diffForHumans()); + + $d = Carbon::now()->subYears(54); + $scope->assertSame('пре 54 године', $d->diffForHumans()); + + $d = Carbon::now()->addSecond(); + $scope->assertSame('за 1 секунд', $d->diffForHumans()); + $d = Carbon::now()->addSecond(); + $d2 = Carbon::now(); + $scope->assertSame('1 секунд након', $d->diffForHumans($d2)); + $scope->assertSame('1 секунд пре', $d2->diffForHumans($d)); + $scope->assertSame('1 секунд', $d->diffForHumans($d2, true)); + $scope->assertSame('2 секунде', $d2->diffForHumans($d->addSecond(), true)); + }); + } +} diff --git a/tests/Localization/SrLatnMeTest.php b/tests/Localization/SrLatnMeTest.php index 5f090536c7..6aa5c542a1 100644 --- a/tests/Localization/SrLatnMeTest.php +++ b/tests/Localization/SrLatnMeTest.php @@ -16,7 +16,7 @@ class SrLatnMeTest extends AbstractTestCase { - public function testDiffForHumansLocalizedInSrLatnMe() + public function testDiffForHumansLocalizedInLatinSerbianMe() { Carbon::setLocale('sr_Latn_ME'); diff --git a/tests/Localization/SrMeTest.php b/tests/Localization/SrMeTest.php index 5e2a732a5a..9c8643f28b 100644 --- a/tests/Localization/SrMeTest.php +++ b/tests/Localization/SrMeTest.php @@ -16,7 +16,7 @@ class SrMeTest extends AbstractTestCase { - public function testDiffForHumansLocalizedInSrMe() + public function testDiffForHumansLocalizedInSerbianMe() { Carbon::setLocale('sr_ME'); diff --git a/tests/Localization/SrTest.php b/tests/Localization/SrTest.php index bb162c38b5..3ce28a69f1 100644 --- a/tests/Localization/SrTest.php +++ b/tests/Localization/SrTest.php @@ -47,7 +47,7 @@ public function testDiffForHumansLocalizedInSerbian() $scope->assertSame('pre 2 dana', $d->diffForHumans()); $d = Carbon::now()->subWeeks(1); - $scope->assertSame('pre 1 nedelja', $d->diffForHumans()); + $scope->assertSame('pre 1 nedelju', $d->diffForHumans()); $d = Carbon::now()->subWeeks(2); $scope->assertSame('pre 2 nedelje', $d->diffForHumans()); @@ -59,7 +59,7 @@ public function testDiffForHumansLocalizedInSerbian() $scope->assertSame('pre 2 meseca', $d->diffForHumans()); $d = Carbon::now()->subYears(1); - $scope->assertSame('pre 1 godina', $d->diffForHumans()); + $scope->assertSame('pre 1 godinu', $d->diffForHumans()); $d = Carbon::now()->subYears(2); $scope->assertSame('pre 2 godine', $d->diffForHumans());