Added vendor/ directory for Composer's installed files

This commit is contained in:
Ascendings
2015-08-30 12:33:20 -04:00
parent 45df179c49
commit b66a773ed8
1162 changed files with 112457 additions and 0 deletions

19
vendor/nesbot/carbon/LICENSE vendored Executable file
View File

@ -0,0 +1,19 @@
Copyright (C) Brian Nesbitt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

31
vendor/nesbot/carbon/composer.json vendored Executable file
View File

@ -0,0 +1,31 @@
{
"name": "nesbot/carbon",
"type": "library",
"description": "A simple API extension for DateTime.",
"keywords": [
"date",
"time",
"DateTime"
],
"homepage": "http://carbon.nesbot.com",
"license": "MIT",
"authors": [
{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
}
],
"require": {
"php": ">=5.3.0",
"symfony/translation": "~2.6"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"autoload": {
"psr-0": {
"Carbon": "src"
}
}
}

25
vendor/nesbot/carbon/phpunit.xml.dist vendored Executable file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/TestFixture.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<filter>
<whitelist>
<directory>src/Carbon</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="Carbon Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

81
vendor/nesbot/carbon/readme.md vendored Executable file
View File

@ -0,0 +1,81 @@
# Carbon
[![Latest Stable Version](https://poser.pugx.org/nesbot/carbon/v/stable.png)](https://packagist.org/packages/nesbot/carbon) [![Total Downloads](https://poser.pugx.org/nesbot/carbon/downloads.png)](https://packagist.org/packages/nesbot/carbon) [![Build Status](https://secure.travis-ci.org/briannesbitt/Carbon.png)](http://travis-ci.org/briannesbitt/Carbon)
A simple PHP API extension for DateTime. [http://carbon.nesbot.com](http://carbon.nesbot.com)
```php
printf("Right now is %s", Carbon::now()->toDateTimeString());
printf("Right now in Vancouver is %s", Carbon::now('America/Vancouver')); //implicit __toString()
$tomorrow = Carbon::now()->addDay();
$lastWeek = Carbon::now()->subWeek();
$nextSummerOlympics = Carbon::createFromDate(2012)->addYears(4);
$officialDate = Carbon::now()->toRfc2822String();
$howOldAmI = Carbon::createFromDate(1975, 5, 21)->age;
$noonTodayLondonTime = Carbon::createFromTime(12, 0, 0, 'Europe/London');
$worldWillEnd = Carbon::createFromDate(2012, 12, 21, 'GMT');
// Don't really want to die so mock now
Carbon::setTestNow(Carbon::createFromDate(2000, 1, 1));
// comparisons are always done in UTC
if (Carbon::now()->gte($worldWillEnd)) {
die();
}
// Phew! Return to normal behaviour
Carbon::setTestNow();
if (Carbon::now()->isWeekend()) {
echo 'Party!';
}
echo Carbon::now()->subMinutes(2)->diffForHumans(); // '2 minutes ago'
// ... but also does 'from now', 'after' and 'before'
// rolling up to seconds, minutes, hours, days, months, years
$daysSinceEpoch = Carbon::createFromTimeStamp(0)->diffInDays();
```
## Installation
### With Composer
```
$ composer require nesbot/carbon
```
```json
{
"require": {
"nesbot/carbon": "~1.14"
}
}
```
```php
<?php
require 'vendor/autoload.php';
use Carbon\Carbon;
printf("Now: %s", Carbon::now());
```
<a name="install-nocomposer"/>
### Without Composer
Why are you not using [composer](http://getcomposer.org/)? Download [Carbon.php](https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Carbon.php) from the repo and save the file into your project path somewhere.
```php
<?php
require 'path/to/Carbon.php';
use Carbon\Carbon;
printf("Now: %s", Carbon::now());
```

2359
vendor/nesbot/carbon/src/Carbon/Carbon.php vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,509 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon;
use DateInterval;
use InvalidArgumentException;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Translation\Loader\ArrayLoader;
/**
* A simple API extension for DateInterval.
* The implemenation provides helpers to handle weeks but only days are saved.
* Weeks are calculated based on the total days of the current instance.
*
* @property integer $years Total years of the current interval.
* @property integer $months Total months of the current interval.
* @property integer $weeks Total weeks of the current interval calculated from the days.
* @property integer $dayz Total days of the current interval (weeks * 7 + days).
* @property integer $hours Total hours of the current interval.
* @property integer $minutes Total minutes of the current interval.
* @property integer $seconds Total seconds of the current interval.
*
* @property-read integer $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7).
* @property-read integer $daysExcludeWeeks alias of dayzExcludeWeeks
*
* @method static CarbonInterval years($years = 1) Create instance specifying a number of years.
* @method static CarbonInterval year($years = 1) Alias for years()
* @method static CarbonInterval months($months = 1) Create instance specifying a number of months.
* @method static CarbonInterval month($months = 1) Alias for months()
* @method static CarbonInterval weeks($weeks = 1) Create instance specifying a number of weeks.
* @method static CarbonInterval week($weeks = 1) Alias for weeks()
* @method static CarbonInterval days($days = 1) Create instance specifying a number of days.
* @method static CarbonInterval dayz($days = 1) Alias for days()
* @method static CarbonInterval day($days = 1) Alias for days()
* @method static CarbonInterval hours($hours = 1) Create instance specifying a number of hours.
* @method static CarbonInterval hour($hours = 1) Alias for hours()
* @method static CarbonInterval minutes($minutes = 1) Create instance specifying a number of minutes.
* @method static CarbonInterval minute($minutes = 1) Alias for minutes()
* @method static CarbonInterval seconds($seconds = 1) Create instance specifying a number of seconds.
* @method static CarbonInterval second($seconds = 1) Alias for seconds()
*
* @method CarbonInterval years() years($years = 1) Set the years portion of the current interval.
* @method CarbonInterval year() year($years = 1) Alias for years().
* @method CarbonInterval months() months($months = 1) Set the months portion of the current interval.
* @method CarbonInterval month() month($months = 1) Alias for months().
* @method CarbonInterval weeks() weeks($weeks = 1) Set the weeks portion of the current interval. Will overwrite dayz value.
* @method CarbonInterval week() week($weeks = 1) Alias for weeks().
* @method CarbonInterval days() days($days = 1) Set the days portion of the current interval.
* @method CarbonInterval dayz() dayz($days = 1) Alias for days().
* @method CarbonInterval day() day($days = 1) Alias for days().
* @method CarbonInterval hours() hours($hours = 1) Set the hours portion of the current interval.
* @method CarbonInterval hour() hour($hours = 1) Alias for hours().
* @method CarbonInterval minutes() minutes($minutes = 1) Set the minutes portion of the current interval.
* @method CarbonInterval minute() minute($minutes = 1) Alias for minutes().
* @method CarbonInterval seconds() seconds($seconds = 1) Set the seconds portion of the current interval.
* @method CarbonInterval second() second($seconds = 1) Alias for seconds().
*/
class CarbonInterval extends DateInterval
{
/**
* Interval spec period designators
*/
const PERIOD_PREFIX = 'P';
const PERIOD_YEARS = 'Y';
const PERIOD_MONTHS = 'M';
const PERIOD_DAYS = 'D';
const PERIOD_TIME_PREFIX = 'T';
const PERIOD_HOURS = 'H';
const PERIOD_MINUTES = 'M';
const PERIOD_SECONDS = 'S';
/**
* A translator to ... er ... translate stuff
*
* @var TranslatorInterface
*/
protected static $translator;
/**
* Before PHP 5.4.20/5.5.4 instead of FALSE days will be set to -99999 when the interval instance
* was created by DateTime:diff().
*/
const PHP_DAYS_FALSE = -99999;
/**
* Determine if the interval was created via DateTime:diff() or not.
*
* @return boolean
*/
private static function wasCreatedFromDiff(DateInterval $interval)
{
return ($interval->days !== false && $interval->days !== static::PHP_DAYS_FALSE);
}
///////////////////////////////////////////////////////////////////
//////////////////////////// CONSTRUCTORS /////////////////////////
///////////////////////////////////////////////////////////////////
/**
* Create a new CarbonInterval instance.
*
* @param integer $years
* @param integer $months
* @param integer $weeks
* @param integer $days
* @param integer $hours
* @param integer $minutes
* @param integer $seconds
*/
public function __construct($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null)
{
$spec = static::PERIOD_PREFIX;
$spec .= $years > 0 ? $years.static::PERIOD_YEARS : '';
$spec .= $months > 0 ? $months.static::PERIOD_MONTHS : '';
$specDays = 0;
$specDays += $weeks > 0 ? $weeks * Carbon::DAYS_PER_WEEK : 0;
$specDays += $days > 0 ? $days : 0;
$spec .= ($specDays > 0) ? $specDays.static::PERIOD_DAYS : '';
if ($hours > 0 || $minutes > 0 || $seconds > 0) {
$spec .= static::PERIOD_TIME_PREFIX;
$spec .= $hours > 0 ? $hours.static::PERIOD_HOURS : '';
$spec .= $minutes > 0 ? $minutes.static::PERIOD_MINUTES : '';
$spec .= $seconds > 0 ? $seconds.static::PERIOD_SECONDS : '';
}
parent::__construct($spec);
}
/**
* Create a new CarbonInterval instance from specific values.
* This is an alias for the constructor that allows better fluent
* syntax as it allows you to do CarbonInterval::create(1)->fn() rather than
* (new CarbonInterval(1))->fn().
*
* @param integer $years
* @param integer $months
* @param integer $weeks
* @param integer $days
* @param integer $hours
* @param integer $minutes
* @param integer $seconds
*
* @return static
*/
public static function create($years = 1, $months = null, $weeks = null, $days = null, $hours = null, $minutes = null, $seconds = null)
{
return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds);
}
/**
* Provide static helpers to create instances. Allows CarbonInterval::years(3).
*
* Note: This is done using the magic method to allow static and instance methods to
* have the same names.
*
* @return static
*/
public static function __callStatic($name, $args)
{
$arg = count($args) == 0 ? 1 : $args[0];
switch ($name) {
case 'years':
case 'year':
return new static($arg);
case 'months':
case 'month':
return new static(null, $arg);
case 'weeks':
case 'week':
return new static(null, null, $arg);
case 'days':
case 'dayz':
case 'day':
return new static(null, null, null, $arg);
case 'hours':
case 'hour':
return new static(null, null, null, null, $arg);
case 'minutes':
case 'minute':
return new static(null, null, null, null, null, $arg);
case 'seconds':
case 'second':
return new static(null, null, null, null, null, null, $arg);
}
}
/**
* Create a CarbonInterval instance from a DateInterval one. Can not instance
* DateInterval objects created from DateTime::diff() as you can't externally
* set the $days field.
*
* @param DateInterval $dt
*
* @throws InvalidArgumentException
*
* @return static
*/
public static function instance(DateInterval $di)
{
if (static::wasCreatedFromDiff($di)) {
throw new InvalidArgumentException("Can not instance a DateInterval object created from DateTime::diff().");
}
$instance = new static($di->y, $di->m, 0, $di->d, $di->h, $di->i, $di->s);
$instance->invert = $di->invert;
$instance->days = $di->days;
return $instance;
}
///////////////////////////////////////////////////////////////////
/////////////////////// LOCALIZATION //////////////////////////////
///////////////////////////////////////////////////////////////////
/**
* Intialize the translator instance if necessary.
*
* @return TranslatorInterface
*/
protected static function translator()
{
if (static::$translator == null) {
static::$translator = new Translator('en');
static::$translator->addLoader('array', new ArrayLoader());
static::setLocale('en');
}
return static::$translator;
}
/**
* Get the translator instance in use
*
* @return TranslatorInterface
*/
public static function getTranslator()
{
return static::translator();
}
/**
* Set the translator instance to use
*
* @param TranslatorInterface
*/
public static function setTranslator(TranslatorInterface $translator)
{
static::$translator = $translator;
}
/**
* Get the current translator locale
*
* @return string
*/
public static function getLocale()
{
return static::translator()->getLocale();
}
/**
* Set the current translator locale
*
* @param string $locale
*/
public static function setLocale($locale)
{
static::translator()->setLocale($locale);
// Ensure the locale has been loaded.
static::translator()->addResource('array', require __DIR__.'/Lang/'.$locale.'.php', $locale);
}
///////////////////////////////////////////////////////////////////
///////////////////////// GETTERS AND SETTERS /////////////////////
///////////////////////////////////////////////////////////////////
/**
* Get a part of the CarbonInterval object
*
* @param string $name
*
* @throws InvalidArgumentException
*
* @return integer
*/
public function __get($name)
{
switch ($name) {
case 'years':
return $this->y;
case 'months':
return $this->m;
case 'dayz':
return $this->d;
case 'hours':
return $this->h;
case 'minutes':
return $this->i;
case 'seconds':
return $this->s;
case 'weeks':
return (int)floor($this->d / Carbon::DAYS_PER_WEEK);
case 'daysExcludeWeeks':
case 'dayzExcludeWeeks':
return $this->d % Carbon::DAYS_PER_WEEK;
default:
throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name));
}
}
/**
* Set a part of the CarbonInterval object
*
* @param string $name
* @param integer $value
*
* @throws InvalidArgumentException
*/
public function __set($name, $val)
{
switch ($name) {
case 'years':
$this->y = $val;
break;
case 'months':
$this->m = $val;
break;
case 'weeks':
$this->d = $val * Carbon::DAYS_PER_WEEK;
break;
case 'dayz':
$this->d = $val;
break;
case 'hours':
$this->h = $val;
break;
case 'minutes':
$this->i = $val;
break;
case 'seconds':
$this->s = $val;
break;
}
}
/**
* Allow setting of weeks and days to be cumulative.
*
* @param int $weeks Number of weeks to set
* @param int $days Number of days to set
*
* @return static
*/
public function weeksAndDays($weeks, $days)
{
$this->dayz = ($weeks * Carbon::DAYS_PER_WEEK) + $days;
return $this;
}
/**
* Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day().
*
* Note: This is done using the magic method to allow static and instance methods to
* have the same names.
*
* @return static
*/
public function __call($name, $args)
{
$arg = count($args) == 0 ? 1 : $args[0];
switch ($name) {
case 'years':
case 'year':
$this->years = $arg;
break;
case 'months':
case 'month':
$this->months = $arg;
break;
case 'weeks':
case 'week':
$this->dayz = $arg * Carbon::DAYS_PER_WEEK;
break;
case 'days':
case 'dayz':
case 'day':
$this->dayz = $arg;
break;
case 'hours':
case 'hour':
$this->hours = $arg;
break;
case 'minutes':
case 'minute':
$this->minutes = $arg;
break;
case 'seconds':
case 'second':
$this->seconds = $arg;
break;
}
return $this;
}
/**
* Get the current interval in a human readable format in the current locale.
*
* @return string
*/
public function forHumans()
{
$periods = array(
'year' => $this->years,
'month' => $this->months,
'week' => $this->weeks,
'day' => $this->daysExcludeWeeks,
'hour' => $this->hours,
'minute' => $this->minutes,
'second' => $this->seconds,
);
$parts = array();
foreach ($periods as $unit => $count) {
if ($count > 0) {
array_push($parts, static::translator()->transChoice($unit, $count, array(':count' => $count)));
}
}
return implode(' ', $parts);
}
/**
* Format the instance as a string using the forHumans() function.
*
* @return string
*/
public function __toString()
{
return $this->forHumans();
}
/**
* Add the passed interval to the current instance
*
* @param DateInterval $interval
*
* @return static
*/
public function add(DateInterval $interval)
{
$sign = ($interval->invert === 1) ? -1 : 1;
if (static::wasCreatedFromDiff($interval)) {
$this->dayz = $this->dayz + ($interval->days * $sign);
} else {
$this->years = $this->years + ($interval->y * $sign);
$this->months = $this->months + ($interval->m * $sign);
$this->dayz = $this->dayz + ($interval->d * $sign);
$this->hours = $this->hours + ($interval->h * $sign);
$this->minutes = $this->minutes + ($interval->i * $sign);
$this->seconds = $this->seconds + ($interval->s * $sign);
}
return $this;
}
}

32
vendor/nesbot/carbon/src/Carbon/Lang/ar.php vendored Executable file
View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/ar/date.php
*/
return array(
'year' => '{0}سنة|{1}سنة|{2}سنتين|[3,Inf]:count سنوات / سنين',
'month' => '{0}شهر|{1}شهر|{2}شهرين|[3,Inf]:count شهور / أشهر',
'week' => '{0}أسبوع|{1}أسبوع|{2}أسبوعين|[3,Inf]:count أسابيع',
'day' => '{0}يوم|{1}يوم|{2}يومين|[3,Inf]:count أيام',
'hour' => '{0}ساعة|{1}ساعة|{2}ساعتين|[3,Inf]:count ساعات',
'minute' => '{0}دقيقة|{1}دقيقة|{2}دقيقتين|[3,Inf]:count دقائق',
'second' => '{0}ثانية|{1}ثانية|{2}ثانيتين|[3,Inf]:count ثوان',
'ago' => 'منذ :time',
'from_now' => 'من الآن :time',
'after' => 'بعد :time',
'before' => 'قبل :time',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/az.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/The-Hasanov/laravel-date/blob/1006f37c431178b5c7219d02c93579c9690ae546/src/Lang/az.php
*/
return array(
'year' => ':count il',
'month' => ':count ay',
'week' => ':count həftə',
'day' => ':count gün',
'hour' => ':count saat',
'minute' => ':count dəqiqə',
'second' => ':count saniyə',
'ago' => ':time öncə',
'from_now' => ':time sonra',
'after' => ':time sonra',
'before' => ':time öncə'
);

32
vendor/nesbot/carbon/src/Carbon/Lang/bg.php vendored Executable file
View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/bg/date.php
*/
return array(
'year' => '1 година|:count години',
'month' => '1 месец|:count месеца',
'week' => '1 седмица|:count седмици',
'day' => '1 ден|:count дни',
'hour' => '1 час|:count часа',
'minute' => '1 минута|:count минути',
'second' => '1 секунда|:count секунди',
'ago' => 'преди :time',
'from_now' => ':time от сега',
'after' => 'след :time',
'before' => 'преди :time',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/ca.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/ca/date.php
*/
return array(
'year' => '1 any|:count anys',
'month' => '1 mes|:count mesos',
'week' => '1 setmana|:count setmanes',
'day' => '1 dia|:count díes',
'hour' => '1 hora|:count hores',
'minute' => '1 minut|:count minuts',
'second' => '1 segon|:count segons',
'ago' => 'Fa :time',
'from_now' => 'Dins de :time',
'after' => ':time després',
'before' => ':time abans',
);

37
vendor/nesbot/carbon/src/Carbon/Lang/cs.php vendored Executable file
View File

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/cs/date.php
*/
return array(
'year' => 'rok|:count roky|:count let',
'month' => 'měsíc|:count měsíce|:count měsíců',
'week' => 'týden|:count týdny|:count týdnů',
'day' => 'den|:count dny|:count dní',
'hour' => 'hodinu|:count hodiny|:count hodin',
'minute' => 'minutu|:count minuty|:count minut',
'second' => 'sekundu|:count sekundy|:count sekund',
'ago' => 'před :time',
'from_now' => 'za :time',
'after' => ':time později',
'before' => ':time předtím',
'year_ago' => 'rokem|[2,Inf]:count lety',
'month_ago' => 'měsícem|[2,Inf]:count měsíci',
'week_ago' => 'týdnem|[2,Inf]:count týdny',
'day_ago' => 'dnem|[2,Inf]:count dny',
'hour_ago' => 'hodinou|[2,Inf]:count hodinami',
'minute_ago' => 'minutou|[2,Inf]:count minutami',
'second_ago' => 'sekundou|[2,Inf]:count sekundami',
);

29
vendor/nesbot/carbon/src/Carbon/Lang/da.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 år|:count år',
'month' => '1 måned|:count måneder',
'week' => '1 uge|:count uger',
'day' => '1 dag|:count dage',
'hour' => '1 time|:count timer',
'minute' => '1 minut|:count minutter',
'second' => '1 sekund|:count sekunder',
'ago' => ':time siden',
'from_now' => 'om :time',
'after' => ':time efter',
'before' => ':time før',
);

39
vendor/nesbot/carbon/src/Carbon/Lang/de.php vendored Executable file
View File

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Michael Hohl <me@michaelhohl.net>
*
* This file is released under the terms of CC0.
* CC0 is even more permissive than the MIT license, allowing you to use the code in
* any manner you want, without any copyright headers, notices, or other attribution.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 Jahr|:count Jahre',
'month' => '1 Monat|:count Monate',
'week' => '1 Woche|:count Wochen',
'day' => '1 Tag|:count Tage',
'hour' => '1 Stunde|:count Stunden',
'minute' => '1 Minute|:count Minuten',
'second' => '1 Sekunde|:count Sekunden',
'ago' => 'vor :time',
'from_now' => 'in :time',
'after' => ':time später',
'before' => ':time zuvor',
'year_from_now' => '1 Jahr|:count Jahren',
'month_from_now' => '1 Monat|:count Monaten',
'week_from_now' => '1 Woche|:count Wochen',
'day_from_now' => '1 Tag|:count Tagen',
'year_ago' => '1 Jahr|:count Jahren',
'month_ago' => '1 Monat|:count Monaten',
'week_ago' => '1 Woche|:count Wochen',
'day_ago' => '1 Tag|:count Tagen',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/el.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/el/date.php
*/
return array(
'year' => '1 χρόνος|:count χρόνια',
'month' => '1 μήνας|:count μήνες',
'week' => '1 εβδομάδα|:count εβδομάδες',
'day' => '1 μέρα|:count μέρες',
'hour' => '1 ώρα|:count ώρες',
'minute' => '1 λεπτό|:count λεπτά',
'second' => '1 δευτερόλεπτο|:count δευτερόλεπτα',
'ago' => 'πρίν απο :time',
'from_now' => 'σε :time απο τώρα',
'after' => ':time μετά',
'before' => ':time πρίν'
);

29
vendor/nesbot/carbon/src/Carbon/Lang/en.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 year|:count years',
'month' => '1 month|:count months',
'week' => '1 week|:count weeks',
'day' => '1 day|:count days',
'hour' => '1 hour|:count hours',
'minute' => '1 minute|:count minutes',
'second' => '1 second|:count seconds',
'ago' => ':time ago',
'from_now' => ':time from now',
'after' => ':time after',
'before' => ':time before',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/eo.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/eo/date.php
*/
return array(
'year' => '1 jaro|:count jaroj',
'month' => '1 monato|:count monatoj',
'week' => '1 semajno|:count semajnoj',
'day' => '1 tago|:count tagoj',
'hour' => '1 horo|:count horoj',
'minute' => '1 minuto|:count minutoj',
'second' => '1 sekundo|:count sekundoj',
'ago' => 'antaŭ :time',
'from_now' => 'je :time',
'after' => ':time poste',
'before' => ':time antaŭe'
);

29
vendor/nesbot/carbon/src/Carbon/Lang/es.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 año|:count años',
'month' => '1 mes|:count meses',
'week' => '1 semana|:count semanas',
'day' => '1 día|:count días',
'hour' => '1 hora|:count horas',
'minute' => '1 minuto|:count minutos',
'second' => '1 segundo|:count segundos',
'ago' => 'hace :time',
'from_now' => 'dentro de :time',
'after' => ':time antes',
'before' => ':time después',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/eu vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/eu/date.php
*/
return array(
'year' => 'Urte 1|:count urte',
'month' => 'Hile 1|:count hile',
'week' => 'Aste 1|:count aste',
'day' => 'Egun 1|:count egun',
'hour' => 'Ordu 1|:count ordu',
'minute' => 'Minutu 1|:count minutu',
'second' => 'Segundu 1|:count segundu',
'ago' => 'Orain dela :time',
'from_now' => ':time barru',
'after' => ':time geroago',
'before' => ':time lehenago'
);

29
vendor/nesbot/carbon/src/Carbon/Lang/fa.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => ':count سال',
'month' => ':count ماه',
'week' => ':count هفته',
'day' => ':count روز',
'hour' => ':count ساعت',
'minute' => ':count دقیقه',
'second' => ':count ثانیه',
'ago' => ':time پیش',
'from_now' => ':time بعد',
'after' => ':time پیش از',
'before' => ':time پس از',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/fi.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/fi/date.php
*/
return array(
'year' => '1 vuosi|:count vuotta',
'month' => '1 kuukausi|:count kuukautta',
'week' => '1 viikko|:count viikkoa',
'day' => '1 päivä|:count päivää',
'hour' => '1 tunti|:count tuntia',
'minute' => '1 minuutti|:count minuuttia',
'second' => '1 sekunti|:count sekuntia',
'ago' => ':time sitten',
'from_now' => ':time tästä hetkestä',
'after' => ':time sen jälkeen',
'before' => ':time ennen'
);

29
vendor/nesbot/carbon/src/Carbon/Lang/fr.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 an|:count ans',
'month' => ':count mois',
'week' => '1 semaine|:count semaines',
'day' => '1 jour|:count jours',
'hour' => '1 heure|:count heures',
'minute' => '1 minute|:count minutes',
'second' => '1 seconde|:count secondes',
'ago' => 'il y a :time',
'from_now' => 'dans :time',
'after' => ':time après',
'before' => ':time avant',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/hr.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/hr/date.php
*/
return array(
'year' => ':count godinu|:count godine|:count godina',
'month' => ':count mjesec|:count mjeseca|:count mjeseci',
'week' => ':count tjedan|:count tjedna|:count tjedana',
'day' => ':count dan|:count dana|:count dana',
'hour' => ':count sat|:count sata|:count sati',
'minute' => ':count minutu|:count minute |:count minuta',
'second' => ':count sekundu|:count sekunde|:count sekundi',
'ago' => 'prije :time',
'from_now' => 'za :time',
'after' => 'za :time',
'before' => 'prije :time'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/hu.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/hu/date.php
*/
return array(
'year' => '1 évvel|:count évvel',
'month' => '1 hónappal|:count hónappal',
'week' => '1 héttel|:count héttel',
'day' => '1 nappal|:count nappal',
'hour' => '1 órával|:count órával',
'minute' => '1 perccel|:count perccel',
'second' => '1 másodperccel|:count másodperccel',
'ago' => ':time korábban',
'from_now' => ':time később',
'after' => ':time később',
'before' => ':time korábban'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/id.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/id/date.php
*/
return array(
'year' => ':count tahun',
'month' => ':count bulan',
'week' => ':count minggu',
'day' => ':count hari',
'hour' => ':count jam',
'minute' => ':count menit',
'second' => ':count detik',
'ago' => ':time yang lalu',
'from_now' => ':time dari sekarang',
'after' => ':time setelah',
'before' => ':time sebelum'
);

29
vendor/nesbot/carbon/src/Carbon/Lang/it.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 anno|:count anni',
'month' => '1 mese|:count mesi',
'week' => '1 settimana|:count settimane',
'day' => '1 giorno|:count giorni',
'hour' => '1 ora|:count ore',
'minute' => '1 minuto|:count minuti',
'second' => '1 secondo|:count secondi',
'ago' => ':time fa',
'from_now' => ':time da adesso',
'after' => ':time dopo',
'before' => ':time prima',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/ja.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/ja/date.php
*/
return array(
'year' => ':count 年',
'month' => ':count ヶ月',
'week' => ':count 週間',
'day' => ':count 日',
'hour' => ':count 時間',
'minute' => ':count 分',
'second' => ':count 秒',
'ago' => ':time 前',
'from_now' => '今から :time',
'after' => ':time 後',
'before' => ':time 前'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/ko.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/cs/date.php
*/
return array(
'year' => ':count 년',
'month' => ':count 개월',
'week' => ':count 주일',
'day' => ':count 일',
'hour' => ':count 시간',
'minute' => ':count 분',
'second' => ':count 초',
'ago' => ':time 전',
'from_now' => ':time 후',
'after' => ':time 뒤',
'before' => ':time 앞',
);

27
vendor/nesbot/carbon/src/Carbon/Lang/lt.php vendored Executable file
View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 metai|:count metai',
'month' => '1 mėnuo|:count mėnesiai',
'week' => '1 savaitė|:count savaitės',
'day' => '1 diena|:count dienos',
'hour' => '1 valanda|:count valandos',
'minute' => '1 minutė|:count minutės',
'second' => '1 sekundė|:count sekundės',
'ago' => 'prieš :time',
'from_now' => ':time nuo dabar',
'after' => 'po :time',
'before' => 'prieš :time',
);

27
vendor/nesbot/carbon/src/Carbon/Lang/nl.php vendored Executable file
View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 jaar|:count jaren',
'month' => '1 maand|:count maanden',
'week' => '1 week|:count weken',
'day' => '1 dag|:count dagen',
'hour' => ':count uur',
'minute' => '1 minuut|:count minuten',
'second' => '1 seconde|:count seconden',
'ago' => ':time geleden',
'from_now' => 'over :time',
'after' => ':time later',
'before' => ':time eerder',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/no.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/no/date.php
*/
return array(
'year' => '1 år|:count år',
'month' => '1 måned|:count måneder',
'week' => '1 uke|:count uker',
'day' => '1 dag|:count dager',
'hour' => '1 time|:count timer',
'minute' => '1 minutt|:count minutter',
'second' => '1 sekund|:count sekunder',
'ago' => ':time siden',
'from_now' => 'om :time',
'after' => ':time etter',
'before' => ':time før'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/pl.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/pl/date.php
*/
return array(
'year' => '1 rok|:count lata|:count lat',
'month' => '1 miesiąc|:count miesiące|:count miesięcy',
'week' => '1 tydzień|:count tygodnie|:count tygodni',
'day' => '1 dzień|:count dni|:count dni',
'hour' => '1 godzina|:count godziny|:count godzin',
'minute' => '1 minuta|:count minuty|:count minut',
'second' => '1 sekunda|:count sekundy|:count sekund',
'ago' => ':time temu',
'from_now' => ':time od teraz',
'after' => ':time przed',
'before' => ':time po'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/pt.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/pt/date.php
*/
return array(
'year' => '1 ano|:count anos',
'month' => '1 mês|:count meses',
'week' => '1 semana|:count semanas',
'day' => '1 dia|:count dias',
'hour' => '1 hora|:count horas',
'minute' => '1 minuto|:count minutos',
'second' => '1 segundo|:count segundos',
'ago' => ':time atrás',
'from_now' => 'em :time',
'after' => ':time depois',
'before' => ':time antes'
);

View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => '1 ano|:count anos',
'month' => '1 mês|:count meses',
'week' => '1 semana|:count semanas',
'day' => '1 dia|:count dias',
'hour' => '1 hora|:count horas',
'minute' => '1 minuto|:count minutos',
'second' => '1 segundo|:count segundos',
'ago' => 'há :time',
'from_now' => 'dentro de :time',
'after' => ':time depois',
'before' => ':time antes',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/ro.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/ro/date.php
*/
return array(
'year' => 'un an|:count ani|:count ani',
'month' => 'o lună|:count luni|:count luni',
'week' => 'o săptămână|:count săptămâni|:count săptămâni',
'day' => 'o zi|:count zile|:count zile',
'hour' => 'o oră|:count ore|:count ore',
'minute' => 'un minut|:count minute|:count minute',
'second' => 'o secundă|:count secunde|:count secunde',
'ago' => 'acum :time',
'from_now' => ':time de acum',
'after' => 'peste :time',
'before' => 'acum :time'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/ru.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/ru/date.php
*/
return array(
'year' => ':count год|:count года|:count лет',
'month' => ':count месяц|:count месяца|:count месяцев',
'week' => ':count неделю|:count недели|:count недель',
'day' => ':count день|:count дня|:count дней',
'hour' => ':count час|:count часа|:count часов',
'minute' => ':count минуту|:count минуты|:count минут',
'second' => ':count секунду|:count секунды|:count секунд',
'ago' => ':time назад',
'from_now' => 'через :time',
'after' => ':time после',
'before' => ':time до'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/sk.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/sk/date.php
*/
return array(
'year' => 'rok|:count roky|:count rokov',
'month' => 'mesiac|:count mesiace|:count mesiacov',
'week' => 'týždeň|:count týždne|:count týždňov',
'day' => 'deň|:count dni|:count dní',
'hour' => 'hodinu|:count hodiny|:count hodín',
'minute' => 'minútu|:count minúty|:count minút',
'second' => 'sekundu|:count sekundy|:count sekúnd',
'ago' => 'pred :time',
'from_now' => 'za :time',
'after' => ':time neskôr',
'before' => ':time predtým'
);

37
vendor/nesbot/carbon/src/Carbon/Lang/sl.php vendored Executable file
View File

@ -0,0 +1,37 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/sl/date.php
*/
return array(
'year' => '1 leto|:count leti|:count leta|:count let',
'month' => '1 mesec|:count meseca|:count mesece|:count mesecev',
'week' => '1 teden|:count tedna|:count tedne|:count tednov',
'day' => '1 dan|:count dni|:count dni|:count dni',
'hour' => '1 uro|:count uri|:count ure|:count ur',
'minute' => '1 minuto|:count minuti|:count minute|:count minut',
'second' => '1 sekundo|:count sekundi|:count sekunde|:count sekund',
'year_ago' => '1 letom|:count leti|:count leti|:count leti',
'month_ago' => '1 mesecem|:count meseci|:count meseci|:count meseci',
'week_ago' => '1 tednom|:count tedni|:count tedni',
'day_ago' => '1 dnem|:count dnevoma|:count dnevi|:count dnevi',
'hour_ago' => '1 uro|:count urama|:count urami|:count urami',
'minute_ago'=> '1 minuto|:count minutama|:count minutami',
'second_ago'=> '1 sekundo|:count sekundama|:count sekundami|:count sekundami',
'ago' => 'pred :time',
'from_now' => 'čez :time',
'after' => 'čez :time',
'before' => 'pred :time'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/sr.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/sr/date.php
*/
return array(
'year' => ':count godina|:count godine|:count godina',
'month' => ':count mesec|:count meseca|:count meseci',
'week' => ':count nedelja|:count nedelje|:count nedelja',
'day' => ':count dan|:count dana|:count dana',
'hour' => ':count sat|:count sata|:count sati',
'minute' => ':count minut|:count minuta |:count minuta',
'second' => ':count sekund|:count sekunde|:count sekunde',
'ago' => 'pre :time',
'from_now' => ':time od sada',
'after' => 'nakon :time',
'before' => 'pre :time'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/sv.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/sv/date.php
*/
return array(
'year' => '1 år|:count år',
'month' => '1 månad|:count månader',
'week' => '1 vecka|:count veckor',
'day' => '1 dag|:count dagar',
'hour' => '1 timme|:count timmar',
'minute' => '1 minut|:count minuter',
'second' => '1 sekund|:count sekunder',
'ago' => ':time sedan',
'from_now' => 'om :time',
'after' => ':time efter',
'before' => ':time före'
);

31
vendor/nesbot/carbon/src/Carbon/Lang/th.php vendored Executable file
View File

@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/th/date.php
*/
return array(
'year' => '1 ปี|:count ปี',
'month' => '1 เดือน|:count เดือน',
'week' => '1 สัปดาห์|:count สัปดาห์',
'day' => '1 วัน|:count วัน',
'hour' => '1 ชั่วโมง|:count ชั่วโมง',
'minute' => '1 นาที|:count นาที',
'second' => '1 วินาที|:count วินาที',
'ago' => ':time sitten',
'ago' => ':time ที่แล้ว',
'from_now' => ':time จากนี้',
'after' => 'หลัง:time',
'before' => 'ก่อน:time'
);

29
vendor/nesbot/carbon/src/Carbon/Lang/tr.php vendored Executable file
View File

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
return array(
'year' => ':count yıl',
'month' => ':count ay',
'week' => ':count hafta',
'day' => ':count gün',
'hour' => ':count saat',
'minute' => ':count dakika',
'second' => ':count saniye',
'ago' => ':time önce',
'from_now' => ':time andan itibaren',
'after' => ':time sonra',
'before' => ':time önce',
);

30
vendor/nesbot/carbon/src/Carbon/Lang/uk.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/uk/date.php
*/
return array(
'year' => ':count рік|:count роки|:count років',
'month' => ':count місяць|:count місяці|:count місяців',
'week' => ':count тиждень|:count тижні|:count тижнів',
'day' => ':count день|:count дні|:count днів',
'hour' => ':count година|:count години|:count годин',
'minute' => ':count хвилину|:count хвилини|:count хвилин',
'second' => ':count секунду|:count секунди|:count секунд',
'ago' => ':time назад',
'from_now' => 'через :time',
'after' => ':time після',
'before' => ':time до'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/vi.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/vi/date.php
*/
return array(
'year' => ':count năm',
'month' => ':count tháng',
'week' => ':count tuần',
'day' => ':count ngày',
'hour' => ':count giờ',
'minute' => ':count phút',
'second' => ':count giây',
'ago' => ':time trước',
'from_now' => ':time từ bây giờ',
'after' => ':time sau',
'before' => ':time trước'
);

View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/zh-TW/date.php
*/
return array(
'year' => ':count 年',
'month' => ':count 月',
'week' => ':count 周',
'day' => ':count 天',
'hour' => ':count 小時',
'minute' => ':count 分鐘',
'second' => ':count 秒',
'ago' => ':time前',
'from_now' => '距現在 :time',
'after' => ':time後',
'before' => ':time前'
);

30
vendor/nesbot/carbon/src/Carbon/Lang/zh.php vendored Executable file
View File

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Translation messages. See http://symfony.com/doc/current/book/translation.html
* for possible formats.
*
*/
/**
* Extracted from https://github.com/jenssegers/laravel-date/blob/master/src/lang/zh/date.php
*/
return array(
'year' => ':count年',
'month' => ':count月',
'week' => ':count周',
'day' => ':count天',
'hour' => ':count小时',
'minute' => ':count分钟',
'second' => ':count秒',
'ago' => ':time前',
'from_now' => ':time距现在',
'after' => ':time后',
'before' => ':time前'
);

241
vendor/nesbot/carbon/tests/AddTest.php vendored Executable file
View File

@ -0,0 +1,241 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class AddTest extends TestFixture
{
public function testAddYearsPositive()
{
$this->assertSame(1976, Carbon::createFromDate(1975)->addYears(1)->year);
}
public function testAddYearsZero()
{
$this->assertSame(1975, Carbon::createFromDate(1975)->addYears(0)->year);
}
public function testAddYearsNegative()
{
$this->assertSame(1974, Carbon::createFromDate(1975)->addYears(-1)->year);
}
public function testAddYear()
{
$this->assertSame(1976, Carbon::createFromDate(1975)->addYear()->year);
}
public function testAddMonthsPositive()
{
$this->assertSame(1, Carbon::createFromDate(1975, 12)->addMonths(1)->month);
}
public function testAddMonthsZero()
{
$this->assertSame(12, Carbon::createFromDate(1975, 12)->addMonths(0)->month);
}
public function testAddMonthsNegative()
{
$this->assertSame(11, Carbon::createFromDate(1975, 12, 1)->addMonths(-1)->month);
}
public function testAddMonth()
{
$this->assertSame(1, Carbon::createFromDate(1975, 12)->addMonth()->month);
}
public function testAddMonthWithOverflow()
{
$this->assertSame(3, Carbon::createFromDate(2012, 1, 31)->addMonth()->month);
}
public function testAddMonthsNoOverflowPositive()
{
$this->assertSame('2012-02-29', Carbon::createFromDate(2012, 1, 31)->addMonthNoOverflow()->toDateString());
$this->assertSame('2012-03-31', Carbon::createFromDate(2012, 1, 31)->addMonthsNoOverflow(2)->toDateString());
$this->assertSame('2012-03-29', Carbon::createFromDate(2012, 2, 29)->addMonthNoOverflow()->toDateString());
$this->assertSame('2012-02-29', Carbon::createFromDate(2011, 12, 31)->addMonthsNoOverflow(2)->toDateString());
}
public function testAddMonthsNoOverflowZero()
{
$this->assertSame(12, Carbon::createFromDate(1975, 12)->addMonths(0)->month);
}
public function testAddMonthsNoOverflowNegative()
{
$this->assertSame('2012-01-29', Carbon::createFromDate(2012, 2, 29)->addMonthsNoOverflow(-1)->toDateString());
$this->assertSame('2012-01-31', Carbon::createFromDate(2012, 3, 31)->addMonthsNoOverflow(-2)->toDateString());
$this->assertSame('2012-02-29', Carbon::createFromDate(2012, 3, 31)->addMonthsNoOverflow(-1)->toDateString());
$this->assertSame('2011-12-31', Carbon::createFromDate(2012, 1, 31)->addMonthsNoOverflow(-1)->toDateString());
}
public function testAddDaysPositive()
{
$this->assertSame(1, Carbon::createFromDate(1975, 5, 31)->addDays(1)->day);
}
public function testAddDaysZero()
{
$this->assertSame(31, Carbon::createFromDate(1975, 5, 31)->addDays(0)->day);
}
public function testAddDaysNegative()
{
$this->assertSame(30, Carbon::createFromDate(1975, 5, 31)->addDays(-1)->day);
}
public function testAddDay()
{
$this->assertSame(1, Carbon::createFromDate(1975, 5, 31)->addDay()->day);
}
public function testAddWeekdaysPositive()
{
$this->assertSame(17, Carbon::createFromDate(2012, 1, 4)->addWeekdays(9)->day);
}
public function testAddWeekdaysZero()
{
$this->assertSame(4, Carbon::createFromDate(2012, 1, 4)->addWeekdays(0)->day);
}
public function testAddWeekdaysNegative()
{
$this->assertSame(18, Carbon::createFromDate(2012, 1, 31)->addWeekdays(-9)->day);
}
public function testAddWeekday()
{
$this->assertSame(9, Carbon::createFromDate(2012, 1, 6)->addWeekday()->day);
}
public function testAddWeeksPositive()
{
$this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->addWeeks(1)->day);
}
public function testAddWeeksZero()
{
$this->assertSame(21, Carbon::createFromDate(1975, 5, 21)->addWeeks(0)->day);
}
public function testAddWeeksNegative()
{
$this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->addWeeks(-1)->day);
}
public function testAddWeek()
{
$this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->addWeek()->day);
}
public function testAddHoursPositive()
{
$this->assertSame(1, Carbon::createFromTime(0)->addHours(1)->hour);
}
public function testAddHoursZero()
{
$this->assertSame(0, Carbon::createFromTime(0)->addHours(0)->hour);
}
public function testAddHoursNegative()
{
$this->assertSame(23, Carbon::createFromTime(0)->addHours(-1)->hour);
}
public function testAddHour()
{
$this->assertSame(1, Carbon::createFromTime(0)->addHour()->hour);
}
public function testAddMinutesPositive()
{
$this->assertSame(1, Carbon::createFromTime(0, 0)->addMinutes(1)->minute);
}
public function testAddMinutesZero()
{
$this->assertSame(0, Carbon::createFromTime(0, 0)->addMinutes(0)->minute);
}
public function testAddMinutesNegative()
{
$this->assertSame(59, Carbon::createFromTime(0, 0)->addMinutes(-1)->minute);
}
public function testAddMinute()
{
$this->assertSame(1, Carbon::createFromTime(0, 0)->addMinute()->minute);
}
public function testAddSecondsPositive()
{
$this->assertSame(1, Carbon::createFromTime(0, 0, 0)->addSeconds(1)->second);
}
public function testAddSecondsZero()
{
$this->assertSame(0, Carbon::createFromTime(0, 0, 0)->addSeconds(0)->second);
}
public function testAddSecondsNegative()
{
$this->assertSame(59, Carbon::createFromTime(0, 0, 0)->addSeconds(-1)->second);
}
public function testAddSecond()
{
$this->assertSame(1, Carbon::createFromTime(0, 0, 0)->addSecond()->second);
}
/***** Test non plural methods with non default args *****/
public function testAddYearPassingArg()
{
$this->assertSame(1977, Carbon::createFromDate(1975)->addYear(2)->year);
}
public function testAddMonthPassingArg()
{
$this->assertSame(7, Carbon::createFromDate(1975, 5, 1)->addMonth(2)->month);
}
public function testAddMonthNoOverflowPassingArg()
{
$dt = Carbon::createFromDate(2010, 12, 31)->addMonthNoOverflow(2);
$this->assertSame(2011, $dt->year);
$this->assertSame(2, $dt->month);
$this->assertSame(28, $dt->day);
}
public function testAddDayPassingArg()
{
$this->assertSame(12, Carbon::createFromDate(1975, 5, 10)->addDay(2)->day);
}
public function testAddHourPassingArg()
{
$this->assertSame(2, Carbon::createFromTime(0)->addHour(2)->hour);
}
public function testAddMinutePassingArg()
{
$this->assertSame(2, Carbon::createFromTime(0)->addMinute(2)->minute);
}
public function testAddSecondPassingArg()
{
$this->assertSame(2, Carbon::createFromTime(0)->addSecond(2)->second);
}
}

View File

@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\CarbonInterval;
use Carbon\Carbon;
class CarbonIntervalAddTest extends TestFixture
{
public function testAdd()
{
$ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add(new DateInterval('P2Y1M5DT22H33M44S'));
$this->assertCarbonInterval($ci, 6, 4, 54, 30, 43, 55);
}
public function testAddWithDiffDateInterval()
{
$diff = Carbon::now()->diff(Carbon::now()->addWeeks(3));
$ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add($diff);
$this->assertCarbonInterval($ci, 4, 3, 70, 8, 10, 11);
}
public function testAddWithNegativeDiffDateInterval()
{
$diff = Carbon::now()->diff(Carbon::now()->subWeeks(3));
$ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add($diff);
$this->assertCarbonInterval($ci, 4, 3, 28, 8, 10, 11);
}
}

View File

@ -0,0 +1,224 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\CarbonInterval;
use Carbon\Carbon;
class CarbonIntervalConstructTest extends TestFixture
{
public function testDefaults()
{
$ci = new CarbonInterval();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 1, 0, 0, 0, 0, 0);
}
/**
* @expectedException Exception
*/
public function testNulls()
{
$ci = new CarbonInterval(null, null, null, null, null, null);
}
/**
* @expectedException Exception
*/
public function testZeroes()
{
$ci = new CarbonInterval(0, 0, 0, 0, 0, 0);
}
public function testYears()
{
$ci = new CarbonInterval(1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 1, 0, 0, 0, 0, 0);
$ci = CarbonInterval::years(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 2, 0, 0, 0, 0, 0);
$ci = CarbonInterval::year();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 1, 0, 0, 0, 0, 0);
$ci = CarbonInterval::year(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 3, 0, 0, 0, 0, 0);
}
public function testMonths()
{
$ci = new CarbonInterval(0, 1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 1, 0, 0, 0, 0);
$ci = CarbonInterval::months(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 2, 0, 0, 0, 0);
$ci = CarbonInterval::month();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 1, 0, 0, 0, 0);
$ci = CarbonInterval::month(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 3, 0, 0, 0, 0);
}
public function testWeeks()
{
$ci = new CarbonInterval(0, 0, 1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 7, 0, 0, 0);
$ci = CarbonInterval::weeks(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 14, 0, 0, 0);
$ci = CarbonInterval::week();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 7, 0, 0, 0);
$ci = CarbonInterval::week(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 21, 0, 0, 0);
}
public function testDays()
{
$ci = new CarbonInterval(0, 0, 0, 1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 1, 0, 0, 0);
$ci = CarbonInterval::days(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 2, 0, 0, 0);
$ci = CarbonInterval::dayz(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 2, 0, 0, 0);
$ci = CarbonInterval::day();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 1, 0, 0, 0);
$ci = CarbonInterval::day(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 3, 0, 0, 0);
}
public function testHours()
{
$ci = new CarbonInterval(0, 0, 0, 0, 1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 1, 0, 0);
$ci = CarbonInterval::hours(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 2, 0, 0);
$ci = CarbonInterval::hour();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 1, 0, 0);
$ci = CarbonInterval::hour(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 3, 0, 0);
}
public function testMinutes()
{
$ci = new CarbonInterval(0, 0, 0, 0, 0, 1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 1, 0);
$ci = CarbonInterval::minutes(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 2, 0);
$ci = CarbonInterval::minute();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 1, 0);
$ci = CarbonInterval::minute(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 3, 0);
}
public function testSeconds()
{
$ci = new CarbonInterval(0, 0, 0, 0, 0, 0, 1);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 1);
$ci = CarbonInterval::seconds(2);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 2);
$ci = CarbonInterval::second();
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 1);
$ci = CarbonInterval::second(3);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 3);
}
public function testYearsAndHours()
{
$ci = new CarbonInterval(5, 0, 0, 0, 3, 0, 0);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 5, 0, 0, 3, 0, 0);
}
public function testAll()
{
$ci = new CarbonInterval(5, 6, 2, 5, 9, 10, 11);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 5, 6, 19, 9, 10, 11);
}
public function testAllWithCreate()
{
$ci = CarbonInterval::create(5, 6, 2, 5, 9, 10, 11);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 5, 6, 19, 9, 10, 11);
}
public function testInstance()
{
$ci = CarbonInterval::instance(new DateInterval('P2Y1M5DT22H33M44S'));
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 2, 1, 5, 22, 33, 44);
$this->assertTrue($ci->days === false || $ci->days === CarbonInterval::PHP_DAYS_FALSE);
}
public function testInstanceWithNegativeDateInterval()
{
$di = new DateInterval('P2Y1M5DT22H33M44S');
$di->invert = 1;
$ci = CarbonInterval::instance($di);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 2, 1, 5, 22, 33, 44);
$this->assertTrue($ci->days === false || $ci->days === CarbonInterval::PHP_DAYS_FALSE);
$this->assertSame(1, $ci->invert);
}
/**
* @expectedException InvalidArgumentException
*/
public function testInstanceWithDaysThrowsException()
{
$ci = CarbonInterval::instance(Carbon::now()->diff(Carbon::now()->addWeeks(3)));
}
}

View File

@ -0,0 +1,107 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\CarbonInterval;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
class CarbonIntervalForHumansTest extends TestFixture
{
public function testGetTranslator()
{
$t = CarbonInterval::getTranslator();
$this->assertNotNull($t);
$this->assertSame('en', $t->getLocale());
}
public function testSetTranslator()
{
$t = new Translator('fr');
$t->addLoader('array', new ArrayLoader());
CarbonInterval::setTranslator($t);
$t = CarbonInterval::getTranslator();
$this->assertNotNull($t);
$this->assertSame('fr', $t->getLocale());
}
public function testGetLocale()
{
CarbonInterval::setLocale('en');
$this->assertSame('en', CarbonInterval::getLocale());
}
public function testSetLocale()
{
CarbonInterval::setLocale('en');
$this->assertSame('en', CarbonInterval::getLocale());
CarbonInterval::setLocale('fr');
$this->assertSame('fr', CarbonInterval::getLocale());
}
public function testYear()
{
CarbonInterval::setLocale('en');
$this->assertSame('1 year', CarbonInterval::year()->forHumans());
}
public function testYearToString()
{
CarbonInterval::setLocale('en');
$this->assertSame('1 year:abc', CarbonInterval::year() . ':abc');
}
public function testYears()
{
CarbonInterval::setLocale('en');
$this->assertSame('2 years', CarbonInterval::years(2)->forHumans());
}
public function testYearsAndMonth()
{
CarbonInterval::setLocale('en');
$this->assertSame('2 years 1 month', CarbonInterval::create(2, 1)->forHumans());
}
public function testAll()
{
CarbonInterval::setLocale('en');
$ci = CarbonInterval::create(11, 1, 2, 5, 22, 33, 55)->forHumans();
$this->assertSame('11 years 1 month 2 weeks 5 days 22 hours 33 minutes 55 seconds', $ci);
}
public function testYearsAndMonthInFrench()
{
CarbonInterval::setLocale('fr');
$this->assertSame('2 ans 1 mois', CarbonInterval::create(2, 1)->forHumans());
}
public function testYearsAndMonthInGerman()
{
CarbonInterval::setLocale('de');
$this->assertSame('1 Jahr 1 Monat', CarbonInterval::create(1, 1)->forHumans());
$this->assertSame('2 Jahre 1 Monat', CarbonInterval::create(2, 1)->forHumans());
}
public function testYearsAndMonthInBulgarian()
{
CarbonInterval::setLocale('bg');
$this->assertSame('1 година 1 месец', CarbonInterval::create(1, 1)->forHumans());
$this->assertSame('2 години 1 месец', CarbonInterval::create(2, 1)->forHumans());
}
public function testYearsAndMonthInCatalan()
{
CarbonInterval::setLocale('ca');
$this->assertSame('1 any 1 mes', CarbonInterval::create(1, 1)->forHumans());
$this->assertSame('2 anys 1 mes', CarbonInterval::create(2, 1)->forHumans());
}
}

View File

@ -0,0 +1,70 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\CarbonInterval;
class CarbonIntervalGettersTest extends TestFixture
{
public function testGettersThrowExceptionOnUnknownGetter()
{
$this->setExpectedException('InvalidArgumentException');
CarbonInterval::year()->sdfsdfss;
}
public function testYearsGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(4, $d->years);
}
public function testMonthsGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(5, $d->months);
}
public function testWeeksGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(6, $d->weeks);
}
public function testDayzExcludingWeeksGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(5, $d->daysExcludeWeeks);
$this->assertSame(5, $d->dayzExcludeWeeks);
}
public function testDayzGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(6 * 7 + 5, $d->dayz);
}
public function testHoursGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(8, $d->hours);
}
public function testMinutesGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(9, $d->minutes);
}
public function testSecondsGetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$this->assertSame(10, $d->seconds);
}
}

View File

@ -0,0 +1,99 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\CarbonInterval;
class CarbonIntervalSettersTest extends TestFixture
{
public function testYearsSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->years = 2;
$this->assertSame(2, $d->years);
}
public function testMonthsSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->months = 11;
$this->assertSame(11, $d->months);
}
public function testWeeksSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->weeks = 11;
$this->assertSame(11, $d->weeks);
$this->assertSame(7 * 11, $d->dayz);
}
public function testDayzSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->dayz = 11;
$this->assertSame(11, $d->dayz);
$this->assertSame(1, $d->weeks);
$this->assertSame(4, $d->dayzExcludeWeeks);
}
public function testHoursSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->hours = 12;
$this->assertSame(12, $d->hours);
}
public function testMinutesSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->minutes = 11;
$this->assertSame(11, $d->minutes);
}
public function testSecondsSetter()
{
$d = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
$d->seconds = 34;
$this->assertSame(34, $d->seconds);
}
public function testFluentSetters()
{
$ci = CarbonInterval::years(4)->months(2)->dayz(5)->hours(3)->minute()->seconds(59);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 4, 2, 5, 3, 1, 59);
$ci = CarbonInterval::years(4)->months(2)->weeks(2)->hours(3)->minute()->seconds(59);
$this->assertInstanceOfCarbonInterval($ci);
$this->assertCarbonInterval($ci, 4, 2, 14, 3, 1, 59);
}
public function testFluentSettersDaysOverwritesWeeks()
{
$ci = CarbonInterval::weeks(3)->days(5);
$this->assertCarbonInterval($ci, 0, 0, 5, 0, 0, 0);
}
public function testFluentSettersWeeksOverwritesDays()
{
$ci = CarbonInterval::days(5)->weeks(3);
$this->assertCarbonInterval($ci, 0, 0, 3 * 7, 0, 0, 0);
}
public function testFluentSettersWeeksAndDaysIsCumulative()
{
$ci = CarbonInterval::year(5)->weeksAndDays(2, 6);
$this->assertCarbonInterval($ci, 5, 0, 20, 0, 0, 0);
$this->assertSame(20, $ci->dayz);
$this->assertSame(2, $ci->weeks);
$this->assertSame(6, $ci->dayzExcludeWeeks);
}
}

200
vendor/nesbot/carbon/tests/ComparisonTest.php vendored Executable file
View File

@ -0,0 +1,200 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class ComparisonTest extends TestFixture
{
public function testEqualToTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->eq(Carbon::createFromDate(2000, 1, 1)));
}
public function testEqualToFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->eq(Carbon::createFromDate(2000, 1, 2)));
}
public function testEqualWithTimezoneTrue()
{
$this->assertTrue(Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto')->eq(Carbon::create(2000, 1, 1, 9, 0, 0, 'America/Vancouver')));
}
public function testEqualWithTimezoneFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->eq(Carbon::createFromDate(2000, 1, 1, 'America/Vancouver')));
}
public function testNotEqualToTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->ne(Carbon::createFromDate(2000, 1, 2)));
}
public function testNotEqualToFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->ne(Carbon::createFromDate(2000, 1, 1)));
}
public function testNotEqualWithTimezone()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->ne(Carbon::createFromDate(2000, 1, 1, 'America/Vancouver')));
}
public function testGreaterThanTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->gt(Carbon::createFromDate(1999, 12, 31)));
}
public function testGreaterThanFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->gt(Carbon::createFromDate(2000, 1, 2)));
}
public function testGreaterThanWithTimezoneTrue()
{
$dt1 = Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto');
$dt2 = Carbon::create(2000, 1, 1, 8, 59, 59, 'America/Vancouver');
$this->assertTrue($dt1->gt($dt2));
}
public function testGreaterThanWithTimezoneFalse()
{
$dt1 = Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto');
$dt2 = Carbon::create(2000, 1, 1, 9, 0, 1, 'America/Vancouver');
$this->assertFalse($dt1->gt($dt2));
}
public function testGreaterThanOrEqualTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->gte(Carbon::createFromDate(1999, 12, 31)));
}
public function testGreaterThanOrEqualTrueEqual()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->gte(Carbon::createFromDate(2000, 1, 1)));
}
public function testGreaterThanOrEqualFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->gte(Carbon::createFromDate(2000, 1, 2)));
}
public function testLessThanTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lt(Carbon::createFromDate(2000, 1, 2)));
}
public function testLessThanFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->lt(Carbon::createFromDate(1999, 12, 31)));
}
public function testLessThanOrEqualTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lte(Carbon::createFromDate(2000, 1, 2)));
}
public function testLessThanOrEqualTrueEqual()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lte(Carbon::createFromDate(2000, 1, 1)));
}
public function testLessThanOrEqualFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->lte(Carbon::createFromDate(1999, 12, 31)));
}
public function testBetweenEqualTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), true));
}
public function testBetweenNotEqualTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), false));
}
public function testBetweenEqualFalse()
{
$this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), true));
}
public function testBetweenNotEqualFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), false));
}
public function testBetweenEqualSwitchTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), true));
}
public function testBetweenNotEqualSwitchTrue()
{
$this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), false));
}
public function testBetweenEqualSwitchFalse()
{
$this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), true));
}
public function testBetweenNotEqualSwitchFalse()
{
$this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), false));
}
public function testMinIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->min() instanceof Carbon);
}
public function testMinWithNow()
{
$dt = Carbon::create(2012, 1, 1, 0, 0, 0)->min();
$this->assertCarbon($dt, 2012, 1, 1, 0, 0, 0);
}
public function testMinWithInstance()
{
$dt1 = Carbon::create(2013, 12, 31, 23, 59, 59);
$dt2 = Carbon::create(2012, 1, 1, 0, 0, 0)->min($dt1);
$this->assertCarbon($dt2, 2012, 1, 1, 0, 0, 0);
}
public function testMaxIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->max() instanceof Carbon);
}
public function testMaxWithNow()
{
$dt = Carbon::create(2099, 12, 31, 23, 59, 59)->max();
$this->assertCarbon($dt, 2099, 12, 31, 23, 59, 59);
}
public function testMaxWithInstance()
{
$dt1 = Carbon::create(2012, 1, 1, 0, 0, 0);
$dt2 = Carbon::create(2099, 12, 31, 23, 59, 59)->max($dt1);
$this->assertCarbon($dt2, 2099, 12, 31, 23, 59, 59);
}
public function testIsBirthday()
{
$dt1 = Carbon::createFromDate(1987, 4, 23);
$dt2 = Carbon::createFromDate(2014, 9, 26);
$dt3 = Carbon::createFromDate(2014, 4, 23);
$this->assertFalse($dt2->isBirthday($dt1));
$this->assertTrue($dt3->isBirthday($dt1));
}
}

105
vendor/nesbot/carbon/tests/ConstructTest.php vendored Executable file
View File

@ -0,0 +1,105 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class ConstructTest extends TestFixture
{
public function testCreatesAnInstanceDefaultToNow()
{
$c = new Carbon();
$now = Carbon::now();
$this->assertInstanceOfCarbon($c);
$this->assertSame($now->tzName, $c->tzName);
$this->assertCarbon($c, $now->year, $now->month, $now->day, $now->hour, $now->minute, $now->second);
}
public function testParseCreatesAnInstanceDefaultToNow()
{
$c = Carbon::parse();
$now = Carbon::now();
$this->assertInstanceOfCarbon($c);
$this->assertSame($now->tzName, $c->tzName);
$this->assertCarbon($c, $now->year, $now->month, $now->day, $now->hour, $now->minute, $now->second);
}
public function testWithFancyString()
{
$c = new Carbon('first day of January 2008');
$this->assertCarbon($c, 2008, 1, 1, 0, 0, 0);
}
public function testParseWithFancyString()
{
$c = Carbon::parse('first day of January 2008');
$this->assertCarbon($c, 2008, 1, 1, 0, 0, 0);
}
public function testDefaultTimezone()
{
$c = new Carbon('now');
$this->assertSame('America/Toronto', $c->tzName);
}
public function testParseWithDefaultTimezone()
{
$c = Carbon::parse('now');
$this->assertSame('America/Toronto', $c->tzName);
}
public function testSettingTimezone()
{
$timezone = 'Europe/London';
$dtz = new \DateTimeZone($timezone);
$dt = new \DateTime('now', $dtz);
$dayLightSavingTimeOffset = $dt->format('I');
$c = new Carbon('now', $dtz);
$this->assertSame($timezone, $c->tzName);
$this->assertSame(0 + $dayLightSavingTimeOffset, $c->offsetHours);
}
public function testParseSettingTimezone()
{
$timezone = 'Europe/London';
$dtz = new \DateTimeZone($timezone);
$dt = new \DateTime('now', $dtz);
$dayLightSavingTimeOffset = $dt->format('I');
$c = Carbon::parse('now', $dtz);
$this->assertSame($timezone, $c->tzName);
$this->assertSame(0 + $dayLightSavingTimeOffset, $c->offsetHours);
}
public function testSettingTimezoneWithString()
{
$timezone = 'Asia/Tokyo';
$dtz = new \DateTimeZone($timezone);
$dt = new \DateTime('now', $dtz);
$dayLightSavingTimeOffset = $dt->format('I');
$c = new Carbon('now', $timezone);
$this->assertSame($timezone, $c->tzName);
$this->assertSame(9 + $dayLightSavingTimeOffset, $c->offsetHours);
}
public function testParseSettingTimezoneWithString()
{
$timezone = 'Asia/Tokyo';
$dtz = new \DateTimeZone($timezone);
$dt = new \DateTime('now', $dtz);
$dayLightSavingTimeOffset = $dt->format('I');
$c = Carbon::parse('now', $timezone);
$this->assertSame($timezone, $c->tzName);
$this->assertSame(9 + $dayLightSavingTimeOffset, $c->offsetHours);
}
}

38
vendor/nesbot/carbon/tests/CopyTest.php vendored Executable file
View File

@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class CopyTest extends TestFixture
{
public function testCopy()
{
$dating = Carbon::now();
$dating2 = $dating->copy();
$this->assertNotSame($dating, $dating2);
}
public function testCopyEnsureTzIsCopied()
{
$dating = Carbon::createFromDate(2000, 1, 1, 'Europe/London');
$dating2 = $dating->copy();
$this->assertSame($dating->tzName, $dating2->tzName);
$this->assertSame($dating->offset, $dating2->offset);
}
public function testCopyEnsureMicrosAreCopied()
{
$micro = 254687;
$dating = Carbon::createFromFormat('Y-m-d H:i:s.u', '2014-02-01 03:45:27.'.$micro);
$dating2 = $dating->copy();
$this->assertSame($micro, $dating2->micro);
}
}

View File

@ -0,0 +1,59 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class CreateFromDateTest extends TestFixture
{
public function testCreateFromDateWithDefaults()
{
$d = Carbon::createFromDate();
$this->assertSame($d->timestamp, Carbon::create(null, null, null, null, null, null)->timestamp);
}
public function testCreateFromDate()
{
$d = Carbon::createFromDate(1975, 5, 21);
$this->assertCarbon($d, 1975, 5, 21);
}
public function testCreateFromDateWithYear()
{
$d = Carbon::createFromDate(1975);
$this->assertSame(1975, $d->year);
}
public function testCreateFromDateWithMonth()
{
$d = Carbon::createFromDate(null, 5);
$this->assertSame(5, $d->month);
}
public function testCreateFromDateWithDay()
{
$d = Carbon::createFromDate(null, null, 21);
$this->assertSame(21, $d->day);
}
public function testCreateFromDateWithTimezone()
{
$d = Carbon::createFromDate(1975, 5, 21, 'Europe/London');
$this->assertCarbon($d, 1975, 5, 21);
$this->assertSame('Europe/London', $d->tzName);
}
public function testCreateFromDateWithDateTimeZone()
{
$d = Carbon::createFromDate(1975, 5, 21, new \DateTimeZone('Europe/London'));
$this->assertCarbon($d, 1975, 5, 21);
$this->assertSame('Europe/London', $d->tzName);
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class CreateFromFormatTest extends TestFixture
{
public function testCreateFromFormatReturnsCarbon()
{
$d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11');
$this->assertCarbon($d, 1975, 5, 21, 22, 32, 11);
$this->assertTrue($d instanceof Carbon);
}
public function testCreateFromFormatWithTimezoneString()
{
$d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11', 'Europe/London');
$this->assertCarbon($d, 1975, 5, 21, 22, 32, 11);
$this->assertSame('Europe/London', $d->tzName);
}
public function testCreateFromFormatWithTimezone()
{
$d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11', new \DateTimeZone('Europe/London'));
$this->assertCarbon($d, 1975, 5, 21, 22, 32, 11);
$this->assertSame('Europe/London', $d->tzName);
}
public function testCreateFromFormatWithMillis()
{
$d = Carbon::createFromFormat('Y-m-d H:i:s.u', '1975-05-21 22:32:11.254687');
$this->assertSame(254687, $d->micro);
}
}

View File

@ -0,0 +1,61 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class CreateFromTimeTest extends TestFixture
{
public function testCreateFromDateWithDefaults()
{
$d = Carbon::createFromTime();
$this->assertSame($d->timestamp, Carbon::create(null, null, null, null, null, null)->timestamp);
}
public function testCreateFromDate()
{
$d = Carbon::createFromTime(23, 5, 21);
$this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 23, 5, 21);
}
public function testCreateFromTimeWithHour()
{
$d = Carbon::createFromTime(22);
$this->assertSame(22, $d->hour);
$this->assertSame(0, $d->minute);
$this->assertSame(0, $d->second);
}
public function testCreateFromTimeWithMinute()
{
$d = Carbon::createFromTime(null, 5);
$this->assertSame(5, $d->minute);
}
public function testCreateFromTimeWithSecond()
{
$d = Carbon::createFromTime(null, null, 21);
$this->assertSame(21, $d->second);
}
public function testCreateFromTimeWithDateTimeZone()
{
$d = Carbon::createFromTime(12, 0, 0, new \DateTimeZone('Europe/London'));
$this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 12, 0, 0);
$this->assertSame('Europe/London', $d->tzName);
}
public function testCreateFromTimeWithTimeZoneString()
{
$d = Carbon::createFromTime(12, 0, 0, 'Europe/London');
$this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 12, 0, 0);
$this->assertSame('Europe/London', $d->tzName);
}
}

View File

@ -0,0 +1,52 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class CreateFromTimestampTest extends TestFixture
{
public function testCreateReturnsDatingInstance()
{
$d = Carbon::createFromTimestamp(Carbon::create(1975, 5, 21, 22, 32, 5)->timestamp);
$this->assertCarbon($d, 1975, 5, 21, 22, 32, 5);
}
public function testCreateFromTimestampUsesDefaultTimezone()
{
$d = Carbon::createFromTimestamp(0);
// We know Toronto is -5 since no DST in Jan
$this->assertSame(1969, $d->year);
$this->assertSame(-5 * 3600, $d->offset);
}
public function testCreateFromTimestampWithDateTimeZone()
{
$d = Carbon::createFromTimestamp(0, new \DateTimeZone('UTC'));
$this->assertSame('UTC', $d->tzName);
$this->assertCarbon($d, 1970, 1, 1, 0, 0, 0);
}
public function testCreateFromTimestampWithString()
{
$d = Carbon::createFromTimestamp(0, 'UTC');
$this->assertCarbon($d, 1970, 1, 1, 0, 0, 0);
$this->assertSame(0, $d->offset);
$this->assertSame('UTC', $d->tzName);
}
public function testCreateFromTimestampGMTDoesNotUseDefaultTimezone()
{
$d = Carbon::createFromTimestampUTC(0);
$this->assertCarbon($d, 1970, 1, 1, 0, 0, 0);
$this->assertSame(0, $d->offset);
}
}

142
vendor/nesbot/carbon/tests/CreateTest.php vendored Executable file
View File

@ -0,0 +1,142 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class CreateTest extends TestFixture
{
public function testCreateReturnsDatingInstance()
{
$d = Carbon::create();
$this->assertTrue($d instanceof Carbon);
}
public function testCreateWithDefaults()
{
$d = Carbon::create();
$this->assertSame($d->timestamp, Carbon::now()->timestamp);
}
public function testCreateWithYear()
{
$d = Carbon::create(2012);
$this->assertSame(2012, $d->year);
}
public function testCreateWithInvalidYear()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::create(-3);
}
public function testCreateWithMonth()
{
$d = Carbon::create(null, 3);
$this->assertSame(3, $d->month);
}
public function testCreateWithInvalidMonth()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::create(null, -5);
}
public function testCreateMonthWraps()
{
$d = Carbon::create(2011, 0, 1, 0, 0, 0);
$this->assertCarbon($d, 2010, 12, 1, 0, 0, 0);
}
public function testCreateWithDay()
{
$d = Carbon::create(null, null, 21);
$this->assertSame(21, $d->day);
}
public function testCreateWithInvalidDay()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::create(null, null, -4);
}
public function testCreateDayWraps()
{
$d = Carbon::create(2011, 1, 40, 0, 0, 0);
$this->assertCarbon($d, 2011, 2, 9, 0, 0, 0);
}
public function testCreateWithHourAndDefaultMinSecToZero()
{
$d = Carbon::create(null, null, null, 14);
$this->assertSame(14, $d->hour);
$this->assertSame(0, $d->minute);
$this->assertSame(0, $d->second);
}
public function testCreateWithInvalidHour()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::create(null, null, null, -1);
}
public function testCreateHourWraps()
{
$d = Carbon::create(2011, 1, 1, 24, 0, 0);
$this->assertCarbon($d, 2011, 1, 2, 0, 0, 0);
}
public function testCreateWithMinute()
{
$d = Carbon::create(null, null, null, null, 58);
$this->assertSame(58, $d->minute);
}
public function testCreateWithInvalidMinute()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::create(2011, 1, 1, 0, -2, 0);
}
public function testCreateMinuteWraps()
{
$d = Carbon::create(2011, 1, 1, 0, 62, 0);
$this->assertCarbon($d, 2011, 1, 1, 1, 2, 0);
}
public function testCreateWithSecond()
{
$d = Carbon::create(null, null, null, null, null, 59);
$this->assertSame(59, $d->second);
}
public function testCreateWithInvalidSecond()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::create(null, null, null, null, null, -2);
}
public function testCreateSecondsWrap()
{
$d = Carbon::create(2012, 1, 1, 0, 0, 61);
$this->assertCarbon($d, 2012, 1, 1, 0, 1, 1);
}
public function testCreateWithDateTimeZone()
{
$d = Carbon::create(2012, 1, 1, 0, 0, 0, new \DateTimeZone('Europe/London'));
$this->assertCarbon($d, 2012, 1, 1, 0, 0, 0);
$this->assertSame('Europe/London', $d->tzName);
}
public function testCreateWithTimeZoneString()
{
$d = Carbon::create(2012, 1, 1, 0, 0, 0, 'Europe/London');
$this->assertCarbon($d, 2012, 1, 1, 0, 0, 0);
$this->assertSame('Europe/London', $d->tzName);
}
}

View File

@ -0,0 +1,288 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class DayOfWeekModifiersTest extends TestFixture
{
public function testStartOfWeek()
{
$d = Carbon::create(1980, 8, 7, 12, 11, 9)->startOfWeek();
$this->assertCarbon($d, 1980, 8, 4, 0, 0, 0);
}
public function testStartOfWeekFromWeekStart()
{
$d = Carbon::createFromDate(1980, 8, 4)->startOfWeek();
$this->assertCarbon($d, 1980, 8, 4, 0, 0, 0);
}
public function testStartOfWeekCrossingYearBoundary()
{
$d = Carbon::createFromDate(2013, 12, 31, 'GMT');
$d->startOfWeek();
$this->assertCarbon($d, 2013, 12, 30, 0, 0, 0);
}
public function testEndOfWeek()
{
$d = Carbon::create(1980, 8, 7, 11, 12, 13)->endOfWeek();
$this->assertCarbon($d, 1980, 8, 10, 23, 59, 59);
}
public function testEndOfWeekFromWeekEnd()
{
$d = Carbon::createFromDate(1980, 8, 9)->endOfWeek();
$this->assertCarbon($d, 1980, 8, 10, 23, 59, 59);
}
public function testEndOfWeekCrossingYearBoundary()
{
$d = Carbon::createFromDate(2013, 12, 31, 'GMT');
$d->endOfWeek();
$this->assertCarbon($d, 2014, 1, 5, 23, 59, 59);
}
public function testNext()
{
$d = Carbon::createFromDate(1975, 5, 21)->next();
$this->assertCarbon($d, 1975, 5, 28, 0, 0, 0);
}
public function testNextMonday()
{
$d = Carbon::createFromDate(1975, 5, 21)->next(Carbon::MONDAY);
$this->assertCarbon($d, 1975, 5, 26, 0, 0, 0);
}
public function testNextSaturday()
{
$d = Carbon::createFromDate(1975, 5, 21)->next(6);
$this->assertCarbon($d, 1975, 5, 24, 0, 0, 0);
}
public function testNextTimestamp()
{
$d = Carbon::createFromDate(1975, 11, 14)->next();
$this->assertCarbon($d, 1975, 11, 21, 0, 0, 0);
}
public function testPrevious()
{
$d = Carbon::createFromDate(1975, 5, 21)->previous();
$this->assertCarbon($d, 1975, 5, 14, 0, 0, 0);
}
public function testPreviousMonday()
{
$d = Carbon::createFromDate(1975, 5, 21)->previous(Carbon::MONDAY);
$this->assertCarbon($d, 1975, 5, 19, 0, 0, 0);
}
public function testPreviousSaturday()
{
$d = Carbon::createFromDate(1975, 5, 21)->previous(6);
$this->assertCarbon($d, 1975, 5, 17, 0, 0, 0);
}
public function testPreviousTimestamp()
{
$d = Carbon::createFromDate(1975, 11, 28)->previous();
$this->assertCarbon($d, 1975, 11, 21, 0, 0, 0);
}
public function testFirstDayOfMonth()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfMonth();
$this->assertCarbon($d, 1975, 11, 1, 0, 0, 0);
}
public function testFirstWednesdayOfMonth()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfMonth(Carbon::WEDNESDAY);
$this->assertCarbon($d, 1975, 11, 5, 0, 0, 0);
}
public function testFirstFridayOfMonth()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfMonth(5);
$this->assertCarbon($d, 1975, 11, 7, 0, 0, 0);
}
public function testLastDayOfMonth()
{
$d = Carbon::createFromDate(1975, 12, 5)->lastOfMonth();
$this->assertCarbon($d, 1975, 12, 31, 0, 0, 0);
}
public function testLastTuesdayOfMonth()
{
$d = Carbon::createFromDate(1975, 12, 1)->lastOfMonth(Carbon::TUESDAY);
$this->assertCarbon($d, 1975, 12, 30, 0, 0, 0);
}
public function testLastFridayOfMonth()
{
$d = Carbon::createFromDate(1975, 12, 5)->lastOfMonth(5);
$this->assertCarbon($d, 1975, 12, 26, 0, 0, 0);
}
public function testNthOfMonthOutsideScope()
{
$this->assertFalse(Carbon::createFromDate(1975, 12, 5)->nthOfMonth(6, Carbon::MONDAY));
}
public function testNthOfMonthOutsideYear()
{
$this->assertFalse(Carbon::createFromDate(1975, 12, 5)->nthOfMonth(55, Carbon::MONDAY));
}
public function test2ndMondayOfMonth()
{
$d = Carbon::createFromDate(1975, 12, 5)->nthOfMonth(2, Carbon::MONDAY);
$this->assertCarbon($d, 1975, 12, 8, 0, 0, 0);
}
public function test3rdWednesdayOfMonth()
{
$d = Carbon::createFromDate(1975, 12, 5)->nthOfMonth(3, 3);
$this->assertCarbon($d, 1975, 12, 17, 0, 0, 0);
}
public function testFirstDayOfQuarter()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfQuarter();
$this->assertCarbon($d, 1975, 10, 1, 0, 0, 0);
}
public function testFirstWednesdayOfQuarter()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfQuarter(Carbon::WEDNESDAY);
$this->assertCarbon($d, 1975, 10, 1, 0, 0, 0);
}
public function testFirstFridayOfQuarter()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfQuarter(5);
$this->assertCarbon($d, 1975, 10, 3, 0, 0, 0);
}
public function testFirstOfQuarterFromADayThatWillNotExistIntheFirstMonth()
{
$d = Carbon::createFromDate(2014, 5, 31)->firstOfQuarter();
$this->assertCarbon($d, 2014, 4, 1, 0, 0, 0);
}
public function testLastDayOfQuarter()
{
$d = Carbon::createFromDate(1975, 8, 5)->lastOfQuarter();
$this->assertCarbon($d, 1975, 9, 30, 0, 0, 0);
}
public function testLastTuesdayOfQuarter()
{
$d = Carbon::createFromDate(1975, 8, 1)->lastOfQuarter(Carbon::TUESDAY);
$this->assertCarbon($d, 1975, 9, 30, 0, 0, 0);
}
public function testLastFridayOfQuarter()
{
$d = Carbon::createFromDate(1975, 7, 5)->lastOfQuarter(5);
$this->assertCarbon($d, 1975, 9, 26, 0, 0, 0);
}
public function testLastOfQuarterFromADayThatWillNotExistIntheLastMonth()
{
$d = Carbon::createFromDate(2014, 5, 31)->lastOfQuarter();
$this->assertCarbon($d, 2014, 6, 30, 0, 0, 0);
}
public function testNthOfQuarterOutsideScope()
{
$this->assertFalse(Carbon::createFromDate(1975, 1, 5)->nthOfQuarter(20, Carbon::MONDAY));
}
public function testNthOfQuarterOutsideYear()
{
$this->assertFalse(Carbon::createFromDate(1975, 1, 5)->nthOfQuarter(55, Carbon::MONDAY));
}
public function testNthOfQuarterFromADayThatWillNotExistIntheFirstMonth()
{
$d = Carbon::createFromDate(2014, 5, 31)->nthOfQuarter(2, Carbon::MONDAY);
$this->assertCarbon($d, 2014, 4, 14, 0, 0, 0);
}
public function test2ndMondayOfQuarter()
{
$d = Carbon::createFromDate(1975, 8, 5)->nthOfQuarter(2, Carbon::MONDAY);
$this->assertCarbon($d, 1975, 7, 14, 0, 0, 0);
}
public function test3rdWednesdayOfQuarter()
{
$d = Carbon::createFromDate(1975, 8, 5)->nthOfQuarter(3, 3);
$this->assertCarbon($d, 1975, 7, 16, 0, 0, 0);
}
public function testFirstDayOfYear()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfYear();
$this->assertCarbon($d, 1975, 1, 1, 0, 0, 0);
}
public function testFirstWednesdayOfYear()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfYear(Carbon::WEDNESDAY);
$this->assertCarbon($d, 1975, 1, 1, 0, 0, 0);
}
public function testFirstFridayOfYear()
{
$d = Carbon::createFromDate(1975, 11, 21)->firstOfYear(5);
$this->assertCarbon($d, 1975, 1, 3, 0, 0, 0);
}
public function testLastDayOfYear()
{
$d = Carbon::createFromDate(1975, 8, 5)->lastOfYear();
$this->assertCarbon($d, 1975, 12, 31, 0, 0, 0);
}
public function testLastTuesdayOfYear()
{
$d = Carbon::createFromDate(1975, 8, 1)->lastOfYear(Carbon::TUESDAY);
$this->assertCarbon($d, 1975, 12, 30, 0, 0, 0);
}
public function testLastFridayOfYear()
{
$d = Carbon::createFromDate(1975, 7, 5)->lastOfYear(5);
$this->assertCarbon($d, 1975, 12, 26, 0, 0, 0);
}
public function testNthOfYearOutsideScope()
{
$this->assertFalse(Carbon::createFromDate(1975, 1, 5)->nthOfYear(55, Carbon::MONDAY));
}
public function test2ndMondayOfYear()
{
$d = Carbon::createFromDate(1975, 8, 5)->nthOfYear(2, Carbon::MONDAY);
$this->assertCarbon($d, 1975, 1, 13, 0, 0, 0);
}
public function test3rdWednesdayOfYear()
{
$d = Carbon::createFromDate(1975, 8, 5)->nthOfYear(3, 3);
$this->assertCarbon($d, 1975, 1, 15, 0, 0, 0);
}
}

1042
vendor/nesbot/carbon/tests/DiffTest.php vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class FluidSettersTest extends TestFixture
{
public function testFluidYearSetter()
{
$d = Carbon::now();
$this->assertTrue($d->year(1995) instanceof Carbon);
$this->assertSame(1995, $d->year);
}
public function testFluidMonthSetter()
{
$d = Carbon::now();
$this->assertTrue($d->month(3) instanceof Carbon);
$this->assertSame(3, $d->month);
}
public function testFluidMonthSetterWithWrap()
{
$d = Carbon::createFromDate(2012, 8, 21);
$this->assertTrue($d->month(13) instanceof Carbon);
$this->assertSame(1, $d->month);
}
public function testFluidDaySetter()
{
$d = Carbon::now();
$this->assertTrue($d->day(2) instanceof Carbon);
$this->assertSame(2, $d->day);
}
public function testFluidDaySetterWithWrap()
{
$d = Carbon::createFromDate(2000, 1, 1);
$this->assertTrue($d->day(32) instanceof Carbon);
$this->assertSame(1, $d->day);
}
public function testFluidSetDate()
{
$d = Carbon::createFromDate(2000, 1, 1);
$this->assertTrue($d->setDate(1995, 13, 32) instanceof Carbon);
$this->assertCarbon($d, 1996, 2, 1);
}
public function testFluidHourSetter()
{
$d = Carbon::now();
$this->assertTrue($d->hour(2) instanceof Carbon);
$this->assertSame(2, $d->hour);
}
public function testFluidHourSetterWithWrap()
{
$d = Carbon::now();
$this->assertTrue($d->hour(25) instanceof Carbon);
$this->assertSame(1, $d->hour);
}
public function testFluidMinuteSetter()
{
$d = Carbon::now();
$this->assertTrue($d->minute(2) instanceof Carbon);
$this->assertSame(2, $d->minute);
}
public function testFluidMinuteSetterWithWrap()
{
$d = Carbon::now();
$this->assertTrue($d->minute(61) instanceof Carbon);
$this->assertSame(1, $d->minute);
}
public function testFluidSecondSetter()
{
$d = Carbon::now();
$this->assertTrue($d->second(2) instanceof Carbon);
$this->assertSame(2, $d->second);
}
public function testFluidSecondSetterWithWrap()
{
$d = Carbon::now();
$this->assertTrue($d->second(62) instanceof Carbon);
$this->assertSame(2, $d->second);
}
public function testFluidSetTime()
{
$d = Carbon::createFromDate(2000, 1, 1);
$this->assertTrue($d->setTime(25, 61, 61) instanceof Carbon);
$this->assertCarbon($d, 2000, 1, 2, 2, 2, 1);
}
public function testFluidTimestampSetter()
{
$d = Carbon::now();
$this->assertTrue($d->timestamp(10) instanceof Carbon);
$this->assertSame(10, $d->timestamp);
}
}

285
vendor/nesbot/carbon/tests/GettersTest.php vendored Executable file
View File

@ -0,0 +1,285 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class GettersTest extends TestFixture
{
public function testGettersThrowExceptionOnUnknownGetter()
{
$this->setExpectedException('InvalidArgumentException');
Carbon::create(1234, 5, 6, 7, 8, 9)->sdfsdfss;
}
public function testYearGetter()
{
$d = Carbon::create(1234, 5, 6, 7, 8, 9);
$this->assertSame(1234, $d->year);
}
public function testYearIsoGetter()
{
$d = Carbon::createFromDate(2012, 12, 31);
$this->assertSame(2013, $d->yearIso);
}
public function testMonthGetter()
{
$d = Carbon::create(1234, 5, 6, 7, 8, 9);
$this->assertSame(5, $d->month);
}
public function testDayGetter()
{
$d = Carbon::create(1234, 5, 6, 7, 8, 9);
$this->assertSame(6, $d->day);
}
public function testHourGetter()
{
$d = Carbon::create(1234, 5, 6, 7, 8, 9);
$this->assertSame(7, $d->hour);
}
public function testMinuteGetter()
{
$d = Carbon::create(1234, 5, 6, 7, 8, 9);
$this->assertSame(8, $d->minute);
}
public function testSecondGetter()
{
$d = Carbon::create(1234, 5, 6, 7, 8, 9);
$this->assertSame(9, $d->second);
}
public function testMicroGetter()
{
$micro = 345678;
$d = Carbon::parse('2014-01-05 12:34:11.'.$micro);
$this->assertSame($micro, $d->micro);
}
public function testMicroGetterWithDefaultNow()
{
$d = Carbon::now();
$this->assertSame(0, $d->micro);
}
public function testDayOfWeeGetter()
{
$d = Carbon::create(2012, 5, 7, 7, 8, 9);
$this->assertSame(Carbon::MONDAY, $d->dayOfWeek);
}
public function testDayOfYearGetter()
{
$d = Carbon::createFromDate(2012, 5, 7);
$this->assertSame(127, $d->dayOfYear);
}
public function testDaysInMonthGetter()
{
$d = Carbon::createFromDate(2012, 5, 7);
$this->assertSame(31, $d->daysInMonth);
}
public function testTimestampGetter()
{
$d = Carbon::create();
$d->setTimezone('GMT');
$this->assertSame(0, $d->setDateTime(1970, 1, 1, 0, 0, 0)->timestamp);
}
public function testGetAge()
{
$d = Carbon::now();
$this->assertSame(0, $d->age);
}
public function testGetAgeWithRealAge()
{
$d = Carbon::createFromDate(1975, 5, 21);
$age = intval(substr(date('Ymd') - date('Ymd', $d->timestamp), 0, -4));
$this->assertSame($age, $d->age);
}
public function testGetQuarterFirst()
{
$d = Carbon::createFromDate(2012, 1, 1);
$this->assertSame(1, $d->quarter);
}
public function testGetQuarterFirstEnd()
{
$d = Carbon::createFromDate(2012, 3, 31);
$this->assertSame(1, $d->quarter);
}
public function testGetQuarterSecond()
{
$d = Carbon::createFromDate(2012, 4, 1);
$this->assertSame(2, $d->quarter);
}
public function testGetQuarterThird()
{
$d = Carbon::createFromDate(2012, 7, 1);
$this->assertSame(3, $d->quarter);
}
public function testGetQuarterFourth()
{
$d = Carbon::createFromDate(2012, 10, 1);
$this->assertSame(4, $d->quarter);
}
public function testGetQuarterFirstLast()
{
$d = Carbon::createFromDate(2012, 12, 31);
$this->assertSame(4, $d->quarter);
}
public function testGetLocalTrue()
{
// Default timezone has been set to America/Toronto in TestFixture.php
// @see : http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
$this->assertTrue(Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->local);
$this->assertTrue(Carbon::createFromDate(2012, 1, 1, 'America/New_York')->local);
}
public function testGetLocalFalse()
{
$this->assertFalse(Carbon::createFromDate(2012, 7, 1, 'UTC')->local);
$this->assertFalse(Carbon::createFromDate(2012, 7, 1, 'Europe/London')->local);
}
public function testGetUtcFalse()
{
$this->assertFalse(Carbon::createFromDate(2013, 1, 1, 'America/Toronto')->utc);
$this->assertFalse(Carbon::createFromDate(2013, 1, 1, 'Europe/Paris')->utc);
}
public function testGetUtcTrue()
{
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Atlantic/Reykjavik')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Europe/Lisbon')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Africa/Casablanca')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Africa/Dakar')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Europe/Dublin')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Europe/London')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'UTC')->utc);
$this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'GMT')->utc);
}
public function testGetDstFalse()
{
$this->assertFalse(Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->dst);
}
public function testGetDstTrue()
{
$this->assertTrue(Carbon::createFromDate(2012, 7, 1, 'America/Toronto')->dst);
}
public function testOffsetForTorontoWithDST()
{
$this->assertSame(-18000, Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->offset);
}
public function testOffsetForTorontoNoDST()
{
$this->assertSame(-14400, Carbon::createFromDate(2012, 6, 1, 'America/Toronto')->offset);
}
public function testOffsetForGMT()
{
$this->assertSame(0, Carbon::createFromDate(2012, 6, 1, 'GMT')->offset);
}
public function testOffsetHoursForTorontoWithDST()
{
$this->assertSame(-5, Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->offsetHours);
}
public function testOffsetHoursForTorontoNoDST()
{
$this->assertSame(-4, Carbon::createFromDate(2012, 6, 1, 'America/Toronto')->offsetHours);
}
public function testOffsetHoursForGMT()
{
$this->assertSame(0, Carbon::createFromDate(2012, 6, 1, 'GMT')->offsetHours);
}
public function testIsLeapYearTrue()
{
$this->assertTrue(Carbon::createFromDate(2012, 1, 1)->isLeapYear());
}
public function testIsLeapYearFalse()
{
$this->assertFalse(Carbon::createFromDate(2011, 1, 1)->isLeapYear());
}
public function testWeekOfMonth()
{
$this->assertSame(5, Carbon::createFromDate(2012, 9, 30)->weekOfMonth);
$this->assertSame(4, Carbon::createFromDate(2012, 9, 28)->weekOfMonth);
$this->assertSame(3, Carbon::createFromDate(2012, 9, 20)->weekOfMonth);
$this->assertSame(2, Carbon::createFromDate(2012, 9, 8)->weekOfMonth);
$this->assertSame(1, Carbon::createFromDate(2012, 9, 1)->weekOfMonth);
}
public function testWeekOfYearFirstWeek()
{
$this->assertSame(52, Carbon::createFromDate(2012, 1, 1)->weekOfYear);
$this->assertSame(1, Carbon::createFromDate(2012, 1, 2)->weekOfYear);
}
public function testWeekOfYearLastWeek()
{
$this->assertSame(52, Carbon::createFromDate(2012, 12, 30)->weekOfYear);
$this->assertSame(1, Carbon::createFromDate(2012, 12, 31)->weekOfYear);
}
public function testGetTimezone()
{
$dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
$this->assertSame('America/Toronto', $dt->timezone->getName());
}
public function testGetTz()
{
$dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
$this->assertSame('America/Toronto', $dt->tz->getName());
}
public function testGetTimezoneName()
{
$dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
$this->assertSame('America/Toronto', $dt->timezoneName);
}
public function testGetTzName()
{
$dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
$this->assertSame('America/Toronto', $dt->tzName);
}
public function testInvalidGetter()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::now();
$bb = $d->doesNotExit;
}
}

35
vendor/nesbot/carbon/tests/InstanceTest.php vendored Executable file
View File

@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class InstanceTest extends TestFixture
{
public function testInstanceFromDateTime()
{
$dating = Carbon::instance(\DateTime::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11'));
$this->assertCarbon($dating, 1975, 5, 21, 22, 32, 11);
}
public function testInstanceFromDateTimeKeepsTimezoneName()
{
$dating = Carbon::instance(\DateTime::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11')->setTimezone(new \DateTimeZone('America/Vancouver')));
$this->assertSame('America/Vancouver', $dating->tzName);
}
public function testInstanceFromDateTimeKeepsMicros()
{
$micro = 254687;
$datetime = \DateTime::createFromFormat('Y-m-d H:i:s.u', '2014-02-01 03:45:27.'.$micro);
$carbon = Carbon::instance($datetime);
$this->assertSame($micro, $carbon->micro);
}
}

133
vendor/nesbot/carbon/tests/IsTest.php vendored Executable file
View File

@ -0,0 +1,133 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class IsTest extends TestFixture
{
public function testIsWeekdayTrue()
{
$this->assertTrue(Carbon::createFromDate(2012, 1, 2)->isWeekday());
}
public function testIsWeekdayFalse()
{
$this->assertFalse(Carbon::createFromDate(2012, 1, 1)->isWeekday());
}
public function testIsWeekendTrue()
{
$this->assertTrue(Carbon::createFromDate(2012, 1, 1)->isWeekend());
}
public function testIsWeekendFalse()
{
$this->assertFalse(Carbon::createFromDate(2012, 1, 2)->isWeekend());
}
public function testIsYesterdayTrue()
{
$this->assertTrue(Carbon::now()->subDay()->isYesterday());
}
public function testIsYesterdayFalseWithToday()
{
$this->assertFalse(Carbon::now()->endOfDay()->isYesterday());
}
public function testIsYesterdayFalseWith2Days()
{
$this->assertFalse(Carbon::now()->subDays(2)->startOfDay()->isYesterday());
}
public function testIsTodayTrue()
{
$this->assertTrue(Carbon::now()->isToday());
}
public function testIsTodayFalseWithYesterday()
{
$this->assertFalse(Carbon::now()->subDay()->endOfDay()->isToday());
}
public function testIsTodayFalseWithTomorrow()
{
$this->assertFalse(Carbon::now()->addDay()->startOfDay()->isToday());
}
public function testIsTodayWithTimezone()
{
$this->assertTrue(Carbon::now('Asia/Tokyo')->isToday());
}
public function testIsTomorrowTrue()
{
$this->assertTrue(Carbon::now()->addDay()->isTomorrow());
}
public function testIsTomorrowFalseWithToday()
{
$this->assertFalse(Carbon::now()->endOfDay()->isTomorrow());
}
public function testIsTomorrowFalseWith2Days()
{
$this->assertFalse(Carbon::now()->addDays(2)->startOfDay()->isTomorrow());
}
public function testIsFutureTrue()
{
$this->assertTrue(Carbon::now()->addSecond()->isFuture());
}
public function testIsFutureFalse()
{
$this->assertFalse(Carbon::now()->isFuture());
}
public function testIsFutureFalseInThePast()
{
$this->assertFalse(Carbon::now()->subSecond()->isFuture());
}
public function testIsPastTrue()
{
$this->assertTrue(Carbon::now()->subSecond()->isPast());
}
public function testIsPastFalse()
{
$this->assertFalse(Carbon::now()->addSecond()->isPast());
$this->assertFalse(Carbon::now()->isPast());
}
public function testIsLeapYearTrue()
{
$this->assertTrue(Carbon::createFromDate(2016, 1, 1)->isLeapYear());
}
public function testIsLeapYearFalse()
{
$this->assertFalse(Carbon::createFromDate(2014, 1, 1)->isLeapYear());
}
public function testIsSameDayTrue()
{
$current = Carbon::createFromDate(2012, 1, 2);
$this->assertTrue($current->isSameDay(Carbon::createFromDate(2012, 1, 2)));
}
public function testIsSameDayFalse()
{
$current = Carbon::createFromDate(2012, 1, 2);
$this->assertFalse($current->isSameDay(Carbon::createFromDate(2012, 1, 3)));
}
}

49
vendor/nesbot/carbon/tests/IssetTest.php vendored Executable file
View File

@ -0,0 +1,49 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class IssetTest extends TestFixture
{
public function testIssetReturnFalseForUnknownProperty()
{
$this->assertFalse(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->sdfsdfss));
}
public function testIssetReturnTrueForProperties()
{
$properties = array(
'year',
'month',
'day',
'hour',
'minute',
'second',
'dayOfWeek',
'dayOfYear',
'daysInMonth',
'timestamp',
'age',
'quarter',
'dst',
'offset',
'offsetHours',
'timezone',
'timezoneName',
'tz',
'tzName',
);
foreach ($properties as $property) {
$this->assertTrue(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->$property));
}
}
}

View File

@ -0,0 +1,411 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\Loader\ArrayLoader;
class LocalizationTest extends TestFixture
{
public function testGetTranslator()
{
$t = Carbon::getTranslator();
$this->assertNotNull($t);
$this->assertSame('en', $t->getLocale());
}
public function testSetTranslator()
{
$t = new Translator('fr');
$t->addLoader('array', new ArrayLoader());
Carbon::setTranslator($t);
$t = Carbon::getTranslator();
$this->assertNotNull($t);
$this->assertSame('fr', $t->getLocale());
}
public function testGetLocale()
{
Carbon::setLocale('en');
$this->assertSame('en', Carbon::getLocale());
}
public function testSetLocale()
{
Carbon::setLocale('en');
$this->assertSame('en', Carbon::getLocale());
Carbon::setLocale('fr');
$this->assertSame('fr', Carbon::getLocale());
}
/**
* The purpose of these tests aren't to test the validitity of the translation
* but more so to test that the language file exists.
*/
public function testDiffForHumansLocalizedInFrench()
{
Carbon::setLocale('fr');
$d = Carbon::now()->subSecond();
$this->assertSame('il y a 1 seconde', $d->diffForHumans());
$d = Carbon::now()->subSeconds(2);
$this->assertSame('il y a 2 secondes', $d->diffForHumans());
$d = Carbon::now()->subMinute();
$this->assertSame('il y a 1 minute', $d->diffForHumans());
$d = Carbon::now()->subMinutes(2);
$this->assertSame('il y a 2 minutes', $d->diffForHumans());
$d = Carbon::now()->subHour();
$this->assertSame('il y a 1 heure', $d->diffForHumans());
$d = Carbon::now()->subHours(2);
$this->assertSame('il y a 2 heures', $d->diffForHumans());
$d = Carbon::now()->subDay();
$this->assertSame('il y a 1 jour', $d->diffForHumans());
$d = Carbon::now()->subDays(2);
$this->assertSame('il y a 2 jours', $d->diffForHumans());
$d = Carbon::now()->subWeek();
$this->assertSame('il y a 1 semaine', $d->diffForHumans());
$d = Carbon::now()->subWeeks(2);
$this->assertSame('il y a 2 semaines', $d->diffForHumans());
$d = Carbon::now()->subMonth();
$this->assertSame('il y a 1 mois', $d->diffForHumans());
$d = Carbon::now()->subMonths(2);
$this->assertSame('il y a 2 mois', $d->diffForHumans());
$d = Carbon::now()->subYear();
$this->assertSame('il y a 1 an', $d->diffForHumans());
$d = Carbon::now()->subYears(2);
$this->assertSame('il y a 2 ans', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$this->assertSame('dans 1 seconde', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$d2 = Carbon::now();
$this->assertSame('1 seconde après', $d->diffForHumans($d2));
$this->assertSame('1 seconde avant', $d2->diffForHumans($d));
$this->assertSame('1 seconde', $d->diffForHumans($d2, true));
$this->assertSame('2 secondes', $d2->diffForHumans($d->addSecond(), true));
}
public function testDiffForHumansLocalizedInSpanish()
{
Carbon::setLocale('es');
$d = Carbon::now()->subSecond();
$this->assertSame('hace 1 segundo', $d->diffForHumans());
$d = Carbon::now()->subSeconds(3);
$this->assertSame('hace 3 segundos', $d->diffForHumans());
$d = Carbon::now()->subMinute();
$this->assertSame('hace 1 minuto', $d->diffForHumans());
$d = Carbon::now()->subMinutes(2);
$this->assertSame('hace 2 minutos', $d->diffForHumans());
$d = Carbon::now()->subHour();
$this->assertSame('hace 1 hora', $d->diffForHumans());
$d = Carbon::now()->subHours(2);
$this->assertSame('hace 2 horas', $d->diffForHumans());
$d = Carbon::now()->subDay();
$this->assertSame('hace 1 día', $d->diffForHumans());
$d = Carbon::now()->subDays(2);
$this->assertSame('hace 2 días', $d->diffForHumans());
$d = Carbon::now()->subWeek();
$this->assertSame('hace 1 semana', $d->diffForHumans());
$d = Carbon::now()->subWeeks(2);
$this->assertSame('hace 2 semanas', $d->diffForHumans());
$d = Carbon::now()->subMonth();
$this->assertSame('hace 1 mes', $d->diffForHumans());
$d = Carbon::now()->subMonths(2);
$this->assertSame('hace 2 meses', $d->diffForHumans());
$d = Carbon::now()->subYear();
$this->assertSame('hace 1 año', $d->diffForHumans());
$d = Carbon::now()->subYears(2);
$this->assertSame('hace 2 años', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$this->assertSame('dentro de 1 segundo', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$d2 = Carbon::now();
$this->assertSame('1 segundo antes', $d->diffForHumans($d2));
$this->assertSame('1 segundo después', $d2->diffForHumans($d));
$this->assertSame('1 segundo', $d->diffForHumans($d2, true));
$this->assertSame('2 segundos', $d2->diffForHumans($d->addSecond(), true));
}
public function testDiffForHumansLocalizedInItalian()
{
Carbon::setLocale('it');
$d = Carbon::now()->addYear();
$this->assertSame('1 anno da adesso', $d->diffForHumans());
$d = Carbon::now()->addYears(2);
$this->assertSame('2 anni da adesso', $d->diffForHumans());
}
public function testDiffForHumansLocalizedInGerman()
{
Carbon::setLocale('de');
$d = Carbon::now()->addYear();
$this->assertSame('in 1 Jahr', $d->diffForHumans());
$d = Carbon::now()->addYears(2);
$this->assertSame('in 2 Jahren', $d->diffForHumans());
$d = Carbon::now()->subYear();
$this->assertSame('1 Jahr später', Carbon::now()->diffForHumans($d));
$d = Carbon::now()->subYears(2);
$this->assertSame('2 Jahre später', Carbon::now()->diffForHumans($d));
$d = Carbon::now()->addYear();
$this->assertSame('1 Jahr zuvor', Carbon::now()->diffForHumans($d));
$d = Carbon::now()->addYears(2);
$this->assertSame('2 Jahre zuvor', Carbon::now()->diffForHumans($d));
$d = Carbon::now()->subYear();
$this->assertSame('vor 1 Jahr', $d->diffForHumans());
$d = Carbon::now()->subYears(2);
$this->assertSame('vor 2 Jahren', $d->diffForHumans());
}
public function testDiffForHumansLocalizedInTurkish()
{
Carbon::setLocale('tr');
$d = Carbon::now()->subSecond();
$this->assertSame('1 saniye önce', $d->diffForHumans());
$d = Carbon::now()->subSeconds(2);
$this->assertSame('2 saniye önce', $d->diffForHumans());
$d = Carbon::now()->subMinute();
$this->assertSame('1 dakika önce', $d->diffForHumans());
$d = Carbon::now()->subMinutes(2);
$this->assertSame('2 dakika önce', $d->diffForHumans());
$d = Carbon::now()->subHour();
$this->assertSame('1 saat önce', $d->diffForHumans());
$d = Carbon::now()->subHours(2);
$this->assertSame('2 saat önce', $d->diffForHumans());
$d = Carbon::now()->subDay();
$this->assertSame('1 gün önce', $d->diffForHumans());
$d = Carbon::now()->subDays(2);
$this->assertSame('2 gün önce', $d->diffForHumans());
$d = Carbon::now()->subWeek();
$this->assertSame('1 hafta önce', $d->diffForHumans());
$d = Carbon::now()->subWeeks(2);
$this->assertSame('2 hafta önce', $d->diffForHumans());
$d = Carbon::now()->subMonth();
$this->assertSame('1 ay önce', $d->diffForHumans());
$d = Carbon::now()->subMonths(2);
$this->assertSame('2 ay önce', $d->diffForHumans());
$d = Carbon::now()->subYear();
$this->assertSame('1 yıl önce', $d->diffForHumans());
$d = Carbon::now()->subYears(2);
$this->assertSame('2 yıl önce', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$this->assertSame('1 saniye andan itibaren', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$d2 = Carbon::now();
$this->assertSame('1 saniye sonra', $d->diffForHumans($d2));
$this->assertSame('1 saniye önce', $d2->diffForHumans($d));
$this->assertSame('1 saniye', $d->diffForHumans($d2, true));
$this->assertSame('2 saniye', $d2->diffForHumans($d->addSecond(), true));
}
public function testDiffForHumansLocalizedInDanish()
{
Carbon::setLocale('da');
$d = Carbon::now()->subSecond();
$this->assertSame('1 sekund siden', $d->diffForHumans());
$d = Carbon::now()->subSeconds(2);
$this->assertSame('2 sekunder siden', $d->diffForHumans());
$d = Carbon::now()->subMinute();
$this->assertSame('1 minut siden', $d->diffForHumans());
$d = Carbon::now()->subMinutes(2);
$this->assertSame('2 minutter siden', $d->diffForHumans());
$d = Carbon::now()->subHour();
$this->assertSame('1 time siden', $d->diffForHumans());
$d = Carbon::now()->subHours(2);
$this->assertSame('2 timer siden', $d->diffForHumans());
$d = Carbon::now()->subDay();
$this->assertSame('1 dag siden', $d->diffForHumans());
$d = Carbon::now()->subDays(2);
$this->assertSame('2 dage siden', $d->diffForHumans());
$d = Carbon::now()->subWeek();
$this->assertSame('1 uge siden', $d->diffForHumans());
$d = Carbon::now()->subWeeks(2);
$this->assertSame('2 uger siden', $d->diffForHumans());
$d = Carbon::now()->subMonth();
$this->assertSame('1 måned siden', $d->diffForHumans());
$d = Carbon::now()->subMonths(2);
$this->assertSame('2 måneder siden', $d->diffForHumans());
$d = Carbon::now()->subYear();
$this->assertSame('1 år siden', $d->diffForHumans());
$d = Carbon::now()->subYears(2);
$this->assertSame('2 år siden', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$this->assertSame('om 1 sekund', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$d2 = Carbon::now();
$this->assertSame('1 sekund efter', $d->diffForHumans($d2));
$this->assertSame('1 sekund før', $d2->diffForHumans($d));
$this->assertSame('1 sekund', $d->diffForHumans($d2, true));
$this->assertSame('2 sekunder', $d2->diffForHumans($d->addSecond(), true));
}
public function testDiffForHumansLocalizedInLithuanian()
{
Carbon::setLocale('lt');
$d = Carbon::now()->addYear();
$this->assertSame('1 metai nuo dabar', $d->diffForHumans());
$d = Carbon::now()->addYears(2);
$this->assertSame('2 metai nuo dabar', $d->diffForHumans());
}
public function testDiffForHumansLocalizedInKorean()
{
Carbon::setLocale('ko');
$d = Carbon::now()->addYear();
$this->assertSame('1 년 후', $d->diffForHumans());
$d = Carbon::now()->addYears(2);
$this->assertSame('2 년 후', $d->diffForHumans());
}
public function testDiffForHumansLocalizedInFarsi()
{
Carbon::setLocale('fa');
$d = Carbon::now()->subSecond();
$this->assertSame('1 ثانیه پیش', $d->diffForHumans());
$d = Carbon::now()->subSeconds(2);
$this->assertSame('2 ثانیه پیش', $d->diffForHumans());
$d = Carbon::now()->subMinute();
$this->assertSame('1 دقیقه پیش', $d->diffForHumans());
$d = Carbon::now()->subMinutes(2);
$this->assertSame('2 دقیقه پیش', $d->diffForHumans());
$d = Carbon::now()->subHour();
$this->assertSame('1 ساعت پیش', $d->diffForHumans());
$d = Carbon::now()->subHours(2);
$this->assertSame('2 ساعت پیش', $d->diffForHumans());
$d = Carbon::now()->subDay();
$this->assertSame('1 روز پیش', $d->diffForHumans());
$d = Carbon::now()->subDays(2);
$this->assertSame('2 روز پیش', $d->diffForHumans());
$d = Carbon::now()->subWeek();
$this->assertSame('1 هفته پیش', $d->diffForHumans());
$d = Carbon::now()->subWeeks(2);
$this->assertSame('2 هفته پیش', $d->diffForHumans());
$d = Carbon::now()->subMonth();
$this->assertSame('1 ماه پیش', $d->diffForHumans());
$d = Carbon::now()->subMonths(2);
$this->assertSame('2 ماه پیش', $d->diffForHumans());
$d = Carbon::now()->subYear();
$this->assertSame('1 سال پیش', $d->diffForHumans());
$d = Carbon::now()->subYears(2);
$this->assertSame('2 سال پیش', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$this->assertSame('1 ثانیه بعد', $d->diffForHumans());
$d = Carbon::now()->addSecond();
$d2 = Carbon::now();
$this->assertSame('1 ثانیه پیش از', $d->diffForHumans($d2));
$this->assertSame('1 ثانیه پس از', $d2->diffForHumans($d));
$d = Carbon::now()->addSecond();
$d2 = Carbon::now();
$this->assertSame('1 ثانیه پیش از', $d->diffForHumans($d2));
$this->assertSame('1 ثانیه پس از', $d2->diffForHumans($d));
$this->assertSame('1 ثانیه', $d->diffForHumans($d2, true));
$this->assertSame('2 ثانیه', $d2->diffForHumans($d->addSecond(), true));
}
}

View File

@ -0,0 +1,79 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class NowAndOtherStaticHelpersTest extends TestFixture
{
public function testNow()
{
$dt = Carbon::now();
$this->assertSame(time(), $dt->timestamp);
}
public function testNowWithTimezone()
{
$dt = Carbon::now('Europe/London');
$this->assertSame(time(), $dt->timestamp);
$this->assertSame('Europe/London', $dt->tzName);
}
public function testToday()
{
$dt = Carbon::today();
$this->assertSame(date('Y-m-d 00:00:00'), $dt->toDateTimeString());
}
public function testTodayWithTimezone()
{
$dt = Carbon::today('Europe/London');
$dt2 = new \DateTime('now', new \DateTimeZone('Europe/London'));
$this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
}
public function testTomorrow()
{
$dt = Carbon::tomorrow();
$dt2 = new \DateTime('tomorrow');
$this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
}
public function testTomorrowWithTimezone()
{
$dt = Carbon::tomorrow('Europe/London');
$dt2 = new \DateTime('tomorrow', new \DateTimeZone('Europe/London'));
$this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
}
public function testYesterday()
{
$dt = Carbon::yesterday();
$dt2 = new \DateTime('yesterday');
$this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
}
public function testYesterdayWithTimezone()
{
$dt = Carbon::yesterday('Europe/London');
$dt2 = new \DateTime('yesterday', new \DateTimeZone('Europe/London'));
$this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
}
public function testMinValue()
{
$this->assertLessThanOrEqual(- 2147483647, Carbon::minValue()->getTimestamp());
}
public function testMaxValue()
{
$this->assertGreaterThanOrEqual(2147483647, Carbon::maxValue()->getTimestamp());
}
}

45
vendor/nesbot/carbon/tests/RelativeTest.php vendored Executable file
View File

@ -0,0 +1,45 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class RelativeTest extends TestFixture
{
public function testSecondsSinceMidnight()
{
$d = Carbon::today()->addSeconds(30);
$this->assertSame(30, $d->secondsSinceMidnight());
$d = Carbon::today()->addDays(1);
$this->assertSame(0, $d->secondsSinceMidnight());
$d = Carbon::today()->addDays(1)->addSeconds(120);
$this->assertSame(120, $d->secondsSinceMidnight());
$d = Carbon::today()->addMonths(3)->addSeconds(42);
$this->assertSame(42, $d->secondsSinceMidnight());
}
public function testSecondsUntilEndOfDay()
{
$d = Carbon::today()->endOfDay();
$this->assertSame(0, $d->secondsUntilEndOfDay());
$d = Carbon::today()->endOfDay()->subSeconds(60);
$this->assertSame(60, $d->secondsUntilEndOfDay());
$d = Carbon::create(2014, 10, 24, 12, 34, 56);
$this->assertSame(41103, $d->secondsUntilEndOfDay());
$d = Carbon::create(2014, 10, 24, 0, 0, 0);
$this->assertSame(86399, $d->secondsUntilEndOfDay());
}
}

253
vendor/nesbot/carbon/tests/SettersTest.php vendored Executable file
View File

@ -0,0 +1,253 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class SettersTest extends TestFixture
{
public function testYearSetter()
{
$d = Carbon::now();
$d->year = 1995;
$this->assertSame(1995, $d->year);
}
public function testMonthSetter()
{
$d = Carbon::now();
$d->month = 3;
$this->assertSame(3, $d->month);
}
public function testMonthSetterWithWrap()
{
$d = Carbon::now();
$d->month = 13;
$this->assertSame(1, $d->month);
}
public function testDaySetter()
{
$d = Carbon::now();
$d->day = 2;
$this->assertSame(2, $d->day);
}
public function testDaySetterWithWrap()
{
$d = Carbon::createFromDate(2012, 8, 5);
$d->day = 32;
$this->assertSame(1, $d->day);
}
public function testHourSetter()
{
$d = Carbon::now();
$d->hour = 2;
$this->assertSame(2, $d->hour);
}
public function testHourSetterWithWrap()
{
$d = Carbon::now();
$d->hour = 25;
$this->assertSame(1, $d->hour);
}
public function testMinuteSetter()
{
$d = Carbon::now();
$d->minute = 2;
$this->assertSame(2, $d->minute);
}
public function testMinuteSetterWithWrap()
{
$d = Carbon::now();
$d->minute = 65;
$this->assertSame(5, $d->minute);
}
public function testSecondSetter()
{
$d = Carbon::now();
$d->second = 2;
$this->assertSame(2, $d->second);
}
public function testTimeSetter()
{
$d = Carbon::now();
$d->setTime(1, 1, 1);
$this->assertSame(1, $d->second);
$d->setTime(1, 1);
$this->assertSame(0, $d->second);
}
public function testTimeSetterWithChaining()
{
$d = Carbon::now();
$d->setTime(2, 2, 2)->setTime(1, 1, 1);
$this->assertInstanceOf('Carbon\Carbon', $d);
$this->assertSame(1, $d->second);
$d->setTime(2, 2, 2)->setTime(1, 1);
$this->assertInstanceOf('Carbon\Carbon', $d);
$this->assertSame(0, $d->second);
}
public function testTimeSetterWithZero()
{
$d = Carbon::now();
$d->setTime(1, 1);
$this->assertSame(0, $d->second);
}
public function testDateTimeSetter()
{
$d = Carbon::now();
$d->setDateTime($d->year, $d->month, $d->day, 1, 1, 1);
$this->assertSame(1, $d->second);
}
public function testDateTimeSetterWithZero()
{
$d = Carbon::now();
$d->setDateTime($d->year, $d->month, $d->day, 1, 1);
$this->assertSame(0, $d->second);
}
public function testDateTimeSetterWithChaining()
{
$d = Carbon::now();
$d->setDateTime(2013, 9, 24, 17, 4, 29);
$this->assertInstanceOf('Carbon\Carbon', $d);
$d->setDateTime(2014, 10, 25, 18, 5, 30);
$this->assertInstanceOf('Carbon\Carbon', $d);
$this->assertCarbon($d, 2014, 10, 25, 18, 5, 30);
}
public function testSecondSetterWithWrap()
{
$d = Carbon::now();
$d->second = 65;
$this->assertSame(5, $d->second);
}
public function testTimestampSetter()
{
$d = Carbon::now();
$d->timestamp = 10;
$this->assertSame(10, $d->timestamp);
$d->setTimestamp(11);
$this->assertSame(11, $d->timestamp);
}
public function testSetTimezoneWithInvalidTimezone()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::now();
$d->setTimezone('sdf');
}
public function testTimezoneWithInvalidTimezone()
{
$d = Carbon::now();
try {
$d->timezone = 'sdf';
$this->fail('InvalidArgumentException was not been raised.');
} catch (InvalidArgumentException $expected) {
}
try {
$d->timezone('sdf');
$this->fail('InvalidArgumentException was not been raised.');
} catch (InvalidArgumentException $expected) {
}
}
public function testTzWithInvalidTimezone()
{
$d = Carbon::now();
try {
$d->tz = 'sdf';
$this->fail('InvalidArgumentException was not been raised.');
} catch (InvalidArgumentException $expected) {
}
try {
$d->tz('sdf');
$this->fail('InvalidArgumentException was not been raised.');
} catch (InvalidArgumentException $expected) {
}
}
public function testSetTimezoneUsingString()
{
$d = Carbon::now();
$d->setTimezone('America/Toronto');
$this->assertSame('America/Toronto', $d->tzName);
}
public function testTimezoneUsingString()
{
$d = Carbon::now();
$d->timezone = 'America/Toronto';
$this->assertSame('America/Toronto', $d->tzName);
$d->timezone('America/Vancouver');
$this->assertSame('America/Vancouver', $d->tzName);
}
public function testTzUsingString()
{
$d = Carbon::now();
$d->tz = 'America/Toronto';
$this->assertSame('America/Toronto', $d->tzName);
$d->tz('America/Vancouver');
$this->assertSame('America/Vancouver', $d->tzName);
}
public function testSetTimezoneUsingDateTimeZone()
{
$d = Carbon::now();
$d->setTimezone(new \DateTimeZone('America/Toronto'));
$this->assertSame('America/Toronto', $d->tzName);
}
public function testTimezoneUsingDateTimeZone()
{
$d = Carbon::now();
$d->timezone = new \DateTimeZone('America/Toronto');
$this->assertSame('America/Toronto', $d->tzName);
$d->timezone(new \DateTimeZone('America/Vancouver'));
$this->assertSame('America/Vancouver', $d->tzName);
}
public function testTzUsingDateTimeZone()
{
$d = Carbon::now();
$d->tz = new \DateTimeZone('America/Toronto');
$this->assertSame('America/Toronto', $d->tzName);
$d->tz(new \DateTimeZone('America/Vancouver'));
$this->assertSame('America/Vancouver', $d->tzName);
}
public function testInvalidSetter()
{
$this->setExpectedException('InvalidArgumentException');
$d = Carbon::now();
$d->doesNotExit = 'bb';
}
}

236
vendor/nesbot/carbon/tests/StartEndOfTest.php vendored Executable file
View File

@ -0,0 +1,236 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class StartEndOfTest extends TestFixture
{
public function testStartOfDay()
{
$dt = Carbon::now();
$this->assertTrue($dt->startOfDay() instanceof Carbon);
$this->assertCarbon($dt, $dt->year, $dt->month, $dt->day, 0, 0, 0);
}
public function testEndOfDay()
{
$dt = Carbon::now();
$this->assertTrue($dt->endOfDay() instanceof Carbon);
$this->assertCarbon($dt, $dt->year, $dt->month, $dt->day, 23, 59, 59);
}
public function testStartOfMonthIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->startOfMonth() instanceof Carbon);
}
public function testStartOfMonthFromNow()
{
$dt = Carbon::now()->startOfMonth();
$this->assertCarbon($dt, $dt->year, $dt->month, 1, 0, 0, 0);
}
public function testStartOfMonthFromLastDay()
{
$dt = Carbon::create(2000, 1, 31, 2, 3, 4)->startOfMonth();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testStartOfYearIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->startOfYear() instanceof Carbon);
}
public function testStartOfYearFromNow()
{
$dt = Carbon::now()->startOfYear();
$this->assertCarbon($dt, $dt->year, 1, 1, 0, 0, 0);
}
public function testStartOfYearFromFirstDay()
{
$dt = Carbon::create(2000, 1, 1, 1, 1, 1)->startOfYear();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testStartOfYearFromLastDay()
{
$dt = Carbon::create(2000, 12, 31, 23, 59, 59)->startOfYear();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testEndOfMonthIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->endOfMonth() instanceof Carbon);
}
public function testEndOfMonth()
{
$dt = Carbon::create(2000, 1, 1, 2, 3, 4)->endOfMonth();
$this->assertCarbon($dt, 2000, 1, 31, 23, 59, 59);
}
public function testEndOfMonthFromLastDay()
{
$dt = Carbon::create(2000, 1, 31, 2, 3, 4)->endOfMonth();
$this->assertCarbon($dt, 2000, 1, 31, 23, 59, 59);
}
public function testEndOfYearIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->endOfYear() instanceof Carbon);
}
public function testEndOfYearFromNow()
{
$dt = Carbon::now()->endOfYear();
$this->assertCarbon($dt, $dt->year, 12, 31, 23, 59, 59);
}
public function testEndOfYearFromFirstDay()
{
$dt = Carbon::create(2000, 1, 1, 1, 1, 1)->endOfYear();
$this->assertCarbon($dt, 2000, 12, 31, 23, 59, 59);
}
public function testEndOfYearFromLastDay()
{
$dt = Carbon::create(2000, 12, 31, 23, 59, 59)->endOfYear();
$this->assertCarbon($dt, 2000, 12, 31, 23, 59, 59);
}
public function testStartOfDecadeIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->startOfDecade() instanceof Carbon);
}
public function testStartOfDecadeFromNow()
{
$dt = Carbon::now()->startOfDecade();
$this->assertCarbon($dt, $dt->year - $dt->year % 10, 1, 1, 0, 0, 0);
}
public function testStartOfDecadeFromFirstDay()
{
$dt = Carbon::create(2000, 1, 1, 1, 1, 1)->startOfDecade();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testStartOfDecadeFromLastDay()
{
$dt = Carbon::create(2009, 12, 31, 23, 59, 59)->startOfDecade();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testEndOfDecadeIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->endOfDecade() instanceof Carbon);
}
public function testEndOfDecadeFromNow()
{
$dt = Carbon::now()->endOfDecade();
$this->assertCarbon($dt, $dt->year - $dt->year % 10 + 9, 12, 31, 23, 59, 59);
}
public function testEndOfDecadeFromFirstDay()
{
$dt = Carbon::create(2000, 1, 1, 1, 1, 1)->endOfDecade();
$this->assertCarbon($dt, 2009, 12, 31, 23, 59, 59);
}
public function testEndOfDecadeFromLastDay()
{
$dt = Carbon::create(2009, 12, 31, 23, 59, 59)->endOfDecade();
$this->assertCarbon($dt, 2009, 12, 31, 23, 59, 59);
}
public function testStartOfCenturyIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->startOfCentury() instanceof Carbon);
}
public function testStartOfCenturyFromNow()
{
$dt = Carbon::now()->startOfCentury();
$this->assertCarbon($dt, $dt->year - $dt->year % 100, 1, 1, 0, 0, 0);
}
public function testStartOfCenturyFromFirstDay()
{
$dt = Carbon::create(2000, 1, 1, 1, 1, 1)->startOfCentury();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testStartOfCenturyFromLastDay()
{
$dt = Carbon::create(2009, 12, 31, 23, 59, 59)->startOfCentury();
$this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
}
public function testEndOfCenturyIsFluid()
{
$dt = Carbon::now();
$this->assertTrue($dt->endOfCentury() instanceof Carbon);
}
public function testEndOfCenturyFromNow()
{
$dt = Carbon::now()->endOfCentury();
$this->assertCarbon($dt, $dt->year - $dt->year % 100 + 99, 12, 31, 23, 59, 59);
}
public function testEndOfCenturyFromFirstDay()
{
$dt = Carbon::create(2000, 1, 1, 1, 1, 1)->endOfCentury();
$this->assertCarbon($dt, 2099, 12, 31, 23, 59, 59);
}
public function testEndOfCenturyFromLastDay()
{
$dt = Carbon::create(2099, 12, 31, 23, 59, 59)->endOfCentury();
$this->assertCarbon($dt, 2099, 12, 31, 23, 59, 59);
}
public function testAverageIsFluid()
{
$dt = Carbon::now()->average();
$this->assertTrue($dt instanceof Carbon);
}
public function testAverageFromSame()
{
$dt1 = Carbon::create(2000, 1, 31, 2, 3, 4);
$dt2 = Carbon::create(2000, 1, 31, 2, 3, 4)->average($dt1);
$this->assertCarbon($dt2, 2000, 1, 31, 2, 3, 4);
}
public function testAverageFromGreater()
{
$dt1 = Carbon::create(2000, 1, 1, 1, 1, 1);
$dt2 = Carbon::create(2009, 12, 31, 23, 59, 59)->average($dt1);
$this->assertCarbon($dt2, 2004, 12, 31, 12, 30, 30);
}
public function testAverageFromLower()
{
$dt1 = Carbon::create(2009, 12, 31, 23, 59, 59);
$dt2 = Carbon::create(2000, 1, 1, 1, 1, 1)->average($dt1);
$this->assertCarbon($dt2, 2004, 12, 31, 12, 30, 30);
}
}

157
vendor/nesbot/carbon/tests/StringsTest.php vendored Executable file
View File

@ -0,0 +1,157 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class MyCarbon extends Carbon
{
}
class StringsTest extends TestFixture
{
public function testToString()
{
$d = Carbon::now();
$this->assertSame(Carbon::now()->toDateTimeString(), ''.$d);
}
public function testSetToStringFormat()
{
Carbon::setToStringFormat('jS \o\f F, Y g:i:s a');
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('25th of December, 1975 2:15:16 pm', ''.$d);
}
public function testResetToStringFormat()
{
$d = Carbon::now();
Carbon::setToStringFormat('123');
Carbon::resetToStringFormat();
$this->assertSame($d->toDateTimeString(), ''.$d);
}
public function testExtendedClassToString()
{
$d = MyCarbon::now();
$this->assertSame($d->toDateTimeString(), ''.$d);
}
public function testToDateString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('1975-12-25', $d->toDateString());
}
public function testToFormattedDateString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Dec 25, 1975', $d->toFormattedDateString());
}
public function testToLocalizedFormattedDateString()
{
/****************
Working out a Travis issue on how to set a different locale
other than EN to test this.
$cache = setlocale(LC_TIME, 0);
setlocale(LC_TIME, 'German');
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Donnerstag 25 Dezember 1975', $d->formatLocalized('%A %d %B %Y'));
setlocale(LC_TIME, $cache);
*****************/
}
public function testToLocalizedFormattedTimezonedDateString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16, 'Europe/London');
$this->assertSame('Thursday 25 December 1975 14:15', $d->formatLocalized('%A %d %B %Y %H:%M'));
}
public function testToTimeString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('14:15:16', $d->toTimeString());
}
public function testToDateTimeString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('1975-12-25 14:15:16', $d->toDateTimeString());
}
public function testToDateTimeStringWithPaddedZeroes()
{
$d = Carbon::create(2000, 5, 2, 4, 3, 4);
$this->assertSame('2000-05-02 04:03:04', $d->toDateTimeString());
}
public function testToDayDateTimeString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thu, Dec 25, 1975 2:15 PM', $d->toDayDateTimeString());
}
public function testToAtomString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('1975-12-25T14:15:16-05:00', $d->toAtomString());
}
public function testToCOOKIEString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
if (\DateTime::COOKIE === 'l, d-M-y H:i:s T') {
$cookieString = 'Thursday, 25-Dec-75 14:15:16 EST';
} else {
$cookieString = 'Thursday, 25-Dec-1975 14:15:16 EST';
}
$this->assertSame($cookieString, $d->toCOOKIEString());
}
public function testToIso8601String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('1975-12-25T14:15:16-0500', $d->toIso8601String());
}
public function testToRC822String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thu, 25 Dec 75 14:15:16 -0500', $d->toRfc822String());
}
public function testToRfc850String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thursday, 25-Dec-75 14:15:16 EST', $d->toRfc850String());
}
public function testToRfc1036String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thu, 25 Dec 75 14:15:16 -0500', $d->toRfc1036String());
}
public function testToRfc1123String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRfc1123String());
}
public function testToRfc2822String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRfc2822String());
}
public function testToRfc3339String()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('1975-12-25T14:15:16-05:00', $d->toRfc3339String());
}
public function testToRssString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRssString());
}
public function testToW3cString()
{
$d = Carbon::create(1975, 12, 25, 14, 15, 16);
$this->assertSame('1975-12-25T14:15:16-05:00', $d->toW3cString());
}
}

214
vendor/nesbot/carbon/tests/SubTest.php vendored Executable file
View File

@ -0,0 +1,214 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class SubTest extends TestFixture
{
public function testSubYearsPositive()
{
$this->assertSame(1974, Carbon::createFromDate(1975)->subYears(1)->year);
}
public function testSubYearsZero()
{
$this->assertSame(1975, Carbon::createFromDate(1975)->subYears(0)->year);
}
public function testSubYearsNegative()
{
$this->assertSame(1976, Carbon::createFromDate(1975)->subYears(-1)->year);
}
public function testSubYear()
{
$this->assertSame(1974, Carbon::createFromDate(1975)->subYear()->year);
}
public function testSubMonthsPositive()
{
$this->assertSame(12, Carbon::createFromDate(1975, 1, 1)->subMonths(1)->month);
}
public function testSubMonthsZero()
{
$this->assertSame(1, Carbon::createFromDate(1975, 1, 1)->subMonths(0)->month);
}
public function testSubMonthsNegative()
{
$this->assertSame(2, Carbon::createFromDate(1975, 1, 1)->subMonths(-1)->month);
}
public function testSubMonth()
{
$this->assertSame(12, Carbon::createFromDate(1975, 1, 1)->subMonth()->month);
}
public function testSubDaysPositive()
{
$this->assertSame(30, Carbon::createFromDate(1975, 5, 1)->subDays(1)->day);
}
public function testSubDaysZero()
{
$this->assertSame(1, Carbon::createFromDate(1975, 5, 1)->subDays(0)->day);
}
public function testSubDaysNegative()
{
$this->assertSame(2, Carbon::createFromDate(1975, 5, 1)->subDays(-1)->day);
}
public function testSubDay()
{
$this->assertSame(30, Carbon::createFromDate(1975, 5, 1)->subDay()->day);
}
public function testSubWeekdaysPositive()
{
$this->assertSame(22, Carbon::createFromDate(2012, 1, 4)->subWeekdays(9)->day);
}
public function testSubWeekdaysZero()
{
$this->assertSame(4, Carbon::createFromDate(2012, 1, 4)->subWeekdays(0)->day);
}
public function testSubWeekdaysNegative()
{
$this->assertSame(13, Carbon::createFromDate(2012, 1, 31)->subWeekdays(-9)->day);
}
public function testSubWeekday()
{
$this->assertSame(6, Carbon::createFromDate(2012, 1, 9)->subWeekday()->day);
}
public function testSubWeeksPositive()
{
$this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->subWeeks(1)->day);
}
public function testSubWeeksZero()
{
$this->assertSame(21, Carbon::createFromDate(1975, 5, 21)->subWeeks(0)->day);
}
public function testSubWeeksNegative()
{
$this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->subWeeks(-1)->day);
}
public function testSubWeek()
{
$this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->subWeek()->day);
}
public function testSubHoursPositive()
{
$this->assertSame(23, Carbon::createFromTime(0)->subHours(1)->hour);
}
public function testSubHoursZero()
{
$this->assertSame(0, Carbon::createFromTime(0)->subHours(0)->hour);
}
public function testSubHoursNegative()
{
$this->assertSame(1, Carbon::createFromTime(0)->subHours(-1)->hour);
}
public function testSubHour()
{
$this->assertSame(23, Carbon::createFromTime(0)->subHour()->hour);
}
public function testSubMinutesPositive()
{
$this->assertSame(59, Carbon::createFromTime(0, 0)->subMinutes(1)->minute);
}
public function testSubMinutesZero()
{
$this->assertSame(0, Carbon::createFromTime(0, 0)->subMinutes(0)->minute);
}
public function testSubMinutesNegative()
{
$this->assertSame(1, Carbon::createFromTime(0, 0)->subMinutes(-1)->minute);
}
public function testSubMinute()
{
$this->assertSame(59, Carbon::createFromTime(0, 0)->subMinute()->minute);
}
public function testSubSecondsPositive()
{
$this->assertSame(59, Carbon::createFromTime(0, 0, 0)->subSeconds(1)->second);
}
public function testSubSecondsZero()
{
$this->assertSame(0, Carbon::createFromTime(0, 0, 0)->subSeconds(0)->second);
}
public function testSubSecondsNegative()
{
$this->assertSame(1, Carbon::createFromTime(0, 0, 0)->subSeconds(-1)->second);
}
public function testSubSecond()
{
$this->assertSame(59, Carbon::createFromTime(0, 0, 0)->subSecond()->second);
}
/***** Test non plural methods with non default args *****/
public function testSubYearPassingArg()
{
$this->assertSame(1973, Carbon::createFromDate(1975)->subYear(2)->year);
}
public function testSubMonthPassingArg()
{
$this->assertSame(3, Carbon::createFromDate(1975, 5, 1)->subMonth(2)->month);
}
public function testSubMonthNoOverflowPassingArg()
{
$dt = Carbon::createFromDate(2011, 4, 30)->subMonthNoOverflow(2);
$this->assertSame(2, $dt->month);
$this->assertSame(28, $dt->day);
}
public function testSubDayPassingArg()
{
$this->assertSame(8, Carbon::createFromDate(1975, 5, 10)->subDay(2)->day);
}
public function testSubHourPassingArg()
{
$this->assertSame(22, Carbon::createFromTime(0)->subHour(2)->hour);
}
public function testSubMinutePassingArg()
{
$this->assertSame(58, Carbon::createFromTime(0)->subMinute(2)->minute);
}
public function testSubSecondPassingArg()
{
$this->assertSame(58, Carbon::createFromTime(0)->subSecond(2)->second);
}
}

87
vendor/nesbot/carbon/tests/TestFixture.php vendored Executable file
View File

@ -0,0 +1,87 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require __DIR__.'/../vendor/autoload.php';
use Carbon\Carbon;
use Carbon\CarbonInterval;
class TestFixture extends \PHPUnit_Framework_TestCase
{
private $saveTz;
protected function setUp()
{
//save current timezone
$this->saveTz = date_default_timezone_get();
date_default_timezone_set('America/Toronto');
}
protected function tearDown()
{
date_default_timezone_set($this->saveTz);
}
protected function assertCarbon(Carbon $d, $year, $month, $day, $hour = null, $minute = null, $second = null)
{
$this->assertSame($year, $d->year, 'Carbon->year');
$this->assertSame($month, $d->month, 'Carbon->month');
$this->assertSame($day, $d->day, 'Carbon->day');
if ($hour !== null) {
$this->assertSame($hour, $d->hour, 'Carbon->hour');
}
if ($minute !== null) {
$this->assertSame($minute, $d->minute, 'Carbon->minute');
}
if ($second !== null) {
$this->assertSame($second, $d->second, 'Carbon->second');
}
}
protected function assertInstanceOfCarbon($d)
{
$this->assertInstanceOf('Carbon\Carbon', $d);
}
protected function assertCarbonInterval(CarbonInterval $ci, $years, $months = null, $days = null, $hours = null, $minutes = null, $seconds = null)
{
$this->assertSame($years, $ci->years, 'CarbonInterval->years');
if ($months !== null) {
$this->assertSame($months, $ci->months, 'CarbonInterval->months');
}
if ($days !== null) {
$this->assertSame($days, $ci->dayz, 'CarbonInterval->dayz');
}
if ($hours !== null) {
$this->assertSame($hours, $ci->hours, 'CarbonInterval->hours');
}
if ($minutes !== null) {
$this->assertSame($minutes, $ci->minutes, 'CarbonInterval->minutes');
}
if ($seconds !== null) {
$this->assertSame($seconds, $ci->seconds, 'CarbonInterval->seconds');
}
}
protected function assertInstanceOfCarbonInterval($d)
{
$this->assertInstanceOf('Carbon\CarbonInterval', $d);
}
}

124
vendor/nesbot/carbon/tests/TestingAidsTest.php vendored Executable file
View File

@ -0,0 +1,124 @@
<?php
/*
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Carbon\Carbon;
class TestingAidsTest extends TestFixture
{
public function testTestingAidsWithTestNowNotSet()
{
Carbon::setTestNow();
$this->assertFalse(Carbon::hasTestNow());
$this->assertNull(Carbon::getTestNow());
}
public function testTestingAidsWithTestNowSet()
{
$notNow = Carbon::yesterday();
Carbon::setTestNow($notNow);
$this->assertTrue(Carbon::hasTestNow());
$this->assertSame($notNow, Carbon::getTestNow());
}
public function testConstructorWithTestValueSet()
{
$notNow = Carbon::yesterday();
Carbon::setTestNow($notNow);
$this->assertEquals($notNow, new Carbon());
$this->assertEquals($notNow, new Carbon(null));
$this->assertEquals($notNow, new Carbon(''));
$this->assertEquals($notNow, new Carbon('now'));
}
public function testNowWithTestValueSet()
{
$notNow = Carbon::yesterday();
Carbon::setTestNow($notNow);
$this->assertEquals($notNow, Carbon::now());
}
public function testParseWithTestValueSet()
{
$notNow = Carbon::yesterday();
Carbon::setTestNow($notNow);
$this->assertEquals($notNow, Carbon::parse());
$this->assertEquals($notNow, Carbon::parse(null));
$this->assertEquals($notNow, Carbon::parse(''));
$this->assertEquals($notNow, Carbon::parse('now'));
}
public function testParseRelativeWithTestValueSet()
{
$notNow = Carbon::parse('2013-09-01 05:15:05');
Carbon::setTestNow($notNow);
$this->assertSame('2013-09-01 05:10:05', Carbon::parse('5 minutes ago')->toDateTimeString());
$this->assertSame('2013-08-25 05:15:05', Carbon::parse('1 week ago')->toDateTimeString());
$this->assertSame('2013-09-02 00:00:00', Carbon::parse('tomorrow')->toDateTimeString());
$this->assertSame('2013-08-31 00:00:00', Carbon::parse('yesterday')->toDateTimeString());
$this->assertSame('2013-09-02 05:15:05', Carbon::parse('+1 day')->toDateTimeString());
$this->assertSame('2013-08-31 05:15:05', Carbon::parse('-1 day')->toDateTimeString());
$this->assertSame('2013-09-02 00:00:00', Carbon::parse('next monday')->toDateTimeString());
$this->assertSame('2013-09-03 00:00:00', Carbon::parse('next tuesday')->toDateTimeString());
$this->assertSame('2013-09-04 00:00:00', Carbon::parse('next wednesday')->toDateTimeString());
$this->assertSame('2013-09-05 00:00:00', Carbon::parse('next thursday')->toDateTimeString());
$this->assertSame('2013-09-06 00:00:00', Carbon::parse('next friday')->toDateTimeString());
$this->assertSame('2013-09-07 00:00:00', Carbon::parse('next saturday')->toDateTimeString());
$this->assertSame('2013-09-08 00:00:00', Carbon::parse('next sunday')->toDateTimeString());
$this->assertSame('2013-08-26 00:00:00', Carbon::parse('last monday')->toDateTimeString());
$this->assertSame('2013-08-27 00:00:00', Carbon::parse('last tuesday')->toDateTimeString());
$this->assertSame('2013-08-28 00:00:00', Carbon::parse('last wednesday')->toDateTimeString());
$this->assertSame('2013-08-29 00:00:00', Carbon::parse('last thursday')->toDateTimeString());
$this->assertSame('2013-08-30 00:00:00', Carbon::parse('last friday')->toDateTimeString());
$this->assertSame('2013-08-31 00:00:00', Carbon::parse('last saturday')->toDateTimeString());
$this->assertSame('2013-08-25 00:00:00', Carbon::parse('last sunday')->toDateTimeString());
$this->assertSame('2013-09-02 00:00:00', Carbon::parse('this monday')->toDateTimeString());
$this->assertSame('2013-09-03 00:00:00', Carbon::parse('this tuesday')->toDateTimeString());
$this->assertSame('2013-09-04 00:00:00', Carbon::parse('this wednesday')->toDateTimeString());
$this->assertSame('2013-09-05 00:00:00', Carbon::parse('this thursday')->toDateTimeString());
$this->assertSame('2013-09-06 00:00:00', Carbon::parse('this friday')->toDateTimeString());
$this->assertSame('2013-09-07 00:00:00', Carbon::parse('this saturday')->toDateTimeString());
$this->assertSame('2013-09-01 00:00:00', Carbon::parse('this sunday')->toDateTimeString());
$this->assertSame('2013-10-01 05:15:05', Carbon::parse('first day of next month')->toDateTimeString());
$this->assertSame('2013-09-30 05:15:05', Carbon::parse('last day of this month')->toDateTimeString());
}
public function testParseRelativeWithMinusSignsInDate()
{
$notNow = Carbon::parse('2013-09-01 05:15:05');
Carbon::setTestNow($notNow);
$this->assertSame('2000-01-03 00:00:00', Carbon::parse('2000-1-3')->toDateTimeString());
$this->assertSame('2000-10-10 00:00:00', Carbon::parse('2000-10-10')->toDateTimeString());
}
public function testTimeZoneWithTestValueSet()
{
$notNow = Carbon::parse('2013-07-01 12:00:00', 'America/New_York');
Carbon::setTestNow($notNow);
$this->assertSame('2013-07-01T12:00:00-0400', Carbon::parse('now')->toIso8601String());
$this->assertSame('2013-07-01T11:00:00-0500', Carbon::parse('now', 'America/Mexico_City')->toIso8601String());
$this->assertSame('2013-07-01T09:00:00-0700', Carbon::parse('now', 'America/Vancouver')->toIso8601String());
}
}