Simple Calendar – Google Calendar Plugin - Version 3.1.16

Version Description

  • June 6, 2018 =
  • Fix: Issue with slow loading admin settings page.
Download this release

Release Info

Developer simplecalendar
Plugin Icon 128x128 Simple Calendar – Google Calendar Plugin
Version 3.1.16
Comparing to
See all releases

Code changes from version 3.1.15 to 3.1.16

Files changed (74) hide show
  1. assets/css/admin-add-calendar.min.css +1 -1
  2. assets/css/admin.min.css +1 -1
  3. assets/css/default-calendar-grid.min.css +1 -1
  4. assets/css/default-calendar-list.min.css +1 -1
  5. assets/js/admin-add-calendar.min.js +1 -1
  6. assets/js/admin.min.js +1 -1
  7. assets/js/default-calendar.min.js +1 -1
  8. google-calendar-events.php +2 -2
  9. includes/main.php +7 -1
  10. readme.txt +4 -1
  11. vendor/nesbot/carbon/phpunit.xml.dist +0 -24
  12. vendor/nesbot/carbon/tests/AbstractTestCase.php +0 -125
  13. vendor/nesbot/carbon/tests/Carbon/AddMonthsTest.php +0 -316
  14. vendor/nesbot/carbon/tests/Carbon/AddTest.php +0 -268
  15. vendor/nesbot/carbon/tests/Carbon/ComparisonTest.php +0 -248
  16. vendor/nesbot/carbon/tests/Carbon/ConstructTest.php +0 -110
  17. vendor/nesbot/carbon/tests/Carbon/CopyTest.php +0 -41
  18. vendor/nesbot/carbon/tests/Carbon/CreateFromDateTest.php +0 -63
  19. vendor/nesbot/carbon/tests/Carbon/CreateFromFormatTest.php +0 -100
  20. vendor/nesbot/carbon/tests/Carbon/CreateFromTimeTest.php +0 -74
  21. vendor/nesbot/carbon/tests/Carbon/CreateFromTimestampTest.php +0 -56
  22. vendor/nesbot/carbon/tests/Carbon/CreateSafeTest.php +0 -195
  23. vendor/nesbot/carbon/tests/Carbon/CreateTest.php +0 -185
  24. vendor/nesbot/carbon/tests/Carbon/DayOfWeekModifiersTest.php +0 -406
  25. vendor/nesbot/carbon/tests/Carbon/DiffTest.php +0 -1216
  26. vendor/nesbot/carbon/tests/Carbon/ExpressiveComparisonTest.php +0 -217
  27. vendor/nesbot/carbon/tests/Carbon/Fixtures/MyCarbon.php +0 -19
  28. vendor/nesbot/carbon/tests/Carbon/FluidSettersTest.php +0 -116
  29. vendor/nesbot/carbon/tests/Carbon/GettersTest.php +0 -327
  30. vendor/nesbot/carbon/tests/Carbon/InstanceTest.php +0 -60
  31. vendor/nesbot/carbon/tests/Carbon/IsTest.php +0 -388
  32. vendor/nesbot/carbon/tests/Carbon/IssetTest.php +0 -63
  33. vendor/nesbot/carbon/tests/Carbon/LocalizationTest.php +0 -164
  34. vendor/nesbot/carbon/tests/Carbon/ModifyTest.php +0 -34
  35. vendor/nesbot/carbon/tests/Carbon/NowAndOtherStaticHelpersTest.php +0 -84
  36. vendor/nesbot/carbon/tests/Carbon/RelativeTest.php +0 -48
  37. vendor/nesbot/carbon/tests/Carbon/SerializationTest.php +0 -69
  38. vendor/nesbot/carbon/tests/Carbon/SettersTest.php +0 -305
  39. vendor/nesbot/carbon/tests/Carbon/StartEndOfTest.php +0 -314
  40. vendor/nesbot/carbon/tests/Carbon/StringsTest.php +0 -191
  41. vendor/nesbot/carbon/tests/Carbon/SubTest.php +0 -223
  42. vendor/nesbot/carbon/tests/Carbon/TestingAidsTest.php +0 -142
  43. vendor/nesbot/carbon/tests/CarbonInterval/AddTest.php +0 -40
  44. vendor/nesbot/carbon/tests/CarbonInterval/ConstructTest.php +0 -238
  45. vendor/nesbot/carbon/tests/CarbonInterval/ForHumansTest.php +0 -131
  46. vendor/nesbot/carbon/tests/CarbonInterval/GettersTest.php +0 -75
  47. vendor/nesbot/carbon/tests/CarbonInterval/SettersTest.php +0 -102
  48. vendor/nesbot/carbon/tests/CarbonInterval/SpecTest.php +0 -91
  49. vendor/nesbot/carbon/tests/Localization/CaTest.php +0 -79
  50. vendor/nesbot/carbon/tests/Localization/DaTest.php +0 -79
  51. vendor/nesbot/carbon/tests/Localization/DeTest.php +0 -74
  52. vendor/nesbot/carbon/tests/Localization/EnTest.php +0 -79
  53. vendor/nesbot/carbon/tests/Localization/EsTest.php +0 -79
  54. vendor/nesbot/carbon/tests/Localization/FaTest.php +0 -84
  55. vendor/nesbot/carbon/tests/Localization/FoTest.php +0 -79
  56. vendor/nesbot/carbon/tests/Localization/FrTest.php +0 -79
  57. vendor/nesbot/carbon/tests/Localization/GlTest.php +0 -79
  58. vendor/nesbot/carbon/tests/Localization/HuTest.php +0 -208
  59. vendor/nesbot/carbon/tests/Localization/HyTest.php +0 -79
  60. vendor/nesbot/carbon/tests/Localization/ItTest.php +0 -32
  61. vendor/nesbot/carbon/tests/Localization/JaTest.php +0 -79
  62. vendor/nesbot/carbon/tests/Localization/KaTest.php +0 -79
  63. vendor/nesbot/carbon/tests/Localization/KmTest.php +0 -79
  64. vendor/nesbot/carbon/tests/Localization/KoTest.php +0 -32
  65. vendor/nesbot/carbon/tests/Localization/LtTest.php +0 -128
  66. vendor/nesbot/carbon/tests/Localization/MkTest.php +0 -79
  67. vendor/nesbot/carbon/tests/Localization/NlTest.php +0 -79
  68. vendor/nesbot/carbon/tests/Localization/PtTest.php +0 -198
  69. vendor/nesbot/carbon/tests/Localization/SrMeTest.php +0 -985
  70. vendor/nesbot/carbon/tests/Localization/TrTest.php +0 -79
  71. vendor/nesbot/carbon/tests/Localization/UkTest.php +0 -79
  72. vendor/nesbot/carbon/tests/Localization/UrTest.php +0 -81
  73. vendor/nesbot/carbon/tests/Localization/UzTest.php +0 -79
  74. vendor/nesbot/carbon/tests/Localization/ZhTest.php +0 -79
assets/css/admin-add-calendar.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
assets/css/admin.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
assets/css/default-calendar-grid.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
assets/css/default-calendar-list.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
assets/js/admin-add-calendar.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
assets/js/admin.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
assets/js/default-calendar.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Simple Calendar - 3.1.15
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
1
+ /*! Simple Calendar - 3.1.16
2
  * https://simplecalendar.io
3
  * Copyright (c) Moonstone Media 2018
4
  * Licensed GPLv2+ */
google-calendar-events.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Add Google Calendar events to your WordPress site in minutes. Beautiful calendar displays. Fully responsive.
6
  * Author: Simple Calendar
7
  * Author URI: https://simplecalendar.io
8
- * Version: 3.1.15
9
  * Text Domain: google-calendar-events
10
  * Domain Path: /i18n
11
  *
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  $this_plugin_path = trailingslashit( dirname( __FILE__ ) );
22
  $this_plugin_dir = plugin_dir_url( __FILE__ );
23
  $this_plugin_constants = array(
24
- 'SIMPLE_CALENDAR_VERSION' => '3.1.15',
25
  'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
26
  'SIMPLE_CALENDAR_URL' => $this_plugin_dir,
27
  'SIMPLE_CALENDAR_ASSETS' => $this_plugin_dir . 'assets/',
5
  * Description: Add Google Calendar events to your WordPress site in minutes. Beautiful calendar displays. Fully responsive.
6
  * Author: Simple Calendar
7
  * Author URI: https://simplecalendar.io
8
+ * Version: 3.1.16
9
  * Text Domain: google-calendar-events
10
  * Domain Path: /i18n
11
  *
21
  $this_plugin_path = trailingslashit( dirname( __FILE__ ) );
22
  $this_plugin_dir = plugin_dir_url( __FILE__ );
23
  $this_plugin_constants = array(
24
+ 'SIMPLE_CALENDAR_VERSION' => '3.1.16',
25
  'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__,
26
  'SIMPLE_CALENDAR_URL' => $this_plugin_dir,
27
  'SIMPLE_CALENDAR_ASSETS' => $this_plugin_dir . 'assets/',
includes/main.php CHANGED
@@ -216,7 +216,13 @@ final class Plugin {
216
  * @since 3.0.0
217
  */
218
  public function register_settings() {
219
- if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
 
 
 
 
 
 
220
  $settings = new Admin\Pages();
221
  $settings->register_settings( $settings->get_settings() );
222
  }
216
  * @since 3.0.0
217
  */
218
  public function register_settings() {
219
+ if (
220
+ is_admin()
221
+ && ! defined( 'DOING_AJAX' )
222
+ && isset( $_GET['page'] )
223
+ && 'simple-calendar_settings' === $_GET['page']
224
+ || 'update' === $_POST['action']
225
+ ) {
226
  $settings = new Admin\Pages();
227
  $settings->register_settings( $settings->get_settings() );
228
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: google calendar, calendar, calendars, google, event calendar, custom calen
4
  Requires at least: 4.2
5
  Requires PHP: 5.3+
6
  Tested up to: 4.9
7
- Stable tag: 3.1.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -97,6 +97,9 @@ We'd love your help! Here's a few things you can do:
97
 
98
  == Changelog ==
99
 
 
 
 
100
  = 3.1.15 - May 22, 2018 =
101
  * Fix: Issue with jQuery $.ajax call parameter compatibility with older versions of jQuery.
102
  * Fix: Issue with Google API feed sorting not showing correct events in list view.
4
  Requires at least: 4.2
5
  Requires PHP: 5.3+
6
  Tested up to: 4.9
7
+ Stable tag: 3.1.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
97
 
98
  == Changelog ==
99
 
100
+ = 3.1.16 - June 6, 2018 =
101
+ * Fix: Issue with slow loading admin settings page.
102
+
103
  = 3.1.15 - May 22, 2018 =
104
  * Fix: Issue with jQuery $.ajax call parameter compatibility with older versions of jQuery.
105
  * Fix: Issue with Google API feed sorting not showing correct events in list view.
vendor/nesbot/carbon/phpunit.xml.dist DELETED
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <phpunit backupGlobals="false"
3
- backupStaticAttributes="false"
4
- bootstrap="vendor/autoload.php"
5
- colors="true"
6
- convertErrorsToExceptions="true"
7
- convertNoticesToExceptions="true"
8
- convertWarningsToExceptions="true"
9
- processIsolation="false"
10
- stopOnFailure="false"
11
- >
12
-
13
- <filter>
14
- <whitelist>
15
- <directory>src/Carbon</directory>
16
- </whitelist>
17
- </filter>
18
-
19
- <testsuites>
20
- <testsuite name="Carbon Test Suite">
21
- <directory>tests</directory>
22
- </testsuite>
23
- </testsuites>
24
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/AbstractTestCase.php DELETED
@@ -1,125 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests;
13
-
14
- use Carbon\Carbon;
15
- use Carbon\CarbonInterval;
16
- use Closure;
17
- use PHPUnit_Framework_TestCase;
18
-
19
- abstract class AbstractTestCase extends PHPUnit_Framework_TestCase
20
- {
21
- private $saveTz;
22
-
23
- protected function setUp()
24
- {
25
- //save current timezone
26
- $this->saveTz = date_default_timezone_get();
27
-
28
- date_default_timezone_set('America/Toronto');
29
- }
30
-
31
- protected function tearDown()
32
- {
33
- date_default_timezone_set($this->saveTz);
34
- Carbon::setTestNow();
35
- Carbon::resetMonthsOverflow();
36
- }
37
-
38
- protected function assertCarbon(Carbon $d, $year, $month, $day, $hour = null, $minute = null, $second = null)
39
- {
40
- $actual = array(
41
- 'years' => $year,
42
- 'months' => $month,
43
- 'day' => $day,
44
- );
45
-
46
- $expected = array(
47
- 'years' => $d->year,
48
- 'months' => $d->month,
49
- 'day' => $d->day,
50
- );
51
-
52
- if ($hour !== null) {
53
- $expected['hours'] = $d->hour;
54
- $actual['hours'] = $hour;
55
- }
56
-
57
- if ($minute !== null) {
58
- $expected['minutes'] = $d->minute;
59
- $actual['minutes'] = $minute;
60
- }
61
-
62
- if ($second !== null) {
63
- $expected['seconds'] = $d->second;
64
- $actual['seconds'] = $second;
65
- }
66
-
67
- $this->assertSame($expected, $actual);
68
- }
69
-
70
- protected function assertInstanceOfCarbon($d)
71
- {
72
- $this->assertInstanceOf('Carbon\Carbon', $d);
73
- }
74
-
75
- protected function assertCarbonInterval(CarbonInterval $ci, $years, $months = null, $days = null, $hours = null, $minutes = null, $seconds = null)
76
- {
77
- $expected = array('years' => $ci->years);
78
-
79
- $actual = array('years' => $years);
80
-
81
- if ($months !== null) {
82
- $expected['months'] = $ci->months;
83
- $actual['months'] = $months;
84
- }
85
-
86
- if ($days !== null) {
87
- $expected['days'] = $ci->dayz;
88
- $actual['days'] = $days;
89
- }
90
-
91
- if ($hours !== null) {
92
- $expected['hours'] = $ci->hours;
93
- $actual['hours'] = $hours;
94
- }
95
-
96
- if ($minutes !== null) {
97
- $expected['minutes'] = $ci->minutes;
98
- $actual['minutes'] = $minutes;
99
- }
100
-
101
- if ($seconds !== null) {
102
- $expected['seconds'] = $ci->seconds;
103
- $actual['seconds'] = $seconds;
104
- }
105
-
106
- $this->assertSame($expected, $actual);
107
- }
108
-
109
- protected function assertInstanceOfCarbonInterval($d)
110
- {
111
- $this->assertInstanceOf('Carbon\CarbonInterval', $d);
112
- }
113
-
114
- protected function wrapWithTestNow(Closure $func, Carbon $dt = null)
115
- {
116
- Carbon::setTestNow($dt ?: Carbon::now());
117
- $func();
118
- Carbon::setTestNow();
119
- }
120
-
121
- protected function wrapWithNonDstDate(Closure $func)
122
- {
123
- static::wrapWithTestNow($func, Carbon::now()->startOfYear());
124
- }
125
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/AddMonthsTest.php DELETED
@@ -1,316 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class AddMonthsTest extends AbstractTestCase
18
- {
19
- /**
20
- * @var \Carbon\Carbon
21
- */
22
- private $carbon;
23
-
24
- protected function setUp()
25
- {
26
- parent::setUp();
27
-
28
- $this->carbon = Carbon::create(2016, 1, 31);
29
- }
30
-
31
- public function providerTestAddMonthNoOverflow()
32
- {
33
- return array(
34
- array(-2, 2015, 11, 30),
35
- array(-1, 2015, 12, 31),
36
- array(0, 2016, 1, 31),
37
- array(1, 2016, 2, 29),
38
- array(2, 2016, 3, 31),
39
- );
40
- }
41
-
42
- /**
43
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow
44
- *
45
- * @param $months
46
- * @param int $y
47
- * @param int $m
48
- * @param int $d
49
- */
50
- public function testAddMonthNoOverflow($months, $y, $m, $d)
51
- {
52
- $this->assertCarbon($this->carbon->addMonthNoOverflow($months), $y, $m, $d);
53
- }
54
-
55
- /**
56
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow
57
- *
58
- * @param $months
59
- * @param int $y
60
- * @param int $m
61
- * @param int $d
62
- */
63
- public function testAddMonthsNoOverflow($months, $y, $m, $d)
64
- {
65
- $this->assertCarbon($this->carbon->addMonthsNoOverflow($months), $y, $m, $d);
66
- }
67
-
68
- public function providerTestSubMonthNoOverflow()
69
- {
70
- return array(
71
- array(-2, 2016, 3, 31),
72
- array(-1, 2016, 2, 29),
73
- array(0, 2016, 1, 31),
74
- array(1, 2015, 12, 31),
75
- array(2, 2015, 11, 30),
76
- );
77
- }
78
-
79
- /**
80
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow
81
- *
82
- * @param $months
83
- * @param int $y
84
- * @param int $m
85
- * @param int $d
86
- */
87
- public function testSubMonthNoOverflow($months, $y, $m, $d)
88
- {
89
- $this->assertCarbon($this->carbon->subMonthNoOverflow($months), $y, $m, $d);
90
- }
91
-
92
- /**
93
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow
94
- *
95
- * @param $months
96
- * @param int $y
97
- * @param int $m
98
- * @param int $d
99
- */
100
- public function testSubMonthsNoOverflow($months, $y, $m, $d)
101
- {
102
- $this->assertCarbon($this->carbon->subMonthsNoOverflow($months), $y, $m, $d);
103
- }
104
-
105
- public function providerTestAddMonthWithOverflow()
106
- {
107
- return array(
108
- array(-2, 2015, 12, 1),
109
- array(-1, 2015, 12, 31),
110
- array(0, 2016, 1, 31),
111
- array(1, 2016, 3, 2),
112
- array(2, 2016, 3, 31),
113
- );
114
- }
115
-
116
- /**
117
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow
118
- *
119
- * @param $months
120
- * @param int $y
121
- * @param int $m
122
- * @param int $d
123
- */
124
- public function testAddMonthWithOverflow($months, $y, $m, $d)
125
- {
126
- $this->assertCarbon($this->carbon->addMonthWithOverflow($months), $y, $m, $d);
127
- }
128
-
129
- /**
130
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow
131
- *
132
- * @param $months
133
- * @param int $y
134
- * @param int $m
135
- * @param int $d
136
- */
137
- public function testAddMonthsWithOverflow($months, $y, $m, $d)
138
- {
139
- $this->assertCarbon($this->carbon->addMonthsWithOverflow($months), $y, $m, $d);
140
- }
141
-
142
- public function providerTestSubMonthWithOverflow()
143
- {
144
- return array(
145
- array(-2, 2016, 3, 31),
146
- array(-1, 2016, 3, 2),
147
- array(0, 2016, 1, 31),
148
- array(1, 2015, 12, 31),
149
- array(2, 2015, 12, 1),
150
- );
151
- }
152
-
153
- /**
154
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow
155
- *
156
- * @param $months
157
- * @param int $y
158
- * @param int $m
159
- * @param int $d
160
- */
161
- public function testSubMonthWithOverflow($months, $y, $m, $d)
162
- {
163
- $this->assertCarbon($this->carbon->subMonthWithOverflow($months), $y, $m, $d);
164
- }
165
-
166
- /**
167
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow
168
- *
169
- * @param $months
170
- * @param int $y
171
- * @param int $m
172
- * @param int $d
173
- */
174
- public function testSubMonthsWithOverflow($months, $y, $m, $d)
175
- {
176
- $this->assertCarbon($this->carbon->subMonthsWithOverflow($months), $y, $m, $d);
177
- }
178
-
179
- public function testSetOverflowIsTrue()
180
- {
181
- Carbon::useMonthsOverflow(true);
182
- $this->assertTrue(Carbon::shouldOverflowMonths());
183
- }
184
-
185
- public function testSetOverflowIsFalse()
186
- {
187
- Carbon::useMonthsOverflow(false);
188
- $this->assertFalse(Carbon::shouldOverflowMonths());
189
- }
190
-
191
- public function testSetOverflowIsResetInTests()
192
- {
193
- $this->assertTrue(Carbon::shouldOverflowMonths());
194
- }
195
-
196
- public function testSetOverflowIsReset()
197
- {
198
- Carbon::useMonthsOverflow(false);
199
- $this->assertFalse(Carbon::shouldOverflowMonths());
200
-
201
- Carbon::resetMonthsOverflow();
202
- $this->assertTrue(Carbon::shouldOverflowMonths());
203
- }
204
-
205
- /**
206
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow
207
- *
208
- * @param $months
209
- * @param int $y
210
- * @param int $m
211
- * @param int $d
212
- */
213
- public function testUseOverflowAddMonth($months, $y, $m, $d)
214
- {
215
- Carbon::useMonthsOverflow(true);
216
- $this->assertCarbon($this->carbon->addMonth($months), $y, $m, $d);
217
- }
218
-
219
- /**
220
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthWithOverflow
221
- *
222
- * @param $months
223
- * @param int $y
224
- * @param int $m
225
- * @param int $d
226
- */
227
- public function testUseOverflowAddMonths($months, $y, $m, $d)
228
- {
229
- Carbon::useMonthsOverflow(true);
230
- $this->assertCarbon($this->carbon->addMonths($months), $y, $m, $d);
231
- }
232
-
233
- /**
234
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow
235
- *
236
- * @param $months
237
- * @param int $y
238
- * @param int $m
239
- * @param int $d
240
- */
241
- public function testUseOverflowSubMonth($months, $y, $m, $d)
242
- {
243
- Carbon::useMonthsOverflow(true);
244
- $this->assertCarbon($this->carbon->subMonth($months), $y, $m, $d);
245
- }
246
-
247
- /**
248
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthWithOverflow
249
- *
250
- * @param $months
251
- * @param int $y
252
- * @param int $m
253
- * @param int $d
254
- */
255
- public function testUseOverflowSubMonths($months, $y, $m, $d)
256
- {
257
- Carbon::useMonthsOverflow(true);
258
- $this->assertCarbon($this->carbon->subMonths($months), $y, $m, $d);
259
- }
260
-
261
- /**
262
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow
263
- *
264
- * @param $months
265
- * @param int $y
266
- * @param int $m
267
- * @param int $d
268
- */
269
- public function testSkipOverflowAddMonth($months, $y, $m, $d)
270
- {
271
- Carbon::useMonthsOverflow(false);
272
- $this->assertCarbon($this->carbon->addMonth($months), $y, $m, $d);
273
- }
274
-
275
- /**
276
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestAddMonthNoOverflow
277
- *
278
- * @param $months
279
- * @param int $y
280
- * @param int $m
281
- * @param int $d
282
- */
283
- public function testSkipOverflowAddMonths($months, $y, $m, $d)
284
- {
285
- Carbon::useMonthsOverflow(false);
286
- $this->assertCarbon($this->carbon->addMonths($months), $y, $m, $d);
287
- }
288
-
289
- /**
290
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow
291
- *
292
- * @param $months
293
- * @param int $y
294
- * @param int $m
295
- * @param int $d
296
- */
297
- public function testSkipOverflowSubMonth($months, $y, $m, $d)
298
- {
299
- Carbon::useMonthsOverflow(false);
300
- $this->assertCarbon($this->carbon->subMonth($months), $y, $m, $d);
301
- }
302
-
303
- /**
304
- * @dataProvider \Tests\Carbon\AddMonthsTest::providerTestSubMonthNoOverflow
305
- *
306
- * @param $months
307
- * @param int $y
308
- * @param int $m
309
- * @param int $d
310
- */
311
- public function testSkipOverflowSubMonths($months, $y, $m, $d)
312
- {
313
- Carbon::useMonthsOverflow(false);
314
- $this->assertCarbon($this->carbon->subMonths($months), $y, $m, $d);
315
- }
316
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/AddTest.php DELETED
@@ -1,268 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class AddTest extends AbstractTestCase
18
- {
19
- public function testAddYearsPositive()
20
- {
21
- $this->assertSame(1976, Carbon::createFromDate(1975)->addYears(1)->year);
22
- }
23
-
24
- public function testAddYearsZero()
25
- {
26
- $this->assertSame(1975, Carbon::createFromDate(1975)->addYears(0)->year);
27
- }
28
-
29
- public function testAddYearsNegative()
30
- {
31
- $this->assertSame(1974, Carbon::createFromDate(1975)->addYears(-1)->year);
32
- }
33
-
34
- public function testAddYear()
35
- {
36
- $this->assertSame(1976, Carbon::createFromDate(1975)->addYear()->year);
37
- }
38
-
39
- public function testAddDaysPositive()
40
- {
41
- $this->assertSame(1, Carbon::createFromDate(1975, 5, 31)->addDays(1)->day);
42
- }
43
-
44
- public function testAddDaysZero()
45
- {
46
- $this->assertSame(31, Carbon::createFromDate(1975, 5, 31)->addDays(0)->day);
47
- }
48
-
49
- public function testAddDaysNegative()
50
- {
51
- $this->assertSame(30, Carbon::createFromDate(1975, 5, 31)->addDays(-1)->day);
52
- }
53
-
54
- public function testAddDay()
55
- {
56
- $this->assertSame(1, Carbon::createFromDate(1975, 5, 31)->addDay()->day);
57
- }
58
-
59
- public function testAddWeekdaysPositive()
60
- {
61
- $dt = Carbon::create(2012, 1, 4, 13, 2, 1)->addWeekdays(9);
62
-
63
- $this->assertSame(17, $dt->day);
64
-
65
- // test for https://bugs.php.net/bug.php?id=54909
66
- $this->assertSame(13, $dt->hour);
67
- $this->assertSame(2, $dt->minute);
68
- $this->assertSame(1, $dt->second);
69
- }
70
-
71
- public function testAddWeekdaysZero()
72
- {
73
- $this->assertSame(4, Carbon::createFromDate(2012, 1, 4)->addWeekdays(0)->day);
74
- }
75
-
76
- public function testAddWeekdaysNegative()
77
- {
78
- $this->assertSame(18, Carbon::createFromDate(2012, 1, 31)->addWeekdays(-9)->day);
79
- }
80
-
81
- public function testAddWeekday()
82
- {
83
- $this->assertSame(9, Carbon::createFromDate(2012, 1, 6)->addWeekday()->day);
84
- }
85
-
86
- public function testAddWeekdayDuringWeekend()
87
- {
88
- $this->assertSame(9, Carbon::createFromDate(2012, 1, 7)->addWeekday()->day);
89
- }
90
-
91
- public function testAddWeeksPositive()
92
- {
93
- $this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->addWeeks(1)->day);
94
- }
95
-
96
- public function testAddWeeksZero()
97
- {
98
- $this->assertSame(21, Carbon::createFromDate(1975, 5, 21)->addWeeks(0)->day);
99
- }
100
-
101
- public function testAddWeeksNegative()
102
- {
103
- $this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->addWeeks(-1)->day);
104
- }
105
-
106
- public function testAddWeek()
107
- {
108
- $this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->addWeek()->day);
109
- }
110
-
111
- public function testAddHoursPositive()
112
- {
113
- $this->assertSame(1, Carbon::createFromTime(0)->addHours(1)->hour);
114
- }
115
-
116
- public function testAddHoursZero()
117
- {
118
- $this->assertSame(0, Carbon::createFromTime(0)->addHours(0)->hour);
119
- }
120
-
121
- public function testAddHoursNegative()
122
- {
123
- $this->assertSame(23, Carbon::createFromTime(0)->addHours(-1)->hour);
124
- }
125
-
126
- public function testAddHour()
127
- {
128
- $this->assertSame(1, Carbon::createFromTime(0)->addHour()->hour);
129
- }
130
-
131
- public function testAddMinutesPositive()
132
- {
133
- $this->assertSame(1, Carbon::createFromTime(0, 0)->addMinutes(1)->minute);
134
- }
135
-
136
- public function testAddMinutesZero()
137
- {
138
- $this->assertSame(0, Carbon::createFromTime(0, 0)->addMinutes(0)->minute);
139
- }
140
-
141
- public function testAddMinutesNegative()
142
- {
143
- $this->assertSame(59, Carbon::createFromTime(0, 0)->addMinutes(-1)->minute);
144
- }
145
-
146
- public function testAddMinute()
147
- {
148
- $this->assertSame(1, Carbon::createFromTime(0, 0)->addMinute()->minute);
149
- }
150
-
151
- public function testAddSecondsPositive()
152
- {
153
- $this->assertSame(1, Carbon::createFromTime(0, 0, 0)->addSeconds(1)->second);
154
- }
155
-
156
- public function testAddSecondsZero()
157
- {
158
- $this->assertSame(0, Carbon::createFromTime(0, 0, 0)->addSeconds(0)->second);
159
- }
160
-
161
- public function testAddSecondsNegative()
162
- {
163
- $this->assertSame(59, Carbon::createFromTime(0, 0, 0)->addSeconds(-1)->second);
164
- }
165
-
166
- public function testAddSecond()
167
- {
168
- $this->assertSame(1, Carbon::createFromTime(0, 0, 0)->addSecond()->second);
169
- }
170
-
171
- /**
172
- * Test non plural methods with non default args.
173
- */
174
- public function testAddYearPassingArg()
175
- {
176
- $this->assertSame(1977, Carbon::createFromDate(1975)->addYear(2)->year);
177
- }
178
-
179
- public function testAddDayPassingArg()
180
- {
181
- $this->assertSame(12, Carbon::createFromDate(1975, 5, 10)->addDay(2)->day);
182
- }
183
-
184
- public function testAddHourPassingArg()
185
- {
186
- $this->assertSame(2, Carbon::createFromTime(0)->addHour(2)->hour);
187
- }
188
-
189
- public function testAddMinutePassingArg()
190
- {
191
- $this->assertSame(2, Carbon::createFromTime(0)->addMinute(2)->minute);
192
- }
193
-
194
- public function testAddSecondPassingArg()
195
- {
196
- $this->assertSame(2, Carbon::createFromTime(0)->addSecond(2)->second);
197
- }
198
-
199
- public function testAddQuarter()
200
- {
201
- $this->assertSame(8, Carbon::createFromDate(1975, 5, 6)->addQuarter()->month);
202
- }
203
-
204
- public function testAddQuarterNegative()
205
- {
206
- $this->assertSame(2, Carbon::createFromDate(1975, 5, 6)->addQuarter(-1)->month);
207
- }
208
-
209
- public function testSubQuarter()
210
- {
211
- $this->assertSame(2, Carbon::createFromDate(1975, 5, 6)->subQuarter()->month);
212
- }
213
-
214
- public function testSubQuarterNegative()
215
- {
216
- $this->assertCarbon(Carbon::createFromDate(1975, 5, 6)->subQuarters(2), 1974, 11, 6);
217
- }
218
-
219
- public function testAddCentury()
220
- {
221
- $this->assertSame(2075, Carbon::createFromDate(1975)->addCentury()->year);
222
- $this->assertSame(2075, Carbon::createFromDate(1975)->addCentury(1)->year);
223
- $this->assertSame(2175, Carbon::createFromDate(1975)->addCentury(2)->year);
224
- }
225
-
226
- public function testAddCenturyNegative()
227
- {
228
- $this->assertSame(1875, Carbon::createFromDate(1975)->addCentury(-1)->year);
229
- $this->assertSame(1775, Carbon::createFromDate(1975)->addCentury(-2)->year);
230
- }
231
-
232
- public function testAddCenturies()
233
- {
234
- $this->assertSame(2075, Carbon::createFromDate(1975)->addCenturies(1)->year);
235
- $this->assertSame(2175, Carbon::createFromDate(1975)->addCenturies(2)->year);
236
- }
237
-
238
- public function testAddCenturiesNegative()
239
- {
240
- $this->assertSame(1875, Carbon::createFromDate(1975)->addCenturies(-1)->year);
241
- $this->assertSame(1775, Carbon::createFromDate(1975)->addCenturies(-2)->year);
242
- }
243
-
244
- public function testSubCentury()
245
- {
246
- $this->assertSame(1875, Carbon::createFromDate(1975)->subCentury()->year);
247
- $this->assertSame(1875, Carbon::createFromDate(1975)->subCentury(1)->year);
248
- $this->assertSame(1775, Carbon::createFromDate(1975)->subCentury(2)->year);
249
- }
250
-
251
- public function testSubCenturyNegative()
252
- {
253
- $this->assertSame(2075, Carbon::createFromDate(1975)->subCentury(-1)->year);
254
- $this->assertSame(2175, Carbon::createFromDate(1975)->subCentury(-2)->year);
255
- }
256
-
257
- public function testSubCenturies()
258
- {
259
- $this->assertSame(1875, Carbon::createFromDate(1975)->subCenturies(1)->year);
260
- $this->assertSame(1775, Carbon::createFromDate(1975)->subCenturies(2)->year);
261
- }
262
-
263
- public function testSubCenturiesNegative()
264
- {
265
- $this->assertSame(2075, Carbon::createFromDate(1975)->subCenturies(-1)->year);
266
- $this->assertSame(2175, Carbon::createFromDate(1975)->subCenturies(-2)->year);
267
- }
268
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/ComparisonTest.php DELETED
@@ -1,248 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class ComparisonTest extends AbstractTestCase
18
- {
19
- public function testEqualToTrue()
20
- {
21
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->eq(Carbon::createFromDate(2000, 1, 1)));
22
- }
23
-
24
- public function testEqualToFalse()
25
- {
26
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->eq(Carbon::createFromDate(2000, 1, 2)));
27
- }
28
-
29
- public function testEqualWithTimezoneTrue()
30
- {
31
- $this->assertTrue(Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto')->eq(Carbon::create(2000, 1, 1, 9, 0, 0, 'America/Vancouver')));
32
- }
33
-
34
- public function testEqualWithTimezoneFalse()
35
- {
36
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->eq(Carbon::createFromDate(2000, 1, 1, 'America/Vancouver')));
37
- }
38
-
39
- public function testNotEqualToTrue()
40
- {
41
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->ne(Carbon::createFromDate(2000, 1, 2)));
42
- }
43
-
44
- public function testNotEqualToFalse()
45
- {
46
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->ne(Carbon::createFromDate(2000, 1, 1)));
47
- }
48
-
49
- public function testNotEqualWithTimezone()
50
- {
51
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->ne(Carbon::createFromDate(2000, 1, 1, 'America/Vancouver')));
52
- }
53
-
54
- public function testGreaterThanTrue()
55
- {
56
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->gt(Carbon::createFromDate(1999, 12, 31)));
57
- }
58
-
59
- public function testGreaterThanFalse()
60
- {
61
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->gt(Carbon::createFromDate(2000, 1, 2)));
62
- }
63
-
64
- public function testGreaterThanWithTimezoneTrue()
65
- {
66
- $dt1 = Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto');
67
- $dt2 = Carbon::create(2000, 1, 1, 8, 59, 59, 'America/Vancouver');
68
- $this->assertTrue($dt1->gt($dt2));
69
- }
70
-
71
- public function testGreaterThanWithTimezoneFalse()
72
- {
73
- $dt1 = Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto');
74
- $dt2 = Carbon::create(2000, 1, 1, 9, 0, 1, 'America/Vancouver');
75
- $this->assertFalse($dt1->gt($dt2));
76
- }
77
-
78
- public function testGreaterThanOrEqualTrue()
79
- {
80
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->gte(Carbon::createFromDate(1999, 12, 31)));
81
- }
82
-
83
- public function testGreaterThanOrEqualTrueEqual()
84
- {
85
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->gte(Carbon::createFromDate(2000, 1, 1)));
86
- }
87
-
88
- public function testGreaterThanOrEqualFalse()
89
- {
90
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->gte(Carbon::createFromDate(2000, 1, 2)));
91
- }
92
-
93
- public function testLessThanTrue()
94
- {
95
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lt(Carbon::createFromDate(2000, 1, 2)));
96
- }
97
-
98
- public function testLessThanFalse()
99
- {
100
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->lt(Carbon::createFromDate(1999, 12, 31)));
101
- }
102
-
103
- public function testLessThanOrEqualTrue()
104
- {
105
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lte(Carbon::createFromDate(2000, 1, 2)));
106
- }
107
-
108
- public function testLessThanOrEqualTrueEqual()
109
- {
110
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lte(Carbon::createFromDate(2000, 1, 1)));
111
- }
112
-
113
- public function testLessThanOrEqualFalse()
114
- {
115
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->lte(Carbon::createFromDate(1999, 12, 31)));
116
- }
117
-
118
- public function testBetweenEqualTrue()
119
- {
120
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), true));
121
- }
122
-
123
- public function testBetweenNotEqualTrue()
124
- {
125
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), false));
126
- }
127
-
128
- public function testBetweenEqualFalse()
129
- {
130
- $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), true));
131
- }
132
-
133
- public function testBetweenNotEqualFalse()
134
- {
135
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 1), Carbon::createFromDate(2000, 1, 31), false));
136
- }
137
-
138
- public function testBetweenEqualSwitchTrue()
139
- {
140
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), true));
141
- }
142
-
143
- public function testBetweenNotEqualSwitchTrue()
144
- {
145
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), false));
146
- }
147
-
148
- public function testBetweenEqualSwitchFalse()
149
- {
150
- $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), true));
151
- }
152
-
153
- public function testBetweenNotEqualSwitchFalse()
154
- {
155
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 31), Carbon::createFromDate(2000, 1, 1), false));
156
- }
157
-
158
- public function testMinIsFluid()
159
- {
160
- $dt = Carbon::now();
161
- $this->assertInstanceOfCarbon($dt->min());
162
- }
163
-
164
- public function testMinWithNow()
165
- {
166
- $dt = Carbon::create(2012, 1, 1, 0, 0, 0)->min();
167
- $this->assertCarbon($dt, 2012, 1, 1, 0, 0, 0);
168
- }
169
-
170
- public function testMinWithInstance()
171
- {
172
- $dt1 = Carbon::create(2013, 12, 31, 23, 59, 59);
173
- $dt2 = Carbon::create(2012, 1, 1, 0, 0, 0)->min($dt1);
174
- $this->assertCarbon($dt2, 2012, 1, 1, 0, 0, 0);
175
- }
176
-
177
- public function testMaxIsFluid()
178
- {
179
- $dt = Carbon::now();
180
- $this->assertInstanceOfCarbon($dt->max());
181
- }
182
-
183
- public function testMaxWithNow()
184
- {
185
- $dt = Carbon::create(2099, 12, 31, 23, 59, 59)->max();
186
- $this->assertCarbon($dt, 2099, 12, 31, 23, 59, 59);
187
- }
188
-
189
- public function testMaxWithInstance()
190
- {
191
- $dt1 = Carbon::create(2012, 1, 1, 0, 0, 0);
192
- $dt2 = Carbon::create(2099, 12, 31, 23, 59, 59)->max($dt1);
193
- $this->assertCarbon($dt2, 2099, 12, 31, 23, 59, 59);
194
- }
195
-
196
- public function testIsBirthday()
197
- {
198
- $dt = Carbon::now();
199
- $aBirthday = $dt->subYear();
200
- $this->assertTrue($aBirthday->isBirthday());
201
- $notABirthday = $dt->subDay();
202
- $this->assertFalse($notABirthday->isBirthday());
203
- $alsoNotABirthday = $dt->addDays(2);
204
- $this->assertFalse($alsoNotABirthday->isBirthday());
205
-
206
- $dt1 = Carbon::createFromDate(1987, 4, 23);
207
- $dt2 = Carbon::createFromDate(2014, 9, 26);
208
- $dt3 = Carbon::createFromDate(2014, 4, 23);
209
- $this->assertFalse($dt2->isBirthday($dt1));
210
- $this->assertTrue($dt3->isBirthday($dt1));
211
- }
212
-
213
- public function testClosest()
214
- {
215
- $instance = Carbon::create(2015, 5, 28, 12, 0, 0);
216
- $dt1 = Carbon::create(2015, 5, 28, 11, 0, 0);
217
- $dt2 = Carbon::create(2015, 5, 28, 14, 0, 0);
218
- $closest = $instance->closest($dt1, $dt2);
219
- $this->assertSame($dt1, $closest);
220
- }
221
-
222
- public function testClosestWithEquals()
223
- {
224
- $instance = Carbon::create(2015, 5, 28, 12, 0, 0);
225
- $dt1 = Carbon::create(2015, 5, 28, 12, 0, 0);
226
- $dt2 = Carbon::create(2015, 5, 28, 14, 0, 0);
227
- $closest = $instance->closest($dt1, $dt2);
228
- $this->assertSame($dt1, $closest);
229
- }
230
-
231
- public function testFarthest()
232
- {
233
- $instance = Carbon::create(2015, 5, 28, 12, 0, 0);
234
- $dt1 = Carbon::create(2015, 5, 28, 11, 0, 0);
235
- $dt2 = Carbon::create(2015, 5, 28, 14, 0, 0);
236
- $farthest = $instance->farthest($dt1, $dt2);
237
- $this->assertSame($dt2, $farthest);
238
- }
239
-
240
- public function testFarthestWithEquals()
241
- {
242
- $instance = Carbon::create(2015, 5, 28, 12, 0, 0);
243
- $dt1 = Carbon::create(2015, 5, 28, 12, 0, 0);
244
- $dt2 = Carbon::create(2015, 5, 28, 14, 0, 0);
245
- $farthest = $instance->farthest($dt1, $dt2);
246
- $this->assertSame($dt2, $farthest);
247
- }
248
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/ConstructTest.php DELETED
@@ -1,110 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTime;
16
- use DateTimeZone;
17
- use Tests\AbstractTestCase;
18
-
19
- class ConstructTest extends AbstractTestCase
20
- {
21
- public function testCreatesAnInstanceDefaultToNow()
22
- {
23
- $c = new Carbon();
24
- $now = Carbon::now();
25
- $this->assertInstanceOfCarbon($c);
26
- $this->assertSame($now->tzName, $c->tzName);
27
- $this->assertCarbon($c, $now->year, $now->month, $now->day, $now->hour, $now->minute, $now->second);
28
- }
29
-
30
- public function testParseCreatesAnInstanceDefaultToNow()
31
- {
32
- $c = Carbon::parse();
33
- $now = Carbon::now();
34
- $this->assertInstanceOfCarbon($c);
35
- $this->assertSame($now->tzName, $c->tzName);
36
- $this->assertCarbon($c, $now->year, $now->month, $now->day, $now->hour, $now->minute, $now->second);
37
- }
38
-
39
- public function testWithFancyString()
40
- {
41
- $c = new Carbon('first day of January 2008');
42
- $this->assertCarbon($c, 2008, 1, 1, 0, 0, 0);
43
- }
44
-
45
- public function testParseWithFancyString()
46
- {
47
- $c = Carbon::parse('first day of January 2008');
48
- $this->assertCarbon($c, 2008, 1, 1, 0, 0, 0);
49
- }
50
-
51
- public function testDefaultTimezone()
52
- {
53
- $c = new Carbon('now');
54
- $this->assertSame('America/Toronto', $c->tzName);
55
- }
56
-
57
- public function testParseWithDefaultTimezone()
58
- {
59
- $c = Carbon::parse('now');
60
- $this->assertSame('America/Toronto', $c->tzName);
61
- }
62
-
63
- public function testSettingTimezone()
64
- {
65
- $timezone = 'Europe/London';
66
- $dtz = new DateTimeZone($timezone);
67
- $dt = new DateTime('now', $dtz);
68
- $dayLightSavingTimeOffset = $dt->format('I');
69
-
70
- $c = new Carbon('now', $dtz);
71
- $this->assertSame($timezone, $c->tzName);
72
- $this->assertSame(0 + $dayLightSavingTimeOffset, $c->offsetHours);
73
- }
74
-
75
- public function testParseSettingTimezone()
76
- {
77
- $timezone = 'Europe/London';
78
- $dtz = new DateTimeZone($timezone);
79
- $dt = new DateTime('now', $dtz);
80
- $dayLightSavingTimeOffset = $dt->format('I');
81
-
82
- $c = Carbon::parse('now', $dtz);
83
- $this->assertSame($timezone, $c->tzName);
84
- $this->assertSame(0 + $dayLightSavingTimeOffset, $c->offsetHours);
85
- }
86
-
87
- public function testSettingTimezoneWithString()
88
- {
89
- $timezone = 'Asia/Tokyo';
90
- $dtz = new DateTimeZone($timezone);
91
- $dt = new DateTime('now', $dtz);
92
- $dayLightSavingTimeOffset = $dt->format('I');
93
-
94
- $c = new Carbon('now', $timezone);
95
- $this->assertSame($timezone, $c->tzName);
96
- $this->assertSame(9 + $dayLightSavingTimeOffset, $c->offsetHours);
97
- }
98
-
99
- public function testParseSettingTimezoneWithString()
100
- {
101
- $timezone = 'Asia/Tokyo';
102
- $dtz = new DateTimeZone($timezone);
103
- $dt = new DateTime('now', $dtz);
104
- $dayLightSavingTimeOffset = $dt->format('I');
105
-
106
- $c = Carbon::parse('now', $timezone);
107
- $this->assertSame($timezone, $c->tzName);
108
- $this->assertSame(9 + $dayLightSavingTimeOffset, $c->offsetHours);
109
- }
110
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CopyTest.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class CopyTest extends AbstractTestCase
18
- {
19
- public function testCopy()
20
- {
21
- $dating = Carbon::now();
22
- $dating2 = $dating->copy();
23
- $this->assertNotSame($dating, $dating2);
24
- }
25
-
26
- public function testCopyEnsureTzIsCopied()
27
- {
28
- $dating = Carbon::createFromDate(2000, 1, 1, 'Europe/London');
29
- $dating2 = $dating->copy();
30
- $this->assertSame($dating->tzName, $dating2->tzName);
31
- $this->assertSame($dating->offset, $dating2->offset);
32
- }
33
-
34
- public function testCopyEnsureMicrosAreCopied()
35
- {
36
- $micro = 254687;
37
- $dating = Carbon::createFromFormat('Y-m-d H:i:s.u', '2014-02-01 03:45:27.'.$micro);
38
- $dating2 = $dating->copy();
39
- $this->assertSame($micro, $dating2->micro);
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CreateFromDateTest.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTimeZone;
16
- use Tests\AbstractTestCase;
17
-
18
- class CreateFromDateTest extends AbstractTestCase
19
- {
20
- public function testCreateFromDateWithDefaults()
21
- {
22
- $d = Carbon::createFromDate();
23
- $this->assertSame($d->timestamp, Carbon::create(null, null, null, null, null, null)->timestamp);
24
- }
25
-
26
- public function testCreateFromDate()
27
- {
28
- $d = Carbon::createFromDate(1975, 5, 21);
29
- $this->assertCarbon($d, 1975, 5, 21);
30
- }
31
-
32
- public function testCreateFromDateWithYear()
33
- {
34
- $d = Carbon::createFromDate(1975);
35
- $this->assertSame(1975, $d->year);
36
- }
37
-
38
- public function testCreateFromDateWithMonth()
39
- {
40
- $d = Carbon::createFromDate(null, 5);
41
- $this->assertSame(5, $d->month);
42
- }
43
-
44
- public function testCreateFromDateWithDay()
45
- {
46
- $d = Carbon::createFromDate(null, null, 21);
47
- $this->assertSame(21, $d->day);
48
- }
49
-
50
- public function testCreateFromDateWithTimezone()
51
- {
52
- $d = Carbon::createFromDate(1975, 5, 21, 'Europe/London');
53
- $this->assertCarbon($d, 1975, 5, 21);
54
- $this->assertSame('Europe/London', $d->tzName);
55
- }
56
-
57
- public function testCreateFromDateWithDateTimeZone()
58
- {
59
- $d = Carbon::createFromDate(1975, 5, 21, new DateTimeZone('Europe/London'));
60
- $this->assertCarbon($d, 1975, 5, 21);
61
- $this->assertSame('Europe/London', $d->tzName);
62
- }
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CreateFromFormatTest.php DELETED
@@ -1,100 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTime;
16
- use DateTimeZone;
17
- use Tests\AbstractTestCase;
18
- use Tests\Carbon\Fixtures\MyCarbon;
19
-
20
- class CreateFromFormatTest extends AbstractTestCase
21
- {
22
- /**
23
- * @var array
24
- */
25
- protected $lastErrors;
26
-
27
- /**
28
- * @var array
29
- */
30
- protected $noErrors;
31
-
32
- public function setUp()
33
- {
34
- parent::setUp();
35
-
36
- $this->noErrors = array(
37
- 'warning_count' => 0,
38
- 'warnings' => array(),
39
- 'error_count' => 0,
40
- 'errors' => array(),
41
- );
42
-
43
- $this->lastErrors = array(
44
- 'warning_count' => 1,
45
- 'warnings' => array('10' => 'The parsed date was invalid'),
46
- 'error_count' => 0,
47
- 'errors' => array(),
48
- );
49
- }
50
-
51
- public function testCreateFromFormatReturnsCarbon()
52
- {
53
- $d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11');
54
- $this->assertCarbon($d, 1975, 5, 21, 22, 32, 11);
55
- $this->assertInstanceOfCarbon($d);
56
- }
57
-
58
- public function testCreateFromFormatWithTimezoneString()
59
- {
60
- $d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11', 'Europe/London');
61
- $this->assertCarbon($d, 1975, 5, 21, 22, 32, 11);
62
- $this->assertSame('Europe/London', $d->tzName);
63
- }
64
-
65
- public function testCreateFromFormatWithTimezone()
66
- {
67
- $d = Carbon::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11', new DateTimeZone('Europe/London'));
68
- $this->assertCarbon($d, 1975, 5, 21, 22, 32, 11);
69
- $this->assertSame('Europe/London', $d->tzName);
70
- }
71
-
72
- public function testCreateFromFormatWithMillis()
73
- {
74
- $d = Carbon::createFromFormat('Y-m-d H:i:s.u', '1975-05-21 22:32:11.254687');
75
- $this->assertSame(254687, $d->micro);
76
- }
77
-
78
- public function testCreateLastErrorsCanBeAccessedByExtendingClass()
79
- {
80
- MyCarbon::getLastErrors();
81
- }
82
-
83
- public function testCreateFromFormatHandlesLastErrors()
84
- {
85
- $carbon = Carbon::createFromFormat('d/m/Y', '41/02/1900');
86
- $datetime = DateTime::createFromFormat('d/m/Y', '41/02/1900');
87
-
88
- $this->assertSame($this->lastErrors, $carbon->getLastErrors());
89
- $this->assertSame($carbon->getLastErrors(), $datetime->getLastErrors());
90
- }
91
-
92
- public function testCreateFromFormatResetLastErrors()
93
- {
94
- $carbon = Carbon::createFromFormat('d/m/Y', '41/02/1900');
95
- $this->assertSame($this->lastErrors, $carbon->getLastErrors());
96
-
97
- $carbon = Carbon::createFromFormat('d/m/Y', '11/03/2016');
98
- $this->assertSame($this->noErrors, $carbon->getLastErrors());
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CreateFromTimeTest.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTimeZone;
16
- use Tests\AbstractTestCase;
17
-
18
- class CreateFromTimeTest extends AbstractTestCase
19
- {
20
- public function testCreateWithTestNow()
21
- {
22
- Carbon::setTestNow($testNow = Carbon::create(2011, 1, 1, 12, 13, 14));
23
- $dt = Carbon::create(null, null, null, null, null, null);
24
-
25
- $this->assertCarbon($dt, 2011, 1, 1, 12, 13, 14);
26
- $this->assertTrue($testNow->eq($dt));
27
- }
28
-
29
- public function testCreateFromDateWithDefaults()
30
- {
31
- $d = Carbon::createFromTime();
32
- $this->assertSame($d->timestamp, Carbon::create(null, null, null, null, null, null)->timestamp);
33
- }
34
-
35
- public function testCreateFromDate()
36
- {
37
- $d = Carbon::createFromTime(23, 5, 21);
38
- $this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 23, 5, 21);
39
- }
40
-
41
- public function testCreateFromTimeWithHour()
42
- {
43
- $d = Carbon::createFromTime(22);
44
- $this->assertSame(22, $d->hour);
45
- $this->assertSame(0, $d->minute);
46
- $this->assertSame(0, $d->second);
47
- }
48
-
49
- public function testCreateFromTimeWithMinute()
50
- {
51
- $d = Carbon::createFromTime(null, 5);
52
- $this->assertSame(5, $d->minute);
53
- }
54
-
55
- public function testCreateFromTimeWithSecond()
56
- {
57
- $d = Carbon::createFromTime(null, null, 21);
58
- $this->assertSame(21, $d->second);
59
- }
60
-
61
- public function testCreateFromTimeWithDateTimeZone()
62
- {
63
- $d = Carbon::createFromTime(12, 0, 0, new DateTimeZone('Europe/London'));
64
- $this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 12, 0, 0);
65
- $this->assertSame('Europe/London', $d->tzName);
66
- }
67
-
68
- public function testCreateFromTimeWithTimeZoneString()
69
- {
70
- $d = Carbon::createFromTime(12, 0, 0, 'Europe/London');
71
- $this->assertCarbon($d, Carbon::now()->year, Carbon::now()->month, Carbon::now()->day, 12, 0, 0);
72
- $this->assertSame('Europe/London', $d->tzName);
73
- }
74
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CreateFromTimestampTest.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTimeZone;
16
- use Tests\AbstractTestCase;
17
-
18
- class CreateFromTimestampTest extends AbstractTestCase
19
- {
20
- public function testCreateReturnsDatingInstance()
21
- {
22
- $d = Carbon::createFromTimestamp(Carbon::create(1975, 5, 21, 22, 32, 5)->timestamp);
23
- $this->assertCarbon($d, 1975, 5, 21, 22, 32, 5);
24
- }
25
-
26
- public function testCreateFromTimestampUsesDefaultTimezone()
27
- {
28
- $d = Carbon::createFromTimestamp(0);
29
-
30
- // We know Toronto is -5 since no DST in Jan
31
- $this->assertSame(1969, $d->year);
32
- $this->assertSame(-5 * 3600, $d->offset);
33
- }
34
-
35
- public function testCreateFromTimestampWithDateTimeZone()
36
- {
37
- $d = Carbon::createFromTimestamp(0, new DateTimeZone('UTC'));
38
- $this->assertSame('UTC', $d->tzName);
39
- $this->assertCarbon($d, 1970, 1, 1, 0, 0, 0);
40
- }
41
-
42
- public function testCreateFromTimestampWithString()
43
- {
44
- $d = Carbon::createFromTimestamp(0, 'UTC');
45
- $this->assertCarbon($d, 1970, 1, 1, 0, 0, 0);
46
- $this->assertSame(0, $d->offset);
47
- $this->assertSame('UTC', $d->tzName);
48
- }
49
-
50
- public function testCreateFromTimestampGMTDoesNotUseDefaultTimezone()
51
- {
52
- $d = Carbon::createFromTimestampUTC(0);
53
- $this->assertCarbon($d, 1970, 1, 1, 0, 0, 0);
54
- $this->assertSame(0, $d->offset);
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CreateSafeTest.php DELETED
@@ -1,195 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Carbon\Exceptions\InvalidDateException;
16
- use Tests\AbstractTestCase;
17
-
18
- class CreateSafeTest extends AbstractTestCase
19
- {
20
- public function testInvalidDateExceptionProperties()
21
- {
22
- $e = new InvalidDateException('day', 'foo');
23
- $this->assertSame('day', $e->getField());
24
- $this->assertSame('foo', $e->getValue());
25
- }
26
-
27
- /**
28
- * @expectedException \Carbon\Exceptions\InvalidDateException
29
- * @expectedExceptionMessage second : -1 is not a valid value.
30
- */
31
- public function testCreateSafeThrowsExceptionForSecondLowerThanZero()
32
- {
33
- Carbon::createSafe(null, null, null, null, null, -1);
34
- }
35
-
36
- /**
37
- * @expectedException \Carbon\Exceptions\InvalidDateException
38
- * @expectedExceptionMessage second : 60 is not a valid value.
39
- */
40
- public function testCreateSafeThrowsExceptionForSecondGreaterThan59()
41
- {
42
- Carbon::createSafe(null, null, null, null, null, 60);
43
- }
44
-
45
- /**
46
- * @expectedException \Carbon\Exceptions\InvalidDateException
47
- * @expectedExceptionMessage minute : -1 is not a valid value.
48
- */
49
- public function testCreateSafeThrowsExceptionForMinuteLowerThanZero()
50
- {
51
- Carbon::createSafe(null, null, null, null, -1);
52
- }
53
-
54
- /**
55
- * @expectedException \Carbon\Exceptions\InvalidDateException
56
- * @expectedExceptionMessage minute : 60 is not a valid value.
57
- */
58
- public function testCreateSafeThrowsExceptionForMinuteGreaterThan59()
59
- {
60
- Carbon::createSafe(null, null, null, null, 60, 25);
61
- }
62
-
63
- /**
64
- * @expectedException \Carbon\Exceptions\InvalidDateException
65
- * @expectedExceptionMessage hour : -6 is not a valid value.
66
- */
67
- public function testCreateSafeThrowsExceptionForHourLowerThanZero()
68
- {
69
- Carbon::createSafe(null, null, null, -6);
70
- }
71
-
72
- /**
73
- * @expectedException \Carbon\Exceptions\InvalidDateException
74
- * @expectedExceptionMessage hour : 25 is not a valid value.
75
- */
76
- public function testCreateSafeThrowsExceptionForHourGreaterThan24()
77
- {
78
- Carbon::createSafe(null, null, null, 25, 16, 15);
79
- }
80
-
81
- /**
82
- * @expectedException \Carbon\Exceptions\InvalidDateException
83
- * @expectedExceptionMessage day : -5 is not a valid value.
84
- */
85
- public function testCreateSafeThrowsExceptionForDayLowerThanZero()
86
- {
87
- Carbon::createSafe(null, null, -5);
88
- }
89
-
90
- /**
91
- * @expectedException \Carbon\Exceptions\InvalidDateException
92
- * @expectedExceptionMessage day : 32 is not a valid value.
93
- */
94
- public function testCreateSafeThrowsExceptionForDayGreaterThan31()
95
- {
96
- Carbon::createSafe(null, null, 32, 17, 16, 15);
97
- }
98
-
99
- /**
100
- * @expectedException \Carbon\Exceptions\InvalidDateException
101
- * @expectedExceptionMessage month : -4 is not a valid value.
102
- */
103
- public function testCreateSafeThrowsExceptionForMonthLowerThanZero()
104
- {
105
- Carbon::createSafe(null, -4);
106
- }
107
-
108
- /**
109
- * @expectedException \Carbon\Exceptions\InvalidDateException
110
- * @expectedExceptionMessage month : 13 is not a valid value.
111
- */
112
- public function testCreateSafeThrowsExceptionForMonthGreaterThan12()
113
- {
114
- Carbon::createSafe(null, 13, 5, 17, 16, 15);
115
- }
116
-
117
- /**
118
- * @expectedException \Carbon\Exceptions\InvalidDateException
119
- * @expectedExceptionMessage year : -5 is not a valid value.
120
- */
121
- public function testCreateSafeThrowsExceptionForYearLowerThanZero()
122
- {
123
- Carbon::createSafe(-5);
124
- }
125
-
126
- /**
127
- * @expectedException \Carbon\Exceptions\InvalidDateException
128
- * @expectedExceptionMessage year : 10000 is not a valid value.
129
- */
130
- public function testCreateSafeThrowsExceptionForYearGreaterThan12()
131
- {
132
- Carbon::createSafe(10000, 12, 5, 17, 16, 15);
133
- }
134
-
135
- /**
136
- * @expectedException \Carbon\Exceptions\InvalidDateException
137
- * @expectedExceptionMessage day : 31 is not a valid value.
138
- */
139
- public function testCreateSafeThrowsExceptionForInvalidDayInShortMonth()
140
- {
141
- // 30 days in April
142
- Carbon::createSafe(2016, 4, 31, 17, 16, 15);
143
- }
144
-
145
- /**
146
- * @expectedException \Carbon\Exceptions\InvalidDateException
147
- * @expectedExceptionMessage day : 30 is not a valid value.
148
- */
149
- public function testCreateSafeThrowsExceptionForInvalidDayForFebruaryInLeapYear()
150
- {
151
- // 29 days in February for a leap year
152
- $this->assertTrue(Carbon::create(2016, 2)->isLeapYear());
153
- Carbon::createSafe(2016, 2, 30, 17, 16, 15);
154
- }
155
-
156
- public function testCreateSafePassesForFebruaryInLeapYear()
157
- {
158
- // 29 days in February for a leap year
159
- Carbon::createSafe(2016, 2, 29, 17, 16, 15);
160
- }
161
-
162
- /**
163
- * @expectedException \Carbon\Exceptions\InvalidDateException
164
- * @expectedExceptionMessage day : 29 is not a valid value.
165
- */
166
- public function testCreateSafeThrowsExceptionForInvalidDayForFebruaryInNonLeapYear()
167
- {
168
- // 28 days in February for a non-leap year
169
- $this->assertFalse(Carbon::create(2015, 2)->isLeapYear());
170
- Carbon::createSafe(2015, 2, 29, 17, 16, 15);
171
- }
172
-
173
- /**
174
- * @expectedException \Carbon\Exceptions\InvalidDateException
175
- * @expectedExceptionMessage second : 15.1 is not a valid value.
176
- */
177
- public function testCreateSafeThrowsExceptionForWithNonIntegerValue()
178
- {
179
- Carbon::createSafe(2015, 2, 10, 17, 16, 15.1);
180
- }
181
-
182
- public function testCreateSafePassesForFebruaryInNonLeapYear()
183
- {
184
- // 28 days in February for a non-leap year
185
- Carbon::createSafe(2015, 2, 28, 17, 16, 15);
186
- }
187
-
188
- public function testCreateSafePasses()
189
- {
190
- $sd = Carbon::createSafe(2015, 2, 15, 17, 16, 15);
191
- $d = Carbon::create(2015, 2, 15, 17, 16, 15);
192
- $this->assertEquals($d, $sd);
193
- $this->assertCarbon($sd, 2015, 2, 15, 17, 16, 15);
194
- }
195
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/CreateTest.php DELETED
@@ -1,185 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTimeZone;
16
- use Tests\AbstractTestCase;
17
-
18
- class CreateTest extends AbstractTestCase
19
- {
20
- public function testCreateReturnsDatingInstance()
21
- {
22
- $d = Carbon::create();
23
- $this->assertInstanceOfCarbon($d);
24
- }
25
-
26
- public function testCreateWithDefaults()
27
- {
28
- $d = Carbon::create();
29
- $this->assertSame($d->timestamp, Carbon::now()->timestamp);
30
- }
31
-
32
- public function testCreateWithYear()
33
- {
34
- $d = Carbon::create(2012);
35
- $this->assertSame(2012, $d->year);
36
- }
37
-
38
- public function testCreateHandlesNegativeYear()
39
- {
40
- $c = Carbon::create(-1, 10, 12, 1, 2, 3);
41
- $this->assertCarbon($c, -1, 10, 12, 1, 2, 3);
42
- }
43
-
44
- public function testCreateHandlesFiveDigitsPositiveYears()
45
- {
46
- $c = Carbon::create(999999999, 10, 12, 1, 2, 3);
47
- $this->assertCarbon($c, 999999999, 10, 12, 1, 2, 3);
48
- }
49
-
50
- public function testCreateHandlesFiveDigitsNegativeYears()
51
- {
52
- $c = Carbon::create(-999999999, 10, 12, 1, 2, 3);
53
- $this->assertCarbon($c, -999999999, 10, 12, 1, 2, 3);
54
- }
55
-
56
- public function testCreateWithMonth()
57
- {
58
- $d = Carbon::create(null, 3);
59
- $this->assertSame(3, $d->month);
60
- }
61
-
62
- /**
63
- * @expectedException \InvalidArgumentException
64
- */
65
- public function testCreateWithInvalidMonth()
66
- {
67
- Carbon::create(null, -5);
68
- }
69
-
70
- public function testCreateMonthWraps()
71
- {
72
- $d = Carbon::create(2011, 0, 1, 0, 0, 0);
73
- $this->assertCarbon($d, 2010, 12, 1, 0, 0, 0);
74
- }
75
-
76
- public function testCreateWithDay()
77
- {
78
- $d = Carbon::create(null, null, 21);
79
- $this->assertSame(21, $d->day);
80
- }
81
-
82
- /**
83
- * @expectedException \InvalidArgumentException
84
- */
85
- public function testCreateWithInvalidDay()
86
- {
87
- Carbon::create(null, null, -4);
88
- }
89
-
90
- public function testCreateDayWraps()
91
- {
92
- $d = Carbon::create(2011, 1, 40, 0, 0, 0);
93
- $this->assertCarbon($d, 2011, 2, 9, 0, 0, 0);
94
- }
95
-
96
- public function testCreateWithHourAndDefaultMinSecToZero()
97
- {
98
- $d = Carbon::create(null, null, null, 14);
99
- $this->assertSame(14, $d->hour);
100
- $this->assertSame(0, $d->minute);
101
- $this->assertSame(0, $d->second);
102
- }
103
-
104
- /**
105
- * @expectedException \InvalidArgumentException
106
- */
107
- public function testCreateWithInvalidHour()
108
- {
109
- Carbon::create(null, null, null, -1);
110
- }
111
-
112
- public function testCreateHourWraps()
113
- {
114
- $d = Carbon::create(2011, 1, 1, 24, 0, 0);
115
- $this->assertCarbon($d, 2011, 1, 2, 0, 0, 0);
116
- }
117
-
118
- public function testCreateWithMinute()
119
- {
120
- $d = Carbon::create(null, null, null, null, 58);
121
- $this->assertSame(58, $d->minute);
122
- }
123
-
124
- /**
125
- * @expectedException \InvalidArgumentException
126
- */
127
- public function testCreateWithInvalidMinute()
128
- {
129
- Carbon::create(2011, 1, 1, 0, -2, 0);
130
- }
131
-
132
- public function testCreateMinuteWraps()
133
- {
134
- $d = Carbon::create(2011, 1, 1, 0, 62, 0);
135
- $this->assertCarbon($d, 2011, 1, 1, 1, 2, 0);
136
- }
137
-
138
- public function testCreateWithSecond()
139
- {
140
- $d = Carbon::create(null, null, null, null, null, 59);
141
- $this->assertSame(59, $d->second);
142
- }
143
-
144
- /**
145
- * @expectedException \InvalidArgumentException
146
- */
147
- public function testCreateWithInvalidSecond()
148
- {
149
- Carbon::create(null, null, null, null, null, -2);
150
- }
151
-
152
- public function testCreateSecondsWrap()
153
- {
154
- $d = Carbon::create(2012, 1, 1, 0, 0, 61);
155
- $this->assertCarbon($d, 2012, 1, 1, 0, 1, 1);
156
- }
157
-
158
- public function testCreateWithDateTimeZone()
159
- {
160
- $d = Carbon::create(2012, 1, 1, 0, 0, 0, new DateTimeZone('Europe/London'));
161
- $this->assertCarbon($d, 2012, 1, 1, 0, 0, 0);
162
- $this->assertSame('Europe/London', $d->tzName);
163
- }
164
-
165
- public function testCreateWithTimeZoneString()
166
- {
167
- $d = Carbon::create(2012, 1, 1, 0, 0, 0, 'Europe/London');
168
- $this->assertCarbon($d, 2012, 1, 1, 0, 0, 0);
169
- $this->assertSame('Europe/London', $d->tzName);
170
- }
171
-
172
- /**
173
- * @expectedException \InvalidArgumentException
174
- */
175
- public function testCreateWithInvalidTimezoneOffset()
176
- {
177
- Carbon::createFromDate(2000, 1, 1, -28236);
178
- }
179
-
180
- public function testCreateWithValidTimezoneOffset()
181
- {
182
- $dt = Carbon::createFromDate(2000, 1, 1, -4);
183
- $this->assertSame('America/New_York', $dt->tzName);
184
- }
185
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/DayOfWeekModifiersTest.php DELETED
@@ -1,406 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class DayOfWeekModifiersTest extends AbstractTestCase
18
- {
19
- public function testGetWeekendDays()
20
- {
21
- $this->assertSame(array(Carbon::SATURDAY, Carbon::SUNDAY), Carbon::getWeekendDays());
22
- }
23
-
24
- public function testGetWeekEndsAt()
25
- {
26
- Carbon::setWeekEndsAt(Carbon::SATURDAY);
27
- $this->assertSame(Carbon::SATURDAY, Carbon::getWeekEndsAt());
28
- Carbon::setWeekEndsAt(Carbon::SUNDAY);
29
- }
30
-
31
- public function testGetWeekStartsAt()
32
- {
33
- Carbon::setWeekStartsAt(Carbon::TUESDAY);
34
- $this->assertSame(Carbon::TUESDAY, Carbon::getWeekStartsAt());
35
- Carbon::setWeekStartsAt(Carbon::MONDAY);
36
- }
37
-
38
- public function testStartOfWeek()
39
- {
40
- $d = Carbon::create(1980, 8, 7, 12, 11, 9)->startOfWeek();
41
- $this->assertCarbon($d, 1980, 8, 4, 0, 0, 0);
42
- }
43
-
44
- public function testStartOfWeekFromWeekStart()
45
- {
46
- $d = Carbon::createFromDate(1980, 8, 4)->startOfWeek();
47
- $this->assertCarbon($d, 1980, 8, 4, 0, 0, 0);
48
- }
49
-
50
- public function testStartOfWeekCrossingYearBoundary()
51
- {
52
- $d = Carbon::createFromDate(2013, 12, 31, 'GMT');
53
- $d->startOfWeek();
54
- $this->assertCarbon($d, 2013, 12, 30, 0, 0, 0);
55
- }
56
-
57
- public function testEndOfWeek()
58
- {
59
- $d = Carbon::create(1980, 8, 7, 11, 12, 13)->endOfWeek();
60
- $this->assertCarbon($d, 1980, 8, 10, 23, 59, 59);
61
- }
62
-
63
- public function testEndOfWeekFromWeekEnd()
64
- {
65
- $d = Carbon::createFromDate(1980, 8, 9)->endOfWeek();
66
- $this->assertCarbon($d, 1980, 8, 10, 23, 59, 59);
67
- }
68
-
69
- public function testEndOfWeekCrossingYearBoundary()
70
- {
71
- $d = Carbon::createFromDate(2013, 12, 31, 'GMT');
72
- $d->endOfWeek();
73
- $this->assertCarbon($d, 2014, 1, 5, 23, 59, 59);
74
- }
75
-
76
- /**
77
- * @see https://github.com/briannesbitt/Carbon/issues/735
78
- */
79
- public function testStartOrEndOfWeekFromWeekWithUTC()
80
- {
81
- $d = Carbon::create(2016, 7, 27, 17, 13, 7, 'UTC');
82
- $this->assertCarbon($d->copy()->startOfWeek(), 2016, 7, 25, 0, 0, 0);
83
- $this->assertCarbon($d->copy()->endOfWeek(), 2016, 7, 31, 23, 59, 59);
84
- }
85
-
86
- /**
87
- * @see https://github.com/briannesbitt/Carbon/issues/735
88
- */
89
- public function testStartOrEndOfWeekFromWeekWithOtherTimezone()
90
- {
91
- $d = Carbon::create(2016, 7, 27, 17, 13, 7, 'America/New_York');
92
- $this->assertCarbon($d->copy()->startOfWeek(), 2016, 7, 25, 0, 0, 0);
93
- $this->assertCarbon($d->copy()->endOfWeek(), 2016, 7, 31, 23, 59, 59);
94
- }
95
-
96
- public function testNext()
97
- {
98
- $d = Carbon::createFromDate(1975, 5, 21)->next();
99
- $this->assertCarbon($d, 1975, 5, 28, 0, 0, 0);
100
- }
101
-
102
- public function testNextMonday()
103
- {
104
- $d = Carbon::createFromDate(1975, 5, 21)->next(Carbon::MONDAY);
105
- $this->assertCarbon($d, 1975, 5, 26, 0, 0, 0);
106
- }
107
-
108
- public function testNextSaturday()
109
- {
110
- $d = Carbon::createFromDate(1975, 5, 21)->next(6);
111
- $this->assertCarbon($d, 1975, 5, 24, 0, 0, 0);
112
- }
113
-
114
- public function testNextTimestamp()
115
- {
116
- $d = Carbon::createFromDate(1975, 11, 14)->next();
117
- $this->assertCarbon($d, 1975, 11, 21, 0, 0, 0);
118
- }
119
-
120
- public function testPrevious()
121
- {
122
- $d = Carbon::createFromDate(1975, 5, 21)->previous();
123
- $this->assertCarbon($d, 1975, 5, 14, 0, 0, 0);
124
- }
125
-
126
- public function testPreviousMonday()
127
- {
128
- $d = Carbon::createFromDate(1975, 5, 21)->previous(Carbon::MONDAY);
129
- $this->assertCarbon($d, 1975, 5, 19, 0, 0, 0);
130
- }
131
-
132
- public function testPreviousSaturday()
133
- {
134
- $d = Carbon::createFromDate(1975, 5, 21)->previous(6);
135
- $this->assertCarbon($d, 1975, 5, 17, 0, 0, 0);
136
- }
137
-
138
- public function testPreviousTimestamp()
139
- {
140
- $d = Carbon::createFromDate(1975, 11, 28)->previous();
141
- $this->assertCarbon($d, 1975, 11, 21, 0, 0, 0);
142
- }
143
-
144
- public function testFirstDayOfMonth()
145
- {
146
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfMonth();
147
- $this->assertCarbon($d, 1975, 11, 1, 0, 0, 0);
148
- }
149
-
150
- public function testFirstWednesdayOfMonth()
151
- {
152
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfMonth(Carbon::WEDNESDAY);
153
- $this->assertCarbon($d, 1975, 11, 5, 0, 0, 0);
154
- }
155
-
156
- public function testFirstFridayOfMonth()
157
- {
158
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfMonth(5);
159
- $this->assertCarbon($d, 1975, 11, 7, 0, 0, 0);
160
- }
161
-
162
- public function testLastDayOfMonth()
163
- {
164
- $d = Carbon::createFromDate(1975, 12, 5)->lastOfMonth();
165
- $this->assertCarbon($d, 1975, 12, 31, 0, 0, 0);
166
- }
167
-
168
- public function testLastTuesdayOfMonth()
169
- {
170
- $d = Carbon::createFromDate(1975, 12, 1)->lastOfMonth(Carbon::TUESDAY);
171
- $this->assertCarbon($d, 1975, 12, 30, 0, 0, 0);
172
- }
173
-
174
- public function testLastFridayOfMonth()
175
- {
176
- $d = Carbon::createFromDate(1975, 12, 5)->lastOfMonth(5);
177
- $this->assertCarbon($d, 1975, 12, 26, 0, 0, 0);
178
- }
179
-
180
- public function testNthOfMonthOutsideScope()
181
- {
182
- $this->assertFalse(Carbon::createFromDate(1975, 12, 5)->nthOfMonth(6, Carbon::MONDAY));
183
- }
184
-
185
- public function testNthOfMonthOutsideYear()
186
- {
187
- $this->assertFalse(Carbon::createFromDate(1975, 12, 5)->nthOfMonth(55, Carbon::MONDAY));
188
- }
189
-
190
- public function test2ndMondayOfMonth()
191
- {
192
- $d = Carbon::createFromDate(1975, 12, 5)->nthOfMonth(2, Carbon::MONDAY);
193
- $this->assertCarbon($d, 1975, 12, 8, 0, 0, 0);
194
- }
195
-
196
- public function test3rdWednesdayOfMonth()
197
- {
198
- $d = Carbon::createFromDate(1975, 12, 5)->nthOfMonth(3, 3);
199
- $this->assertCarbon($d, 1975, 12, 17, 0, 0, 0);
200
- }
201
-
202
- public function testFirstDayOfQuarter()
203
- {
204
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfQuarter();
205
- $this->assertCarbon($d, 1975, 10, 1, 0, 0, 0);
206
- }
207
-
208
- public function testFirstWednesdayOfQuarter()
209
- {
210
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfQuarter(Carbon::WEDNESDAY);
211
- $this->assertCarbon($d, 1975, 10, 1, 0, 0, 0);
212
- }
213
-
214
- public function testFirstFridayOfQuarter()
215
- {
216
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfQuarter(5);
217
- $this->assertCarbon($d, 1975, 10, 3, 0, 0, 0);
218
- }
219
-
220
- public function testFirstOfQuarterFromADayThatWillNotExistIntheFirstMonth()
221
- {
222
- $d = Carbon::createFromDate(2014, 5, 31)->firstOfQuarter();
223
- $this->assertCarbon($d, 2014, 4, 1, 0, 0, 0);
224
- }
225
-
226
- public function testLastDayOfQuarter()
227
- {
228
- $d = Carbon::createFromDate(1975, 8, 5)->lastOfQuarter();
229
- $this->assertCarbon($d, 1975, 9, 30, 0, 0, 0);
230
- }
231
-
232
- public function testLastTuesdayOfQuarter()
233
- {
234
- $d = Carbon::createFromDate(1975, 8, 1)->lastOfQuarter(Carbon::TUESDAY);
235
- $this->assertCarbon($d, 1975, 9, 30, 0, 0, 0);
236
- }
237
-
238
- public function testLastFridayOfQuarter()
239
- {
240
- $d = Carbon::createFromDate(1975, 7, 5)->lastOfQuarter(5);
241
- $this->assertCarbon($d, 1975, 9, 26, 0, 0, 0);
242
- }
243
-
244
- public function testLastOfQuarterFromADayThatWillNotExistIntheLastMonth()
245
- {
246
- $d = Carbon::createFromDate(2014, 5, 31)->lastOfQuarter();
247
- $this->assertCarbon($d, 2014, 6, 30, 0, 0, 0);
248
- }
249
-
250
- public function testNthOfQuarterOutsideScope()
251
- {
252
- $this->assertFalse(Carbon::createFromDate(1975, 1, 5)->nthOfQuarter(20, Carbon::MONDAY));
253
- }
254
-
255
- public function testNthOfQuarterOutsideYear()
256
- {
257
- $this->assertFalse(Carbon::createFromDate(1975, 1, 5)->nthOfQuarter(55, Carbon::MONDAY));
258
- }
259
-
260
- public function testNthOfQuarterFromADayThatWillNotExistIntheFirstMonth()
261
- {
262
- $d = Carbon::createFromDate(2014, 5, 31)->nthOfQuarter(2, Carbon::MONDAY);
263
- $this->assertCarbon($d, 2014, 4, 14, 0, 0, 0);
264
- }
265
-
266
- public function test2ndMondayOfQuarter()
267
- {
268
- $d = Carbon::createFromDate(1975, 8, 5)->nthOfQuarter(2, Carbon::MONDAY);
269
- $this->assertCarbon($d, 1975, 7, 14, 0, 0, 0);
270
- }
271
-
272
- public function test3rdWednesdayOfQuarter()
273
- {
274
- $d = Carbon::createFromDate(1975, 8, 5)->nthOfQuarter(3, 3);
275
- $this->assertCarbon($d, 1975, 7, 16, 0, 0, 0);
276
- }
277
-
278
- public function testFirstDayOfYear()
279
- {
280
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfYear();
281
- $this->assertCarbon($d, 1975, 1, 1, 0, 0, 0);
282
- }
283
-
284
- public function testFirstWednesdayOfYear()
285
- {
286
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfYear(Carbon::WEDNESDAY);
287
- $this->assertCarbon($d, 1975, 1, 1, 0, 0, 0);
288
- }
289
-
290
- public function testFirstFridayOfYear()
291
- {
292
- $d = Carbon::createFromDate(1975, 11, 21)->firstOfYear(5);
293
- $this->assertCarbon($d, 1975, 1, 3, 0, 0, 0);
294
- }
295
-
296
- public function testLastDayOfYear()
297
- {
298
- $d = Carbon::createFromDate(1975, 8, 5)->lastOfYear();
299
- $this->assertCarbon($d, 1975, 12, 31, 0, 0, 0);
300
- }
301
-
302
- public function testLastTuesdayOfYear()
303
- {
304
- $d = Carbon::createFromDate(1975, 8, 1)->lastOfYear(Carbon::TUESDAY);
305
- $this->assertCarbon($d, 1975, 12, 30, 0, 0, 0);
306
- }
307
-
308
- public function testLastFridayOfYear()
309
- {
310
- $d = Carbon::createFromDate(1975, 7, 5)->lastOfYear(5);
311
- $this->assertCarbon($d, 1975, 12, 26, 0, 0, 0);
312
- }
313
-
314
- public function testNthOfYearOutsideScope()
315
- {
316
- $this->assertFalse(Carbon::createFromDate(1975, 1, 5)->nthOfYear(55, Carbon::MONDAY));
317
- }
318
-
319
- public function test2ndMondayOfYear()
320
- {
321
- $d = Carbon::createFromDate(1975, 8, 5)->nthOfYear(2, Carbon::MONDAY);
322
- $this->assertCarbon($d, 1975, 1, 13, 0, 0, 0);
323
- }
324
-
325
- public function test3rdWednesdayOfYear()
326
- {
327
- $d = Carbon::createFromDate(1975, 8, 5)->nthOfYear(3, 3);
328
- $this->assertCarbon($d, 1975, 1, 15, 0, 0, 0);
329
- }
330
-
331
- public function testNextWeekday()
332
- {
333
- // Friday to Monday
334
- $d = Carbon::create(2016, 7, 15)->nextWeekday();
335
- $this->assertCarbon($d, 2016, 7, 18);
336
-
337
- // Saturday to Monday
338
- $d = Carbon::create(2016, 7, 16)->nextWeekday();
339
- $this->assertCarbon($d, 2016, 7, 18);
340
-
341
- // Sunday to Monday
342
- $d = Carbon::create(2016, 7, 16)->nextWeekday();
343
- $this->assertCarbon($d, 2016, 7, 18);
344
-
345
- // Monday to Tuesday
346
- $d = Carbon::create(2016, 7, 17)->nextWeekday();
347
- $this->assertCarbon($d, 2016, 7, 18);
348
- }
349
-
350
- public function testPreviousWeekday()
351
- {
352
- // Tuesday to Monday
353
- $d = Carbon::create(2016, 7, 19)->previousWeekday();
354
- $this->assertCarbon($d, 2016, 7, 18);
355
-
356
- // Monday to Friday
357
- $d = Carbon::create(2016, 7, 18)->previousWeekday();
358
- $this->assertCarbon($d, 2016, 7, 15);
359
-
360
- // Sunday to Friday
361
- $d = Carbon::create(2016, 7, 17)->previousWeekday();
362
- $this->assertCarbon($d, 2016, 7, 15);
363
-
364
- // Saturday to Friday
365
- $d = Carbon::create(2016, 7, 16)->previousWeekday();
366
- $this->assertCarbon($d, 2016, 7, 15);
367
- }
368
-
369
- public function testNextWeekendDay()
370
- {
371
- // Thursday to Saturday
372
- $d = Carbon::create(2016, 7, 14)->nextWeekendDay();
373
- $this->assertCarbon($d, 2016, 7, 16);
374
-
375
- // Friday to Saturday
376
- $d = Carbon::create(2016, 7, 15)->nextWeekendDay();
377
- $this->assertCarbon($d, 2016, 7, 16);
378
-
379
- // Saturday to Sunday
380
- $d = Carbon::create(2016, 7, 16)->nextWeekendDay();
381
- $this->assertCarbon($d, 2016, 7, 17);
382
-
383
- // Sunday to Saturday
384
- $d = Carbon::create(2016, 7, 17)->nextWeekendDay();
385
- $this->assertCarbon($d, 2016, 7, 23);
386
- }
387
-
388
- public function testPreviousWeekendDay()
389
- {
390
- // Thursday to Sunday
391
- $d = Carbon::create(2016, 7, 14)->previousWeekendDay();
392
- $this->assertCarbon($d, 2016, 7, 10);
393
-
394
- // Friday to Sunday
395
- $d = Carbon::create(2016, 7, 15)->previousWeekendDay();
396
- $this->assertCarbon($d, 2016, 7, 10);
397
-
398
- // Saturday to Sunday
399
- $d = Carbon::create(2016, 7, 16)->previousWeekendDay();
400
- $this->assertCarbon($d, 2016, 7, 10);
401
-
402
- // Sunday to Saturday
403
- $d = Carbon::create(2016, 7, 17)->previousWeekendDay();
404
- $this->assertCarbon($d, 2016, 7, 16);
405
- }
406
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/DiffTest.php DELETED
@@ -1,1216 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Carbon\CarbonInterval;
16
- use Closure;
17
- use Tests\AbstractTestCase;
18
-
19
- class DiffTest extends AbstractTestCase
20
- {
21
- protected function wrapWithTestNow(Closure $func, Carbon $dt = null)
22
- {
23
- parent::wrapWithTestNow($func, $dt ?: Carbon::createFromDate(2012, 1, 1));
24
- }
25
-
26
- public function testDiffInYearsPositive()
27
- {
28
- $dt = Carbon::createFromDate(2000, 1, 1);
29
- $this->assertSame(1, $dt->diffInYears($dt->copy()->addYear()));
30
- }
31
-
32
- public function testDiffInYearsNegativeWithSign()
33
- {
34
- $dt = Carbon::createFromDate(2000, 1, 1);
35
- $this->assertSame(-1, $dt->diffInYears($dt->copy()->subYear(), false));
36
- }
37
-
38
- public function testDiffInYearsNegativeNoSign()
39
- {
40
- $dt = Carbon::createFromDate(2000, 1, 1);
41
- $this->assertSame(1, $dt->diffInYears($dt->copy()->subYear()));
42
- }
43
-
44
- public function testDiffInYearsVsDefaultNow()
45
- {
46
- $scope = $this;
47
- $this->wrapWithTestNow(function () use ($scope) {
48
- $scope->assertSame(1, Carbon::now()->subYear()->diffInYears());
49
- });
50
- }
51
-
52
- public function testDiffInYearsEnsureIsTruncated()
53
- {
54
- $dt = Carbon::createFromDate(2000, 1, 1);
55
- $this->assertSame(1, $dt->diffInYears($dt->copy()->addYear()->addMonths(7)));
56
- }
57
-
58
- public function testDiffInMonthsPositive()
59
- {
60
- $dt = Carbon::createFromDate(2000, 1, 1);
61
- $this->assertSame(13, $dt->diffInMonths($dt->copy()->addYear()->addMonth()));
62
- }
63
-
64
- public function testDiffInMonthsNegativeWithSign()
65
- {
66
- $dt = Carbon::createFromDate(2000, 1, 1);
67
- $this->assertSame(-11, $dt->diffInMonths($dt->copy()->subYear()->addMonth(), false));
68
- }
69
-
70
- public function testDiffInMonthsNegativeNoSign()
71
- {
72
- $dt = Carbon::createFromDate(2000, 1, 1);
73
- $this->assertSame(11, $dt->diffInMonths($dt->copy()->subYear()->addMonth()));
74
- }
75
-
76
- public function testDiffInMonthsVsDefaultNow()
77
- {
78
- $scope = $this;
79
- $this->wrapWithTestNow(function () use ($scope) {
80
- $scope->assertSame(12, Carbon::now()->subYear()->diffInMonths());
81
- });
82
- }
83
-
84
- public function testDiffInMonthsEnsureIsTruncated()
85
- {
86
- $dt = Carbon::createFromDate(2000, 1, 1);
87
- $this->assertSame(1, $dt->diffInMonths($dt->copy()->addMonth()->addDays(16)));
88
- }
89
-
90
- public function testDiffInDaysPositive()
91
- {
92
- $dt = Carbon::createFromDate(2000, 1, 1);
93
- $this->assertSame(366, $dt->diffInDays($dt->copy()->addYear()));
94
- }
95
-
96
- public function testDiffInDaysNegativeWithSign()
97
- {
98
- $dt = Carbon::createFromDate(2000, 1, 1);
99
- $this->assertSame(-365, $dt->diffInDays($dt->copy()->subYear(), false));
100
- }
101
-
102
- public function testDiffInDaysNegativeNoSign()
103
- {
104
- $dt = Carbon::createFromDate(2000, 1, 1);
105
- $this->assertSame(365, $dt->diffInDays($dt->copy()->subYear()));
106
- }
107
-
108
- public function testDiffInDaysVsDefaultNow()
109
- {
110
- $scope = $this;
111
- $this->wrapWithTestNow(function () use ($scope) {
112
- $scope->assertSame(7, Carbon::now()->subWeek()->diffInDays());
113
- });
114
- }
115
-
116
- public function testDiffInDaysEnsureIsTruncated()
117
- {
118
- $dt = Carbon::createFromDate(2000, 1, 1);
119
- $this->assertSame(1, $dt->diffInDays($dt->copy()->addDay()->addHours(13)));
120
- }
121
-
122
- public function testDiffInDaysFilteredPositiveWithMutated()
123
- {
124
- $dt = Carbon::createFromDate(2000, 1, 1);
125
- $this->assertSame(5, $dt->diffInDaysFiltered(function (Carbon $date) {
126
- return $date->dayOfWeek === 1;
127
- }, $dt->copy()->endOfMonth()));
128
- }
129
-
130
- public function testDiffInDaysFilteredPositiveWithSecondObject()
131
- {
132
- $dt1 = Carbon::createFromDate(2000, 1, 1);
133
- $dt2 = Carbon::createFromDate(2000, 1, 31);
134
-
135
- $this->assertSame(5, $dt1->diffInDaysFiltered(function (Carbon $date) {
136
- return $date->dayOfWeek === Carbon::SUNDAY;
137
- }, $dt2));
138
- }
139
-
140
- public function testDiffInDaysFilteredNegativeNoSignWithMutated()
141
- {
142
- $dt = Carbon::createFromDate(2000, 1, 31);
143
- $this->assertSame(5, $dt->diffInDaysFiltered(function (Carbon $date) {
144
- return $date->dayOfWeek === Carbon::SUNDAY;
145
- }, $dt->copy()->startOfMonth()));
146
- }
147
-
148
- public function testDiffInDaysFilteredNegativeNoSignWithSecondObject()
149
- {
150
- $dt1 = Carbon::createFromDate(2000, 1, 31);
151
- $dt2 = Carbon::createFromDate(2000, 1, 1);
152
-
153
- $this->assertSame(5, $dt1->diffInDaysFiltered(function (Carbon $date) {
154
- return $date->dayOfWeek === Carbon::SUNDAY;
155
- }, $dt2));
156
- }
157
-
158
- public function testDiffInDaysFilteredNegativeWithSignWithMutated()
159
- {
160
- $dt = Carbon::createFromDate(2000, 1, 31);
161
- $this->assertSame(-5, $dt->diffInDaysFiltered(function (Carbon $date) {
162
- return $date->dayOfWeek === 1;
163
- }, $dt->copy()->startOfMonth(), false));
164
- }
165
-
166
- public function testDiffInDaysFilteredNegativeWithSignWithSecondObject()
167
- {
168
- $dt1 = Carbon::createFromDate(2000, 1, 31);
169
- $dt2 = Carbon::createFromDate(2000, 1, 1);
170
-
171
- $this->assertSame(-5, $dt1->diffInDaysFiltered(function (Carbon $date) {
172
- return $date->dayOfWeek === Carbon::SUNDAY;
173
- }, $dt2, false));
174
- }
175
-
176
- public function testDiffInHoursFiltered()
177
- {
178
- $dt1 = Carbon::createFromDate(2000, 1, 31)->endOfDay();
179
- $dt2 = Carbon::createFromDate(2000, 1, 1)->startOfDay();
180
-
181
- $this->assertSame(31, $dt1->diffInHoursFiltered(function (Carbon $date) {
182
- return $date->hour === 9;
183
- }, $dt2));
184
- }
185
-
186
- public function testDiffInHoursFilteredNegative()
187
- {
188
- $dt1 = Carbon::createFromDate(2000, 1, 31)->endOfDay();
189
- $dt2 = Carbon::createFromDate(2000, 1, 1)->startOfDay();
190
-
191
- $this->assertSame(-31, $dt1->diffInHoursFiltered(function (Carbon $date) {
192
- return $date->hour === 9;
193
- }, $dt2, false));
194
- }
195
-
196
- public function testDiffInHoursFilteredWorkHoursPerWeek()
197
- {
198
- $dt1 = Carbon::createFromDate(2000, 1, 5)->endOfDay();
199
- $dt2 = Carbon::createFromDate(2000, 1, 1)->startOfDay();
200
-
201
- $this->assertSame(40, $dt1->diffInHoursFiltered(function (Carbon $date) {
202
- return $date->hour > 8 && $date->hour < 17;
203
- }, $dt2));
204
- }
205
-
206
- public function testDiffFilteredUsingMinutesPositiveWithMutated()
207
- {
208
- $dt = Carbon::createFromDate(2000, 1, 1)->startOfDay();
209
- $this->assertSame(60, $dt->diffFiltered(CarbonInterval::minute(), function (Carbon $date) {
210
- return $date->hour === 12;
211
- }, Carbon::createFromDate(2000, 1, 1)->endOfDay()));
212
- }
213
-
214
- public function testDiffFilteredPositiveWithSecondObject()
215
- {
216
- $dt1 = Carbon::create(2000, 1, 1);
217
- $dt2 = $dt1->copy()->addSeconds(80);
218
-
219
- $this->assertSame(40, $dt1->diffFiltered(CarbonInterval::second(), function (Carbon $date) {
220
- return $date->second % 2 === 0;
221
- }, $dt2));
222
- }
223
-
224
- public function testDiffFilteredNegativeNoSignWithMutated()
225
- {
226
- $dt = Carbon::createFromDate(2000, 1, 31);
227
-
228
- $this->assertSame(2, $dt->diffFiltered(CarbonInterval::days(2), function (Carbon $date) {
229
- return $date->dayOfWeek === Carbon::SUNDAY;
230
- }, $dt->copy()->startOfMonth()));
231
- }
232
-
233
- public function testDiffFilteredNegativeNoSignWithSecondObject()
234
- {
235
- $dt1 = Carbon::createFromDate(2006, 1, 31);
236
- $dt2 = Carbon::createFromDate(2000, 1, 1);
237
-
238
- $this->assertSame(7, $dt1->diffFiltered(CarbonInterval::year(), function (Carbon $date) {
239
- return $date->month === 1;
240
- }, $dt2));
241
- }
242
-
243
- public function testDiffFilteredNegativeWithSignWithMutated()
244
- {
245
- $dt = Carbon::createFromDate(2000, 1, 31);
246
- $this->assertSame(-4, $dt->diffFiltered(CarbonInterval::week(), function (Carbon $date) {
247
- return $date->month === 12;
248
- }, $dt->copy()->subMonths(3), false));
249
- }
250
-
251
- public function testDiffFilteredNegativeWithSignWithSecondObject()
252
- {
253
- $dt1 = Carbon::createFromDate(2001, 1, 31);
254
- $dt2 = Carbon::createFromDate(1999, 1, 1);
255
-
256
- $this->assertSame(-12, $dt1->diffFiltered(CarbonInterval::month(), function (Carbon $date) {
257
- return $date->year === 2000;
258
- }, $dt2, false));
259
- }
260
-
261
- public function testBug188DiffWithSameDates()
262
- {
263
- $start = Carbon::create(2014, 10, 8, 15, 20, 0);
264
- $end = $start->copy();
265
-
266
- $this->assertSame(0, $start->diffInDays($end));
267
- $this->assertSame(0, $start->diffInWeekdays($end));
268
- }
269
-
270
- public function testBug188DiffWithDatesOnlyHoursApart()
271
- {
272
- $start = Carbon::create(2014, 10, 8, 15, 20, 0);
273
- $end = $start->copy();
274
-
275
- $this->assertSame(0, $start->diffInDays($end));
276
- $this->assertSame(0, $start->diffInWeekdays($end));
277
- }
278
-
279
- public function testBug188DiffWithSameDates1DayApart()
280
- {
281
- $start = Carbon::create(2014, 10, 8, 15, 20, 0);
282
- $end = $start->copy()->addDay();
283
-
284
- $this->assertSame(1, $start->diffInDays($end));
285
- $this->assertSame(1, $start->diffInWeekdays($end));
286
- }
287
-
288
- public function testBug188DiffWithDatesOnTheWeekend()
289
- {
290
- $start = Carbon::create(2014, 1, 1, 0, 0, 0);
291
- $start->next(Carbon::SATURDAY);
292
- $end = $start->copy()->addDay();
293
-
294
- $this->assertSame(1, $start->diffInDays($end));
295
- $this->assertSame(0, $start->diffInWeekdays($end));
296
- }
297
-
298
- public function testDiffInWeekdaysPositive()
299
- {
300
- $dt = Carbon::createFromDate(2000, 1, 1);
301
- $this->assertSame(21, $dt->diffInWeekdays($dt->copy()->endOfMonth()));
302
- }
303
-
304
- public function testDiffInWeekdaysNegativeNoSign()
305
- {
306
- $dt = Carbon::createFromDate(2000, 1, 31);
307
- $this->assertSame(21, $dt->diffInWeekdays($dt->copy()->startOfMonth()));
308
- }
309
-
310
- public function testDiffInWeekdaysNegativeWithSign()
311
- {
312
- $dt = Carbon::createFromDate(2000, 1, 31);
313
- $this->assertSame(-21, $dt->diffInWeekdays($dt->copy()->startOfMonth(), false));
314
- }
315
-
316
- public function testDiffInWeekendDaysPositive()
317
- {
318
- $dt = Carbon::createFromDate(2000, 1, 1);
319
- $this->assertSame(10, $dt->diffInWeekendDays($dt->copy()->endOfMonth()));
320
- }
321
-
322
- public function testDiffInWeekendDaysNegativeNoSign()
323
- {
324
- $dt = Carbon::createFromDate(2000, 1, 31);
325
- $this->assertSame(10, $dt->diffInWeekendDays($dt->copy()->startOfMonth()));
326
- }
327
-
328
- public function testDiffInWeekendDaysNegativeWithSign()
329
- {
330
- $dt = Carbon::createFromDate(2000, 1, 31);
331
- $this->assertSame(-10, $dt->diffInWeekendDays($dt->copy()->startOfMonth(), false));
332
- }
333
-
334
- public function testDiffInWeeksPositive()
335
- {
336
- $dt = Carbon::createFromDate(2000, 1, 1);
337
- $this->assertSame(52, $dt->diffInWeeks($dt->copy()->addYear()));
338
- }
339
-
340
- public function testDiffInWeeksNegativeWithSign()
341
- {
342
- $dt = Carbon::createFromDate(2000, 1, 1);
343
- $this->assertSame(-52, $dt->diffInWeeks($dt->copy()->subYear(), false));
344
- }
345
-
346
- public function testDiffInWeeksNegativeNoSign()
347
- {
348
- $dt = Carbon::createFromDate(2000, 1, 1);
349
- $this->assertSame(52, $dt->diffInWeeks($dt->copy()->subYear()));
350
- }
351
-
352
- public function testDiffInWeeksVsDefaultNow()
353
- {
354
- $scope = $this;
355
- $this->wrapWithTestNow(function () use ($scope) {
356
- $scope->assertSame(1, Carbon::now()->subWeek()->diffInWeeks());
357
- });
358
- }
359
-
360
- public function testDiffInWeeksEnsureIsTruncated()
361
- {
362
- $dt = Carbon::createFromDate(2000, 1, 1);
363
- $this->assertSame(0, $dt->diffInWeeks($dt->copy()->addWeek()->subDay()));
364
- }
365
-
366
- public function testDiffInHoursPositive()
367
- {
368
- $dt = Carbon::createFromDate(2000, 1, 1);
369
- $this->assertSame(26, $dt->diffInHours($dt->copy()->addDay()->addHours(2)));
370
- }
371
-
372
- public function testDiffInHoursNegativeWithSign()
373
- {
374
- $dt = Carbon::createFromDate(2000, 1, 1);
375
- $this->assertSame(-22, $dt->diffInHours($dt->copy()->subDay()->addHours(2), false));
376
- }
377
-
378
- public function testDiffInHoursNegativeNoSign()
379
- {
380
- $dt = Carbon::createFromDate(2000, 1, 1);
381
- $this->assertSame(22, $dt->diffInHours($dt->copy()->subDay()->addHours(2)));
382
- }
383
-
384
- public function testDiffInHoursVsDefaultNow()
385
- {
386
- $scope = $this;
387
- $this->wrapWithTestNow(function () use ($scope) {
388
- $scope->assertSame(48, Carbon::now()->subDays(2)->diffInHours());
389
- }, Carbon::create(2012, 1, 15));
390
- }
391
-
392
- public function testDiffInHoursEnsureIsTruncated()
393
- {
394
- $dt = Carbon::createFromDate(2000, 1, 1);
395
- $this->assertSame(1, $dt->diffInHours($dt->copy()->addHour()->addMinutes(31)));
396
- }
397
-
398
- public function testDiffInMinutesPositive()
399
- {
400
- $dt = Carbon::createFromDate(2000, 1, 1);
401
- $this->assertSame(62, $dt->diffInMinutes($dt->copy()->addHour()->addMinutes(2)));
402
- }
403
-
404
- public function testDiffInMinutesPositiveAlot()
405
- {
406
- $dt = Carbon::createFromDate(2000, 1, 1);
407
- $this->assertSame(1502, $dt->diffInMinutes($dt->copy()->addHours(25)->addMinutes(2)));
408
- }
409
-
410
- public function testDiffInMinutesNegativeWithSign()
411
- {
412
- $dt = Carbon::createFromDate(2000, 1, 1);
413
- $this->assertSame(-58, $dt->diffInMinutes($dt->copy()->subHour()->addMinutes(2), false));
414
- }
415
-
416
- public function testDiffInMinutesNegativeNoSign()
417
- {
418
- $dt = Carbon::createFromDate(2000, 1, 1);
419
- $this->assertSame(58, $dt->diffInMinutes($dt->copy()->subHour()->addMinutes(2)));
420
- }
421
-
422
- public function testDiffInMinutesVsDefaultNow()
423
- {
424
- $scope = $this;
425
- $this->wrapWithTestNow(function () use ($scope) {
426
- $scope->assertSame(60, Carbon::now()->subHour()->diffInMinutes());
427
- });
428
- }
429
-
430
- public function testDiffInMinutesEnsureIsTruncated()
431
- {
432
- $dt = Carbon::createFromDate(2000, 1, 1);
433
- $this->assertSame(1, $dt->diffInMinutes($dt->copy()->addMinute()->addSeconds(31)));
434
- }
435
-
436
- public function testDiffInSecondsPositive()
437
- {
438
- $dt = Carbon::createFromDate(2000, 1, 1);
439
- $this->assertSame(62, $dt->diffInSeconds($dt->copy()->addMinute()->addSeconds(2)));
440
- }
441
-
442
- public function testDiffInSecondsPositiveAlot()
443
- {
444
- $dt = Carbon::createFromDate(2000, 1, 1);
445
- $this->assertSame(7202, $dt->diffInSeconds($dt->copy()->addHours(2)->addSeconds(2)));
446
- }
447
-
448
- public function testDiffInSecondsNegativeWithSign()
449
- {
450
- $dt = Carbon::createFromDate(2000, 1, 1);
451
- $this->assertSame(-58, $dt->diffInSeconds($dt->copy()->subMinute()->addSeconds(2), false));
452
- }
453
-
454
- public function testDiffInSecondsNegativeNoSign()
455
- {
456
- $dt = Carbon::createFromDate(2000, 1, 1);
457
- $this->assertSame(58, $dt->diffInSeconds($dt->copy()->subMinute()->addSeconds(2)));
458
- }
459
-
460
- public function testDiffInSecondsVsDefaultNow()
461
- {
462
- $scope = $this;
463
- $this->wrapWithTestNow(function () use ($scope) {
464
- $scope->assertSame(3600, Carbon::now()->subHour()->diffInSeconds());
465
- });
466
- }
467
-
468
- public function testDiffInSecondsEnsureIsTruncated()
469
- {
470
- $dt = Carbon::createFromDate(2000, 1, 1);
471
- $this->assertSame(1, $dt->diffInSeconds($dt->copy()->addSeconds(1.9)));
472
- }
473
-
474
- public function testDiffInSecondsWithTimezones()
475
- {
476
- $dtOttawa = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
477
- $dtVancouver = Carbon::createFromDate(2000, 1, 1, 'America/Vancouver');
478
- $this->assertSame(3 * 60 * 60, $dtOttawa->diffInSeconds($dtVancouver));
479
- }
480
-
481
- public function testDiffInSecondsWithTimezonesAndVsDefault()
482
- {
483
- $vanNow = Carbon::now('America/Vancouver');
484
- $hereNow = $vanNow->copy()->setTimezone(Carbon::now()->tz);
485
-
486
- $scope = $this;
487
- $this->wrapWithTestNow(function () use ($vanNow, $scope) {
488
- $scope->assertSame(0, $vanNow->diffInSeconds());
489
- }, $hereNow);
490
- }
491
-
492
- public function testDiffForHumansNowAndSecond()
493
- {
494
- $scope = $this;
495
- $this->wrapWithTestNow(function () use ($scope) {
496
- $scope->assertSame('1 second ago', Carbon::now()->diffForHumans());
497
- });
498
- }
499
-
500
- public function testDiffForHumansNowAndSecondWithTimezone()
501
- {
502
- $vanNow = Carbon::now('America/Vancouver');
503
- $hereNow = $vanNow->copy()->setTimezone(Carbon::now()->tz);
504
-
505
- $scope = $this;
506
- $this->wrapWithTestNow(function () use ($vanNow, $scope) {
507
- $scope->assertSame('1 second ago', $vanNow->diffForHumans());
508
- }, $hereNow);
509
- }
510
-
511
- public function testDiffForHumansNowAndSeconds()
512
- {
513
- $scope = $this;
514
- $this->wrapWithTestNow(function () use ($scope) {
515
- $scope->assertSame('2 seconds ago', Carbon::now()->subSeconds(2)->diffForHumans());
516
- });
517
- }
518
-
519
- public function testDiffForHumansNowAndNearlyMinute()
520
- {
521
- $scope = $this;
522
- $this->wrapWithTestNow(function () use ($scope) {
523
- $scope->assertSame('59 seconds ago', Carbon::now()->subSeconds(59)->diffForHumans());
524
- });
525
- }
526
-
527
- public function testDiffForHumansNowAndMinute()
528
- {
529
- $scope = $this;
530
- $this->wrapWithTestNow(function () use ($scope) {
531
- $scope->assertSame('1 minute ago', Carbon::now()->subMinute()->diffForHumans());
532
- });
533
- }
534
-
535
- public function testDiffForHumansNowAndMinutes()
536
- {
537
- $scope = $this;
538
- $this->wrapWithTestNow(function () use ($scope) {
539
- $scope->assertSame('2 minutes ago', Carbon::now()->subMinutes(2)->diffForHumans());
540
- });
541
- }
542
-
543
- public function testDiffForHumansNowAndNearlyHour()
544
- {
545
- $scope = $this;
546
- $this->wrapWithTestNow(function () use ($scope) {
547
- $scope->assertSame('59 minutes ago', Carbon::now()->subMinutes(59)->diffForHumans());
548
- });
549
- }
550
-
551
- public function testDiffForHumansNowAndHour()
552
- {
553
- $scope = $this;
554
- $this->wrapWithTestNow(function () use ($scope) {
555
- $scope->assertSame('1 hour ago', Carbon::now()->subHour()->diffForHumans());
556
- });
557
- }
558
-
559
- public function testDiffForHumansNowAndHours()
560
- {
561
- $scope = $this;
562
- $this->wrapWithTestNow(function () use ($scope) {
563
- $scope->assertSame('2 hours ago', Carbon::now()->subHours(2)->diffForHumans());
564
- });
565
- }
566
-
567
- public function testDiffForHumansNowAndNearlyDay()
568
- {
569
- $scope = $this;
570
- $this->wrapWithTestNow(function () use ($scope) {
571
- $scope->assertSame('23 hours ago', Carbon::now()->subHours(23)->diffForHumans());
572
- });
573
- }
574
-
575
- public function testDiffForHumansNowAndDay()
576
- {
577
- $scope = $this;
578
- $this->wrapWithTestNow(function () use ($scope) {
579
- $scope->assertSame('1 day ago', Carbon::now()->subDay()->diffForHumans());
580
- });
581
- }
582
-
583
- public function testDiffForHumansNowAndDays()
584
- {
585
- $scope = $this;
586
- $this->wrapWithTestNow(function () use ($scope) {
587
- $scope->assertSame('2 days ago', Carbon::now()->subDays(2)->diffForHumans());
588
- });
589
- }
590
-
591
- public function testDiffForHumansNowAndNearlyWeek()
592
- {
593
- $scope = $this;
594
- $this->wrapWithTestNow(function () use ($scope) {
595
- $scope->assertSame('6 days ago', Carbon::now()->subDays(6)->diffForHumans());
596
- });
597
- }
598
-
599
- public function testDiffForHumansNowAndWeek()
600
- {
601
- $scope = $this;
602
- $this->wrapWithTestNow(function () use ($scope) {
603
- $scope->assertSame('1 week ago', Carbon::now()->subWeek()->diffForHumans());
604
- });
605
- }
606
-
607
- public function testDiffForHumansNowAndWeeks()
608
- {
609
- $scope = $this;
610
- $this->wrapWithTestNow(function () use ($scope) {
611
- $scope->assertSame('2 weeks ago', Carbon::now()->subWeeks(2)->diffForHumans());
612
- });
613
- }
614
-
615
- public function testDiffForHumansNowAndNearlyMonth()
616
- {
617
- $scope = $this;
618
- $this->wrapWithTestNow(function () use ($scope) {
619
- $scope->assertSame('3 weeks ago', Carbon::now()->subWeeks(3)->diffForHumans());
620
- });
621
- }
622
-
623
- public function testDiffForHumansNowAndMonth()
624
- {
625
- $scope = $this;
626
- $this->wrapWithTestNow(function () use ($scope) {
627
- $scope->assertSame('4 weeks ago', Carbon::now()->subWeeks(4)->diffForHumans());
628
- $scope->assertSame('1 month ago', Carbon::now()->subMonth()->diffForHumans());
629
- });
630
- }
631
-
632
- public function testDiffForHumansNowAndMonths()
633
- {
634
- $scope = $this;
635
- $this->wrapWithTestNow(function () use ($scope) {
636
- $scope->assertSame('2 months ago', Carbon::now()->subMonths(2)->diffForHumans());
637
- });
638
- }
639
-
640
- public function testDiffForHumansNowAndNearlyYear()
641
- {
642
- $scope = $this;
643
- $this->wrapWithTestNow(function () use ($scope) {
644
- $scope->assertSame('11 months ago', Carbon::now()->subMonths(11)->diffForHumans());
645
- });
646
- }
647
-
648
- public function testDiffForHumansNowAndYear()
649
- {
650
- $scope = $this;
651
- $this->wrapWithTestNow(function () use ($scope) {
652
- $scope->assertSame('1 year ago', Carbon::now()->subYear()->diffForHumans());
653
- });
654
- }
655
-
656
- public function testDiffForHumansNowAndYears()
657
- {
658
- $scope = $this;
659
- $this->wrapWithTestNow(function () use ($scope) {
660
- $scope->assertSame('2 years ago', Carbon::now()->subYears(2)->diffForHumans());
661
- });
662
- }
663
-
664
- public function testDiffForHumansNowAndFutureSecond()
665
- {
666
- $scope = $this;
667
- $this->wrapWithTestNow(function () use ($scope) {
668
- $scope->assertSame('1 second from now', Carbon::now()->addSecond()->diffForHumans());
669
- });
670
- }
671
-
672
- public function testDiffForHumansNowAndFutureSeconds()
673
- {
674
- $scope = $this;
675
- $this->wrapWithTestNow(function () use ($scope) {
676
- $scope->assertSame('2 seconds from now', Carbon::now()->addSeconds(2)->diffForHumans());
677
- });
678
- }
679
-
680
- public function testDiffForHumansNowAndNearlyFutureMinute()
681
- {
682
- $scope = $this;
683
- $this->wrapWithTestNow(function () use ($scope) {
684
- $scope->assertSame('59 seconds from now', Carbon::now()->addSeconds(59)->diffForHumans());
685
- });
686
- }
687
-
688
- public function testDiffForHumansNowAndFutureMinute()
689
- {
690
- $scope = $this;
691
- $this->wrapWithTestNow(function () use ($scope) {
692
- $scope->assertSame('1 minute from now', Carbon::now()->addMinute()->diffForHumans());
693
- });
694
- }
695
-
696
- public function testDiffForHumansNowAndFutureMinutes()
697
- {
698
- $scope = $this;
699
- $this->wrapWithTestNow(function () use ($scope) {
700
- $scope->assertSame('2 minutes from now', Carbon::now()->addMinutes(2)->diffForHumans());
701
- });
702
- }
703
-
704
- public function testDiffForHumansNowAndNearlyFutureHour()
705
- {
706
- $scope = $this;
707
- $this->wrapWithTestNow(function () use ($scope) {
708
- $scope->assertSame('59 minutes from now', Carbon::now()->addMinutes(59)->diffForHumans());
709
- });
710
- }
711
-
712
- public function testDiffForHumansNowAndFutureHour()
713
- {
714
- $scope = $this;
715
- $this->wrapWithTestNow(function () use ($scope) {
716
- $scope->assertSame('1 hour from now', Carbon::now()->addHour()->diffForHumans());
717
- });
718
- }
719
-
720
- public function testDiffForHumansNowAndFutureHours()
721
- {
722
- $scope = $this;
723
- $this->wrapWithTestNow(function () use ($scope) {
724
- $scope->assertSame('2 hours from now', Carbon::now()->addHours(2)->diffForHumans());
725
- });
726
- }
727
-
728
- public function testDiffForHumansNowAndNearlyFutureDay()
729
- {
730
- $scope = $this;
731
- $this->wrapWithTestNow(function () use ($scope) {
732
- $scope->assertSame('23 hours from now', Carbon::now()->addHours(23)->diffForHumans());
733
- });
734
- }
735
-
736
- public function testDiffForHumansNowAndFutureDay()
737
- {
738
- $scope = $this;
739
- $this->wrapWithTestNow(function () use ($scope) {
740
- $scope->assertSame('1 day from now', Carbon::now()->addDay()->diffForHumans());
741
- });
742
- }
743
-
744
- public function testDiffForHumansNowAndFutureDays()
745
- {
746
- $scope = $this;
747
- $this->wrapWithTestNow(function () use ($scope) {
748
- $scope->assertSame('2 days from now', Carbon::now()->addDays(2)->diffForHumans());
749
- });
750
- }
751
-
752
- public function testDiffForHumansNowAndNearlyFutureWeek()
753
- {
754
- $scope = $this;
755
- $this->wrapWithTestNow(function () use ($scope) {
756
- $scope->assertSame('6 days from now', Carbon::now()->addDays(6)->diffForHumans());
757
- });
758
- }
759
-
760
- public function testDiffForHumansNowAndFutureWeek()
761
- {
762
- $scope = $this;
763
- $this->wrapWithTestNow(function () use ($scope) {
764
- $scope->assertSame('1 week from now', Carbon::now()->addWeek()->diffForHumans());
765
- });
766
- }
767
-
768
- public function testDiffForHumansNowAndFutureWeeks()
769
- {
770
- $scope = $this;
771
- $this->wrapWithTestNow(function () use ($scope) {
772
- $scope->assertSame('2 weeks from now', Carbon::now()->addWeeks(2)->diffForHumans());
773
- });
774
- }
775
-
776
- public function testDiffForHumansNowAndNearlyFutureMonth()
777
- {
778
- $scope = $this;
779
- $this->wrapWithTestNow(function () use ($scope) {
780
- $scope->assertSame('3 weeks from now', Carbon::now()->addWeeks(3)->diffForHumans());
781
- });
782
- }
783
-
784
- public function testDiffForHumansNowAndFutureMonth()
785
- {
786
- $scope = $this;
787
- $this->wrapWithTestNow(function () use ($scope) {
788
- $scope->assertSame('4 weeks from now', Carbon::now()->addWeeks(4)->diffForHumans());
789
- $scope->assertSame('1 month from now', Carbon::now()->addMonth()->diffForHumans());
790
- });
791
- }
792
-
793
- public function testDiffForHumansNowAndFutureMonths()
794
- {
795
- $scope = $this;
796
- $this->wrapWithTestNow(function () use ($scope) {
797
- $scope->assertSame('2 months from now', Carbon::now()->addMonths(2)->diffForHumans());
798
- });
799
- }
800
-
801
- public function testDiffForHumansNowAndNearlyFutureYear()
802
- {
803
- $scope = $this;
804
- $this->wrapWithTestNow(function () use ($scope) {
805
- $scope->assertSame('11 months from now', Carbon::now()->addMonths(11)->diffForHumans());
806
- });
807
- }
808
-
809
- public function testDiffForHumansNowAndFutureYear()
810
- {
811
- $scope = $this;
812
- $this->wrapWithTestNow(function () use ($scope) {
813
- $scope->assertSame('1 year from now', Carbon::now()->addYear()->diffForHumans());
814
- });
815
- }
816
-
817
- public function testDiffForHumansNowAndFutureYears()
818
- {
819
- $scope = $this;
820
- $this->wrapWithTestNow(function () use ($scope) {
821
- $scope->assertSame('2 years from now', Carbon::now()->addYears(2)->diffForHumans());
822
- });
823
- }
824
-
825
- public function testDiffForHumansOtherAndSecond()
826
- {
827
- $scope = $this;
828
- $this->wrapWithTestNow(function () use ($scope) {
829
- $scope->assertSame('1 second before', Carbon::now()->diffForHumans(Carbon::now()->addSecond()));
830
- });
831
- }
832
-
833
- public function testDiffForHumansOtherAndSeconds()
834
- {
835
- $scope = $this;
836
- $this->wrapWithTestNow(function () use ($scope) {
837
- $scope->assertSame('2 seconds before', Carbon::now()->diffForHumans(Carbon::now()->addSeconds(2)));
838
- });
839
- }
840
-
841
- public function testDiffForHumansOtherAndNearlyMinute()
842
- {
843
- $scope = $this;
844
- $this->wrapWithTestNow(function () use ($scope) {
845
- $scope->assertSame('59 seconds before', Carbon::now()->diffForHumans(Carbon::now()->addSeconds(59)));
846
- });
847
- }
848
-
849
- public function testDiffForHumansOtherAndMinute()
850
- {
851
- $scope = $this;
852
- $this->wrapWithTestNow(function () use ($scope) {
853
- $scope->assertSame('1 minute before', Carbon::now()->diffForHumans(Carbon::now()->addMinute()));
854
- });
855
- }
856
-
857
- public function testDiffForHumansOtherAndMinutes()
858
- {
859
- $scope = $this;
860
- $this->wrapWithTestNow(function () use ($scope) {
861
- $scope->assertSame('2 minutes before', Carbon::now()->diffForHumans(Carbon::now()->addMinutes(2)));
862
- });
863
- }
864
-
865
- public function testDiffForHumansOtherAndNearlyHour()
866
- {
867
- $scope = $this;
868
- $this->wrapWithTestNow(function () use ($scope) {
869
- $scope->assertSame('59 minutes before', Carbon::now()->diffForHumans(Carbon::now()->addMinutes(59)));
870
- });
871
- }
872
-
873
- public function testDiffForHumansOtherAndHour()
874
- {
875
- $scope = $this;
876
- $this->wrapWithTestNow(function () use ($scope) {
877
- $scope->assertSame('1 hour before', Carbon::now()->diffForHumans(Carbon::now()->addHour()));
878
- });
879
- }
880
-
881
- public function testDiffForHumansOtherAndHours()
882
- {
883
- $scope = $this;
884
- $this->wrapWithTestNow(function () use ($scope) {
885
- $scope->assertSame('2 hours before', Carbon::now()->diffForHumans(Carbon::now()->addHours(2)));
886
- });
887
- }
888
-
889
- public function testDiffForHumansOtherAndNearlyDay()
890
- {
891
- $scope = $this;
892
- $this->wrapWithTestNow(function () use ($scope) {
893
- $scope->assertSame('23 hours before', Carbon::now()->diffForHumans(Carbon::now()->addHours(23)));
894
- });
895
- }
896
-
897
- public function testDiffForHumansOtherAndDay()
898
- {
899
- $scope = $this;
900
- $this->wrapWithTestNow(function () use ($scope) {
901
- $scope->assertSame('1 day before', Carbon::now()->diffForHumans(Carbon::now()->addDay()));
902
- });
903
- }
904
-
905
- public function testDiffForHumansOtherAndDays()
906
- {
907
- $scope = $this;
908
- $this->wrapWithTestNow(function () use ($scope) {
909
- $scope->assertSame('2 days before', Carbon::now()->diffForHumans(Carbon::now()->addDays(2)));
910
- });
911
- }
912
-
913
- public function testDiffForHumansOtherAndNearlyWeek()
914
- {
915
- $scope = $this;
916
- $this->wrapWithTestNow(function () use ($scope) {
917
- $scope->assertSame('6 days before', Carbon::now()->diffForHumans(Carbon::now()->addDays(6)));
918
- });
919
- }
920
-
921
- public function testDiffForHumansOtherAndWeek()
922
- {
923
- $scope = $this;
924
- $this->wrapWithTestNow(function () use ($scope) {
925
- $scope->assertSame('1 week before', Carbon::now()->diffForHumans(Carbon::now()->addWeek()));
926
- });
927
- }
928
-
929
- public function testDiffForHumansOtherAndWeeks()
930
- {
931
- $scope = $this;
932
- $this->wrapWithTestNow(function () use ($scope) {
933
- $scope->assertSame('2 weeks before', Carbon::now()->diffForHumans(Carbon::now()->addWeeks(2)));
934
- });
935
- }
936
-
937
- public function testDiffForHumansOtherAndNearlyMonth()
938
- {
939
- $scope = $this;
940
- $this->wrapWithTestNow(function () use ($scope) {
941
- $scope->assertSame('3 weeks before', Carbon::now()->diffForHumans(Carbon::now()->addWeeks(3)));
942
- });
943
- }
944
-
945
- public function testDiffForHumansOtherAndMonth()
946
- {
947
- $scope = $this;
948
- $this->wrapWithTestNow(function () use ($scope) {
949
- $scope->assertSame('4 weeks before', Carbon::now()->diffForHumans(Carbon::now()->addWeeks(4)));
950
- $scope->assertSame('1 month before', Carbon::now()->diffForHumans(Carbon::now()->addMonth()));
951
- });
952
- }
953
-
954
- public function testDiffForHumansOtherAndMonths()
955
- {
956
- $scope = $this;
957
- $this->wrapWithTestNow(function () use ($scope) {
958
- $scope->assertSame('2 months before', Carbon::now()->diffForHumans(Carbon::now()->addMonths(2)));
959
- });
960
- }
961
-
962
- public function testDiffForHumansOtherAndNearlyYear()
963
- {
964
- $scope = $this;
965
- $this->wrapWithTestNow(function () use ($scope) {
966
- $scope->assertSame('11 months before', Carbon::now()->diffForHumans(Carbon::now()->addMonths(11)));
967
- });
968
- }
969
-
970
- public function testDiffForHumansOtherAndYear()
971
- {
972
- $scope = $this;
973
- $this->wrapWithTestNow(function () use ($scope) {
974
- $scope->assertSame('1 year before', Carbon::now()->diffForHumans(Carbon::now()->addYear()));
975
- });
976
- }
977
-
978
- public function testDiffForHumansOtherAndYears()
979
- {
980
- $scope = $this;
981
- $this->wrapWithTestNow(function () use ($scope) {
982
- $scope->assertSame('2 years before', Carbon::now()->diffForHumans(Carbon::now()->addYears(2)));
983
- });
984
- }
985
-
986
- public function testDiffForHumansOtherAndFutureSecond()
987
- {
988
- $scope = $this;
989
- $this->wrapWithTestNow(function () use ($scope) {
990
- $scope->assertSame('1 second after', Carbon::now()->diffForHumans(Carbon::now()->subSecond()));
991
- });
992
- }
993
-
994
- public function testDiffForHumansOtherAndFutureSeconds()
995
- {
996
- $scope = $this;
997
- $this->wrapWithTestNow(function () use ($scope) {
998
- $scope->assertSame('2 seconds after', Carbon::now()->diffForHumans(Carbon::now()->subSeconds(2)));
999
- });
1000
- }
1001
-
1002
- public function testDiffForHumansOtherAndNearlyFutureMinute()
1003
- {
1004
- $scope = $this;
1005
- $this->wrapWithTestNow(function () use ($scope) {
1006
- $scope->assertSame('59 seconds after', Carbon::now()->diffForHumans(Carbon::now()->subSeconds(59)));
1007
- });
1008
- }
1009
-
1010
- public function testDiffForHumansOtherAndFutureMinute()
1011
- {
1012
- $scope = $this;
1013
- $this->wrapWithTestNow(function () use ($scope) {
1014
- $scope->assertSame('1 minute after', Carbon::now()->diffForHumans(Carbon::now()->subMinute()));
1015
- });
1016
- }
1017
-
1018
- public function testDiffForHumansOtherAndFutureMinutes()
1019
- {
1020
- $scope = $this;
1021
- $this->wrapWithTestNow(function () use ($scope) {
1022
- $scope->assertSame('2 minutes after', Carbon::now()->diffForHumans(Carbon::now()->subMinutes(2)));
1023
- });
1024
- }
1025
-
1026
- public function testDiffForHumansOtherAndNearlyFutureHour()
1027
- {
1028
- $scope = $this;
1029
- $this->wrapWithTestNow(function () use ($scope) {
1030
- $scope->assertSame('59 minutes after', Carbon::now()->diffForHumans(Carbon::now()->subMinutes(59)));
1031
- });
1032
- }
1033
-
1034
- public function testDiffForHumansOtherAndFutureHour()
1035
- {
1036
- $scope = $this;
1037
- $this->wrapWithTestNow(function () use ($scope) {
1038
- $scope->assertSame('1 hour after', Carbon::now()->diffForHumans(Carbon::now()->subHour()));
1039
- });
1040
- }
1041
-
1042
- public function testDiffForHumansOtherAndFutureHours()
1043
- {
1044
- $scope = $this;
1045
- $this->wrapWithTestNow(function () use ($scope) {
1046
- $scope->assertSame('2 hours after', Carbon::now()->diffForHumans(Carbon::now()->subHours(2)));
1047
- });
1048
- }
1049
-
1050
- public function testDiffForHumansOtherAndNearlyFutureDay()
1051
- {
1052
- $scope = $this;
1053
- $this->wrapWithTestNow(function () use ($scope) {
1054
- $scope->assertSame('23 hours after', Carbon::now()->diffForHumans(Carbon::now()->subHours(23)));
1055
- });
1056
- }
1057
-
1058
- public function testDiffForHumansOtherAndFutureDay()
1059
- {
1060
- $scope = $this;
1061
- $this->wrapWithTestNow(function () use ($scope) {
1062
- $scope->assertSame('1 day after', Carbon::now()->diffForHumans(Carbon::now()->subDay()));
1063
- });
1064
- }
1065
-
1066
- public function testDiffForHumansOtherAndFutureDays()
1067
- {
1068
- $scope = $this;
1069
- $this->wrapWithTestNow(function () use ($scope) {
1070
- $scope->assertSame('2 days after', Carbon::now()->diffForHumans(Carbon::now()->subDays(2)));
1071
- });
1072
- }
1073
-
1074
- public function testDiffForHumansOtherAndNearlyFutureWeek()
1075
- {
1076
- $scope = $this;
1077
- $this->wrapWithTestNow(function () use ($scope) {
1078
- $scope->assertSame('6 days after', Carbon::now()->diffForHumans(Carbon::now()->subDays(6)));
1079
- });
1080
- }
1081
-
1082
- public function testDiffForHumansOtherAndFutureWeek()
1083
- {
1084
- $scope = $this;
1085
- $this->wrapWithTestNow(function () use ($scope) {
1086
- $scope->assertSame('1 week after', Carbon::now()->diffForHumans(Carbon::now()->subWeek()));
1087
- });
1088
- }
1089
-
1090
- public function testDiffForHumansOtherAndFutureWeeks()
1091
- {
1092
- $scope = $this;
1093
- $this->wrapWithTestNow(function () use ($scope) {
1094
- $scope->assertSame('2 weeks after', Carbon::now()->diffForHumans(Carbon::now()->subWeeks(2)));
1095
- });
1096
- }
1097
-
1098
- public function testDiffForHumansOtherAndNearlyFutureMonth()
1099
- {
1100
- $scope = $this;
1101
- $this->wrapWithTestNow(function () use ($scope) {
1102
- $scope->assertSame('3 weeks after', Carbon::now()->diffForHumans(Carbon::now()->subWeeks(3)));
1103
- });
1104
- }
1105
-
1106
- public function testDiffForHumansOtherAndFutureMonth()
1107
- {
1108
- $scope = $this;
1109
- $this->wrapWithTestNow(function () use ($scope) {
1110
- $scope->assertSame('4 weeks after', Carbon::now()->diffForHumans(Carbon::now()->subWeeks(4)));
1111
- $scope->assertSame('1 month after', Carbon::now()->diffForHumans(Carbon::now()->subMonth()));
1112
- });
1113
- }
1114
-
1115
- public function testDiffForHumansOtherAndFutureMonths()
1116
- {
1117
- $scope = $this;
1118
- $this->wrapWithTestNow(function () use ($scope) {
1119
- $scope->assertSame('2 months after', Carbon::now()->diffForHumans(Carbon::now()->subMonths(2)));
1120
- });
1121
- }
1122
-
1123
- public function testDiffForHumansOtherAndNearlyFutureYear()
1124
- {
1125
- $scope = $this;
1126
- $this->wrapWithTestNow(function () use ($scope) {
1127
- $scope->assertSame('11 months after', Carbon::now()->diffForHumans(Carbon::now()->subMonths(11)));
1128
- });
1129
- }
1130
-
1131
- public function testDiffForHumansOtherAndFutureYear()
1132
- {
1133
- $scope = $this;
1134
- $this->wrapWithTestNow(function () use ($scope) {
1135
- $scope->assertSame('1 year after', Carbon::now()->diffForHumans(Carbon::now()->subYear()));
1136
- });
1137
- }
1138
-
1139
- public function testDiffForHumansOtherAndFutureYears()
1140
- {
1141
- $scope = $this;
1142
- $this->wrapWithTestNow(function () use ($scope) {
1143
- $scope->assertSame('2 years after', Carbon::now()->diffForHumans(Carbon::now()->subYears(2)));
1144
- });
1145
- }
1146
-
1147
- public function testDiffForHumansAbsoluteSeconds()
1148
- {
1149
- $scope = $this;
1150
- $this->wrapWithTestNow(function () use ($scope) {
1151
- $scope->assertSame('59 seconds', Carbon::now()->diffForHumans(Carbon::now()->subSeconds(59), true));
1152
- $scope->assertSame('59 seconds', Carbon::now()->diffForHumans(Carbon::now()->addSeconds(59), true));
1153
- });
1154
- }
1155
-
1156
- public function testDiffForHumansAbsoluteMinutes()
1157
- {
1158
- $scope = $this;
1159
- $this->wrapWithTestNow(function () use ($scope) {
1160
- $scope->assertSame('30 minutes', Carbon::now()->diffForHumans(Carbon::now()->subMinutes(30), true));
1161
- $scope->assertSame('30 minutes', Carbon::now()->diffForHumans(Carbon::now()->addMinutes(30), true));
1162
- });
1163
- }
1164
-
1165
- public function testDiffForHumansAbsoluteHours()
1166
- {
1167
- $scope = $this;
1168
- $this->wrapWithTestNow(function () use ($scope) {
1169
- $scope->assertSame('3 hours', Carbon::now()->diffForHumans(Carbon::now()->subHours(3), true));
1170
- $scope->assertSame('3 hours', Carbon::now()->diffForHumans(Carbon::now()->addHours(3), true));
1171
- });
1172
- }
1173
-
1174
- public function testDiffForHumansAbsoluteDays()
1175
- {
1176
- $scope = $this;
1177
- $this->wrapWithTestNow(function () use ($scope) {
1178
- $scope->assertSame('2 days', Carbon::now()->diffForHumans(Carbon::now()->subDays(2), true));
1179
- $scope->assertSame('2 days', Carbon::now()->diffForHumans(Carbon::now()->addDays(2), true));
1180
- });
1181
- }
1182
-
1183
- public function testDiffForHumansAbsoluteWeeks()
1184
- {
1185
- $scope = $this;
1186
- $this->wrapWithTestNow(function () use ($scope) {
1187
- $scope->assertSame('2 weeks', Carbon::now()->diffForHumans(Carbon::now()->subWeeks(2), true));
1188
- $scope->assertSame('2 weeks', Carbon::now()->diffForHumans(Carbon::now()->addWeeks(2), true));
1189
- });
1190
- }
1191
-
1192
- public function testDiffForHumansAbsoluteMonths()
1193
- {
1194
- $scope = $this;
1195
- $this->wrapWithTestNow(function () use ($scope) {
1196
- $scope->assertSame('2 months', Carbon::now()->diffForHumans(Carbon::now()->subMonths(2), true));
1197
- $scope->assertSame('2 months', Carbon::now()->diffForHumans(Carbon::now()->addMonths(2), true));
1198
- });
1199
- }
1200
-
1201
- public function testDiffForHumansAbsoluteYears()
1202
- {
1203
- $scope = $this;
1204
- $this->wrapWithTestNow(function () use ($scope) {
1205
- $scope->assertSame('1 year', Carbon::now()->diffForHumans(Carbon::now()->subYears(1), true));
1206
- $scope->assertSame('1 year', Carbon::now()->diffForHumans(Carbon::now()->addYears(1), true));
1207
- });
1208
- }
1209
-
1210
- public function testDiffForHumansWithShorterMonthShouldStillBeAMonth()
1211
- {
1212
- $feb15 = Carbon::parse('2015-02-15');
1213
- $mar15 = Carbon::parse('2015-03-15');
1214
- $this->assertSame('1 month after', $mar15->diffForHumans($feb15));
1215
- }
1216
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/ExpressiveComparisonTest.php DELETED
@@ -1,217 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class ExpressiveComparisonTest extends AbstractTestCase
18
- {
19
- public function testEqualToTrue()
20
- {
21
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->equalTo(Carbon::createFromDate(2000, 1, 1)));
22
- }
23
-
24
- public function testEqualToFalse()
25
- {
26
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->equalTo(Carbon::createFromDate(2000, 1, 2)));
27
- }
28
-
29
- public function testEqualWithTimezoneTrue()
30
- {
31
- $this->assertTrue(Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto')->equalTo(Carbon::create(2000, 1, 1, 9,
32
- 0, 0, 'America/Vancouver')));
33
- }
34
-
35
- public function testEqualWithTimezoneFalse()
36
- {
37
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->equalTo(Carbon::createFromDate(2000,
38
- 1, 1, 'America/Vancouver')));
39
- }
40
-
41
- public function testNotEqualToTrue()
42
- {
43
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->notEqualTo(Carbon::createFromDate(2000, 1, 2)));
44
- }
45
-
46
- public function testNotEqualToFalse()
47
- {
48
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->notEqualTo(Carbon::createFromDate(2000, 1, 1)));
49
- }
50
-
51
- public function testNotEqualWithTimezone()
52
- {
53
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1, 'America/Toronto')->notEqualTo(Carbon::createFromDate(2000,
54
- 1, 1, 'America/Vancouver')));
55
- }
56
-
57
- public function testGreaterThanTrue()
58
- {
59
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->greaterThan(Carbon::createFromDate(1999, 12, 31)));
60
- }
61
-
62
- public function testGreaterThanFalse()
63
- {
64
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->greaterThan(Carbon::createFromDate(2000, 1, 2)));
65
- }
66
-
67
- public function testGreaterThanWithTimezoneTrue()
68
- {
69
- $dt1 = Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto');
70
- $dt2 = Carbon::create(2000, 1, 1, 8, 59, 59, 'America/Vancouver');
71
- $this->assertTrue($dt1->greaterThan($dt2));
72
- }
73
-
74
- public function testGreaterThanWithTimezoneFalse()
75
- {
76
- $dt1 = Carbon::create(2000, 1, 1, 12, 0, 0, 'America/Toronto');
77
- $dt2 = Carbon::create(2000, 1, 1, 9, 0, 1, 'America/Vancouver');
78
- $this->assertFalse($dt1->greaterThan($dt2));
79
- }
80
-
81
- public function testGreaterThanOrEqualTrue()
82
- {
83
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(1999, 12,
84
- 31)));
85
- }
86
-
87
- public function testGreaterThanOrEqualTrueEqual()
88
- {
89
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(2000, 1, 1)));
90
- }
91
-
92
- public function testGreaterThanOrEqualFalse()
93
- {
94
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->greaterThanOrEqualTo(Carbon::createFromDate(2000, 1,
95
- 2)));
96
- }
97
-
98
- public function testLessThanTrue()
99
- {
100
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lessThan(Carbon::createFromDate(2000, 1, 2)));
101
- }
102
-
103
- public function testLessThanFalse()
104
- {
105
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->lessThan(Carbon::createFromDate(1999, 12, 31)));
106
- }
107
-
108
- public function testLessThanOrEqualTrue()
109
- {
110
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lessThanOrEqualTo(Carbon::createFromDate(2000, 1, 2)));
111
- }
112
-
113
- public function testLessThanOrEqualTrueEqual()
114
- {
115
- $this->assertTrue(Carbon::createFromDate(2000, 1, 1)->lessThanOrEqualTo(Carbon::createFromDate(2000, 1, 1)));
116
- }
117
-
118
- public function testLessThanOrEqualFalse()
119
- {
120
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->lessThanOrEqualTo(Carbon::createFromDate(1999, 12, 31)));
121
- }
122
-
123
- public function testBetweenEqualTrue()
124
- {
125
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1),
126
- Carbon::createFromDate(2000, 1, 31), true));
127
- }
128
-
129
- public function testBetweenNotEqualTrue()
130
- {
131
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 1),
132
- Carbon::createFromDate(2000, 1, 31), false));
133
- }
134
-
135
- public function testBetweenEqualFalse()
136
- {
137
- $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 1),
138
- Carbon::createFromDate(2000, 1, 31), true));
139
- }
140
-
141
- public function testBetweenNotEqualFalse()
142
- {
143
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 1),
144
- Carbon::createFromDate(2000, 1, 31), false));
145
- }
146
-
147
- public function testBetweenEqualSwitchTrue()
148
- {
149
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31),
150
- Carbon::createFromDate(2000, 1, 1), true));
151
- }
152
-
153
- public function testBetweenNotEqualSwitchTrue()
154
- {
155
- $this->assertTrue(Carbon::createFromDate(2000, 1, 15)->between(Carbon::createFromDate(2000, 1, 31),
156
- Carbon::createFromDate(2000, 1, 1), false));
157
- }
158
-
159
- public function testBetweenEqualSwitchFalse()
160
- {
161
- $this->assertFalse(Carbon::createFromDate(1999, 12, 31)->between(Carbon::createFromDate(2000, 1, 31),
162
- Carbon::createFromDate(2000, 1, 1), true));
163
- }
164
-
165
- public function testBetweenNotEqualSwitchFalse()
166
- {
167
- $this->assertFalse(Carbon::createFromDate(2000, 1, 1)->between(Carbon::createFromDate(2000, 1, 31),
168
- Carbon::createFromDate(2000, 1, 1), false));
169
- }
170
-
171
- public function testMinIsFluid()
172
- {
173
- $dt = Carbon::now();
174
- $this->assertInstanceOfCarbon($dt->minimum());
175
- }
176
-
177
- public function testMinWithNow()
178
- {
179
- $dt = Carbon::create(2012, 1, 1, 0, 0, 0)->minimum();
180
- $this->assertCarbon($dt, 2012, 1, 1, 0, 0, 0);
181
- }
182
-
183
- public function testMinWithInstance()
184
- {
185
- $dt1 = Carbon::create(2013, 12, 31, 23, 59, 59);
186
- $dt2 = Carbon::create(2012, 1, 1, 0, 0, 0)->minimum($dt1);
187
- $this->assertCarbon($dt2, 2012, 1, 1, 0, 0, 0);
188
- }
189
-
190
- public function testMaxIsFluid()
191
- {
192
- $dt = Carbon::now();
193
- $this->assertInstanceOfCarbon($dt->maximum());
194
- }
195
-
196
- public function testMaxWithNow()
197
- {
198
- $dt = Carbon::create(2099, 12, 31, 23, 59, 59)->maximum();
199
- $this->assertCarbon($dt, 2099, 12, 31, 23, 59, 59);
200
- }
201
-
202
- public function testMaxWithInstance()
203
- {
204
- $dt1 = Carbon::create(2012, 1, 1, 0, 0, 0);
205
- $dt2 = Carbon::create(2099, 12, 31, 23, 59, 59)->maximum($dt1);
206
- $this->assertCarbon($dt2, 2099, 12, 31, 23, 59, 59);
207
- }
208
-
209
- public function testIsBirthday()
210
- {
211
- $dt1 = Carbon::createFromDate(1987, 4, 23);
212
- $dt2 = Carbon::createFromDate(2014, 9, 26);
213
- $dt3 = Carbon::createFromDate(2014, 4, 23);
214
- $this->assertFalse($dt2->isBirthday($dt1));
215
- $this->assertTrue($dt3->isBirthday($dt1));
216
- }
217
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/Fixtures/MyCarbon.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon\Fixtures;
13
-
14
- use Carbon\Carbon;
15
-
16
- class MyCarbon extends Carbon
17
- {
18
- //
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/FluidSettersTest.php DELETED
@@ -1,116 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class FluidSettersTest extends AbstractTestCase
18
- {
19
- public function testFluidYearSetter()
20
- {
21
- $d = Carbon::now();
22
- $this->assertInstanceOfCarbon($d->year(1995));
23
- $this->assertSame(1995, $d->year);
24
- }
25
-
26
- public function testFluidMonthSetter()
27
- {
28
- $d = Carbon::now();
29
- $this->assertInstanceOfCarbon($d->month(3));
30
- $this->assertSame(3, $d->month);
31
- }
32
-
33
- public function testFluidMonthSetterWithWrap()
34
- {
35
- $d = Carbon::createFromDate(2012, 8, 21);
36
- $this->assertInstanceOfCarbon($d->month(13));
37
- $this->assertSame(1, $d->month);
38
- }
39
-
40
- public function testFluidDaySetter()
41
- {
42
- $d = Carbon::now();
43
- $this->assertInstanceOfCarbon($d->day(2));
44
- $this->assertSame(2, $d->day);
45
- }
46
-
47
- public function testFluidDaySetterWithWrap()
48
- {
49
- $d = Carbon::createFromDate(2000, 1, 1);
50
- $this->assertInstanceOfCarbon($d->day(32));
51
- $this->assertSame(1, $d->day);
52
- }
53
-
54
- public function testFluidSetDate()
55
- {
56
- $d = Carbon::createFromDate(2000, 1, 1);
57
- $this->assertInstanceOfCarbon($d->setDate(1995, 13, 32));
58
- $this->assertCarbon($d, 1996, 2, 1);
59
- }
60
-
61
- public function testFluidHourSetter()
62
- {
63
- $d = Carbon::now();
64
- $this->assertInstanceOfCarbon($d->hour(2));
65
- $this->assertSame(2, $d->hour);
66
- }
67
-
68
- public function testFluidHourSetterWithWrap()
69
- {
70
- $d = Carbon::now();
71
- $this->assertInstanceOfCarbon($d->hour(25));
72
- $this->assertSame(1, $d->hour);
73
- }
74
-
75
- public function testFluidMinuteSetter()
76
- {
77
- $d = Carbon::now();
78
- $this->assertInstanceOfCarbon($d->minute(2));
79
- $this->assertSame(2, $d->minute);
80
- }
81
-
82
- public function testFluidMinuteSetterWithWrap()
83
- {
84
- $d = Carbon::now();
85
- $this->assertInstanceOfCarbon($d->minute(61));
86
- $this->assertSame(1, $d->minute);
87
- }
88
-
89
- public function testFluidSecondSetter()
90
- {
91
- $d = Carbon::now();
92
- $this->assertInstanceOfCarbon($d->second(2));
93
- $this->assertSame(2, $d->second);
94
- }
95
-
96
- public function testFluidSecondSetterWithWrap()
97
- {
98
- $d = Carbon::now();
99
- $this->assertInstanceOfCarbon($d->second(62));
100
- $this->assertSame(2, $d->second);
101
- }
102
-
103
- public function testFluidSetTime()
104
- {
105
- $d = Carbon::createFromDate(2000, 1, 1);
106
- $this->assertInstanceOfCarbon($d->setTime(25, 61, 61));
107
- $this->assertCarbon($d, 2000, 1, 2, 2, 2, 1);
108
- }
109
-
110
- public function testFluidTimestampSetter()
111
- {
112
- $d = Carbon::now();
113
- $this->assertInstanceOfCarbon($d->timestamp(10));
114
- $this->assertSame(10, $d->timestamp);
115
- }
116
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/GettersTest.php DELETED
@@ -1,327 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class GettersTest extends AbstractTestCase
18
- {
19
- /**
20
- * @expectedException \InvalidArgumentException
21
- */
22
- public function testGettersThrowExceptionOnUnknownGetter()
23
- {
24
- Carbon::create(1234, 5, 6, 7, 8, 9)->doesNotExit;
25
- }
26
-
27
- public function testYearGetter()
28
- {
29
- $d = Carbon::create(1234, 5, 6, 7, 8, 9);
30
- $this->assertSame(1234, $d->year);
31
- }
32
-
33
- public function testYearIsoGetter()
34
- {
35
- $d = Carbon::createFromDate(2012, 12, 31);
36
- $this->assertSame(2013, $d->yearIso);
37
- }
38
-
39
- public function testMonthGetter()
40
- {
41
- $d = Carbon::create(1234, 5, 6, 7, 8, 9);
42
- $this->assertSame(5, $d->month);
43
- }
44
-
45
- public function testDayGetter()
46
- {
47
- $d = Carbon::create(1234, 5, 6, 7, 8, 9);
48
- $this->assertSame(6, $d->day);
49
- }
50
-
51
- public function testHourGetter()
52
- {
53
- $d = Carbon::create(1234, 5, 6, 7, 8, 9);
54
- $this->assertSame(7, $d->hour);
55
- }
56
-
57
- public function testMinuteGetter()
58
- {
59
- $d = Carbon::create(1234, 5, 6, 7, 8, 9);
60
- $this->assertSame(8, $d->minute);
61
- }
62
-
63
- public function testSecondGetter()
64
- {
65
- $d = Carbon::create(1234, 5, 6, 7, 8, 9);
66
- $this->assertSame(9, $d->second);
67
- }
68
-
69
- public function testMicroGetter()
70
- {
71
- $micro = 345678;
72
- $d = Carbon::parse('2014-01-05 12:34:11.'.$micro);
73
- $this->assertSame($micro, $d->micro);
74
- }
75
-
76
- public function testMicroGetterWithDefaultNow()
77
- {
78
- if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
79
- $this->markTestSkipped();
80
- }
81
-
82
- $d = Carbon::now();
83
- $this->assertSame(0, $d->micro);
84
- }
85
-
86
- public function testDayOfWeeGetter()
87
- {
88
- $d = Carbon::create(2012, 5, 7, 7, 8, 9);
89
- $this->assertSame(Carbon::MONDAY, $d->dayOfWeek);
90
- }
91
-
92
- public function testDayOfYearGetter()
93
- {
94
- $d = Carbon::createFromDate(2012, 5, 7);
95
- $this->assertSame(127, $d->dayOfYear);
96
- }
97
-
98
- public function testDaysInMonthGetter()
99
- {
100
- $d = Carbon::createFromDate(2012, 5, 7);
101
- $this->assertSame(31, $d->daysInMonth);
102
- }
103
-
104
- public function testTimestampGetter()
105
- {
106
- $d = Carbon::create();
107
- $d->setTimezone('GMT');
108
- $this->assertSame(0, $d->setDateTime(1970, 1, 1, 0, 0, 0)->timestamp);
109
- }
110
-
111
- public function testGetAge()
112
- {
113
- $d = Carbon::now();
114
- $this->assertSame(0, $d->age);
115
- }
116
-
117
- public function testGetAgeWithRealAge()
118
- {
119
- $d = Carbon::createFromDate(1975, 5, 21);
120
- $age = intval(substr(date('Ymd') - date('Ymd', $d->timestamp), 0, -4));
121
-
122
- $this->assertSame($age, $d->age);
123
- }
124
-
125
- public function dataProviderTestQuarter()
126
- {
127
- return array(
128
- array(1, 1),
129
- array(2, 1),
130
- array(3, 1),
131
- array(4, 2),
132
- array(5, 2),
133
- array(6, 2),
134
- array(7, 3),
135
- array(8, 3),
136
- array(9, 3),
137
- array(10, 4),
138
- array(11, 4),
139
- array(12, 4),
140
- );
141
- }
142
-
143
- /**
144
- * @dataProvider \Tests\Carbon\GettersTest::dataProviderTestQuarter
145
- *
146
- * @param int $month
147
- * @param int $quarter
148
- */
149
- public function testQuarterFirstOfMonth($month, $quarter)
150
- {
151
- $c = Carbon::create(2015, $month)->startOfMonth();
152
- $this->assertSame($quarter, $c->quarter);
153
- }
154
-
155
- /**
156
- * @dataProvider \Tests\Carbon\GettersTest::dataProviderTestQuarter
157
- *
158
- * @param int $month
159
- * @param int $quarter
160
- */
161
- public function testQuarterMiddleOfMonth($month, $quarter)
162
- {
163
- $c = Carbon::create(2015, $month, 15, 12, 13, 14);
164
- $this->assertSame($quarter, $c->quarter);
165
- }
166
-
167
- /**
168
- * @dataProvider \Tests\Carbon\GettersTest::dataProviderTestQuarter
169
- *
170
- * @param int $month
171
- * @param int $quarter
172
- */
173
- public function testQuarterLastOfMonth($month, $quarter)
174
- {
175
- $c = Carbon::create(2015, $month)->endOfMonth();
176
- $this->assertSame($quarter, $c->quarter);
177
- }
178
-
179
- public function testGetLocalTrue()
180
- {
181
- // Default timezone has been set to America/Toronto in AbstractTestCase.php
182
- // @see : http://en.wikipedia.org/wiki/List_of_UTC_time_offsets
183
- $this->assertTrue(Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->local);
184
- $this->assertTrue(Carbon::createFromDate(2012, 1, 1, 'America/New_York')->local);
185
- }
186
-
187
- public function testGetLocalFalse()
188
- {
189
- $this->assertFalse(Carbon::createFromDate(2012, 7, 1, 'UTC')->local);
190
- $this->assertFalse(Carbon::createFromDate(2012, 7, 1, 'Europe/London')->local);
191
- }
192
-
193
- public function testGetUtcFalse()
194
- {
195
- $this->assertFalse(Carbon::createFromDate(2013, 1, 1, 'America/Toronto')->utc);
196
- $this->assertFalse(Carbon::createFromDate(2013, 1, 1, 'Europe/Paris')->utc);
197
- }
198
-
199
- public function testGetUtcTrue()
200
- {
201
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Atlantic/Reykjavik')->utc);
202
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Europe/Lisbon')->utc);
203
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Africa/Casablanca')->utc);
204
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Africa/Dakar')->utc);
205
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Europe/Dublin')->utc);
206
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'Europe/London')->utc);
207
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'UTC')->utc);
208
- $this->assertTrue(Carbon::createFromDate(2013, 1, 1, 'GMT')->utc);
209
- }
210
-
211
- public function testGetDstFalse()
212
- {
213
- $this->assertFalse(Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->dst);
214
- }
215
-
216
- public function testGetDstTrue()
217
- {
218
- $this->assertTrue(Carbon::createFromDate(2012, 7, 1, 'America/Toronto')->dst);
219
- }
220
-
221
- public function testOffsetForTorontoWithDST()
222
- {
223
- $this->assertSame(-18000, Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->offset);
224
- }
225
-
226
- public function testOffsetForTorontoNoDST()
227
- {
228
- $this->assertSame(-14400, Carbon::createFromDate(2012, 6, 1, 'America/Toronto')->offset);
229
- }
230
-
231
- public function testOffsetForGMT()
232
- {
233
- $this->assertSame(0, Carbon::createFromDate(2012, 6, 1, 'GMT')->offset);
234
- }
235
-
236
- public function testOffsetHoursForTorontoWithDST()
237
- {
238
- $this->assertSame(-5, Carbon::createFromDate(2012, 1, 1, 'America/Toronto')->offsetHours);
239
- }
240
-
241
- public function testOffsetHoursForTorontoNoDST()
242
- {
243
- $this->assertSame(-4, Carbon::createFromDate(2012, 6, 1, 'America/Toronto')->offsetHours);
244
- }
245
-
246
- public function testOffsetHoursForGMT()
247
- {
248
- $this->assertSame(0, Carbon::createFromDate(2012, 6, 1, 'GMT')->offsetHours);
249
- }
250
-
251
- public function testIsLeapYearTrue()
252
- {
253
- $this->assertTrue(Carbon::createFromDate(2012, 1, 1)->isLeapYear());
254
- }
255
-
256
- public function testIsLeapYearFalse()
257
- {
258
- $this->assertFalse(Carbon::createFromDate(2011, 1, 1)->isLeapYear());
259
- }
260
-
261
- public function testIsLongYearTrue()
262
- {
263
- $this->assertTrue(Carbon::createFromDate(2015, 1, 1)->isLongYear());
264
- }
265
-
266
- public function testIsLongYearFalse()
267
- {
268
- $this->assertFalse(Carbon::createFromDate(2016, 1, 1)->isLongYear());
269
- }
270
-
271
- public function testWeekOfMonth()
272
- {
273
- $this->assertSame(5, Carbon::createFromDate(2012, 9, 30)->weekOfMonth);
274
- $this->assertSame(4, Carbon::createFromDate(2012, 9, 28)->weekOfMonth);
275
- $this->assertSame(3, Carbon::createFromDate(2012, 9, 20)->weekOfMonth);
276
- $this->assertSame(2, Carbon::createFromDate(2012, 9, 8)->weekOfMonth);
277
- $this->assertSame(1, Carbon::createFromDate(2012, 9, 1)->weekOfMonth);
278
- }
279
-
280
- public function testWeekOfYearFirstWeek()
281
- {
282
- $this->assertSame(52, Carbon::createFromDate(2012, 1, 1)->weekOfYear);
283
- $this->assertSame(1, Carbon::createFromDate(2012, 1, 2)->weekOfYear);
284
- }
285
-
286
- public function testWeekOfYearLastWeek()
287
- {
288
- $this->assertSame(52, Carbon::createFromDate(2012, 12, 30)->weekOfYear);
289
- $this->assertSame(1, Carbon::createFromDate(2012, 12, 31)->weekOfYear);
290
- }
291
-
292
- public function testGetTimezone()
293
- {
294
- $dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
295
- $this->assertSame('America/Toronto', $dt->timezone->getName());
296
-
297
- $dt = Carbon::createFromDate(2000, 1, 1, -5);
298
- $this->assertSame('America/Chicago', $dt->timezone->getName());
299
- }
300
-
301
- public function testGetTz()
302
- {
303
- $dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
304
- $this->assertSame('America/Toronto', $dt->tz->getName());
305
-
306
- $dt = Carbon::createFromDate(2000, 1, 1, -5);
307
- $this->assertSame('America/Chicago', $dt->tz->getName());
308
- }
309
-
310
- public function testGetTimezoneName()
311
- {
312
- $dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
313
- $this->assertSame('America/Toronto', $dt->timezoneName);
314
-
315
- $dt = Carbon::createFromDate(2000, 1, 1, -5);
316
- $this->assertSame('America/Chicago', $dt->timezoneName);
317
- }
318
-
319
- public function testGetTzName()
320
- {
321
- $dt = Carbon::createFromDate(2000, 1, 1, 'America/Toronto');
322
- $this->assertSame('America/Toronto', $dt->tzName);
323
-
324
- $dt = Carbon::createFromDate(2000, 1, 1, -5);
325
- $this->assertSame('America/Chicago', $dt->timezoneName);
326
- }
327
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/InstanceTest.php DELETED
@@ -1,60 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTime;
16
- use DateTimeZone;
17
- use Tests\AbstractTestCase;
18
-
19
- class InstanceTest extends AbstractTestCase
20
- {
21
- public function testInstanceFromDateTime()
22
- {
23
- $dating = Carbon::instance(DateTime::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11'));
24
- $this->assertCarbon($dating, 1975, 5, 21, 22, 32, 11);
25
- }
26
-
27
- public function testInstanceFromCarbon()
28
- {
29
- $dating = Carbon::instance(Carbon::create(1975, 5, 21, 22, 32, 11));
30
- $this->assertCarbon($dating, 1975, 5, 21, 22, 32, 11);
31
- }
32
-
33
- public function testInstanceFromDateTimeKeepsTimezoneName()
34
- {
35
- $dating = Carbon::instance(DateTime::createFromFormat('Y-m-d H:i:s', '1975-05-21 22:32:11')->setTimezone(new DateTimeZone('America/Vancouver')));
36
- $this->assertSame('America/Vancouver', $dating->tzName);
37
- }
38
-
39
- public function testInstanceFromCarbonKeepsTimezoneName()
40
- {
41
- $dating = Carbon::instance(Carbon::create(1975, 5, 21, 22, 32, 11)->setTimezone(new \DateTimeZone('America/Vancouver')));
42
- $this->assertSame('America/Vancouver', $dating->tzName);
43
- }
44
-
45
- public function testInstanceFromDateTimeKeepsMicros()
46
- {
47
- $micro = 254687;
48
- $datetime = DateTime::createFromFormat('Y-m-d H:i:s.u', '2014-02-01 03:45:27.'.$micro);
49
- $carbon = Carbon::instance($datetime);
50
- $this->assertSame($micro, $carbon->micro);
51
- }
52
-
53
- public function testInstanceFromCarbonKeepsMicros()
54
- {
55
- $micro = 254687;
56
- $carbon = Carbon::createFromFormat('Y-m-d H:i:s.u', '2014-02-01 03:45:27.'.$micro);
57
- $carbon = Carbon::instance($carbon);
58
- $this->assertSame($micro, $carbon->micro);
59
- }
60
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/IsTest.php DELETED
@@ -1,388 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class IsTest extends AbstractTestCase
18
- {
19
- public function testIsWeekdayTrue()
20
- {
21
- $this->assertTrue(Carbon::createFromDate(2012, 1, 2)->isWeekday());
22
- }
23
-
24
- public function testIsWeekdayFalse()
25
- {
26
- $this->assertFalse(Carbon::createFromDate(2012, 1, 1)->isWeekday());
27
- }
28
-
29
- public function testIsWeekendTrue()
30
- {
31
- $this->assertTrue(Carbon::createFromDate(2012, 1, 1)->isWeekend());
32
- }
33
-
34
- public function testIsWeekendFalse()
35
- {
36
- $this->assertFalse(Carbon::createFromDate(2012, 1, 2)->isWeekend());
37
- }
38
-
39
- public function testIsYesterdayTrue()
40
- {
41
- $this->assertTrue(Carbon::now()->subDay()->isYesterday());
42
- }
43
-
44
- public function testIsYesterdayFalseWithToday()
45
- {
46
- $this->assertFalse(Carbon::now()->endOfDay()->isYesterday());
47
- }
48
-
49
- public function testIsYesterdayFalseWith2Days()
50
- {
51
- $this->assertFalse(Carbon::now()->subDays(2)->startOfDay()->isYesterday());
52
- }
53
-
54
- public function testIsTodayTrue()
55
- {
56
- $this->assertTrue(Carbon::now()->isToday());
57
- }
58
-
59
- public function testIsNextWeekTrue()
60
- {
61
- $this->assertTrue(Carbon::now()->addWeek()->isNextWeek());
62
- }
63
-
64
- public function testIsLastWeekTrue()
65
- {
66
- $this->assertTrue(Carbon::now()->subWeek()->isLastWeek());
67
- }
68
-
69
- public function testIsNextWeekFalse()
70
- {
71
- $this->assertFalse(Carbon::now()->addWeek(2)->isNextWeek());
72
- }
73
-
74
- public function testIsLastWeekFalse()
75
- {
76
- $this->assertFalse(Carbon::now()->subWeek(2)->isLastWeek());
77
- }
78
-
79
- public function testIsNextMonthTrue()
80
- {
81
- $this->assertTrue(Carbon::now()->addMonth()->isNextMonth());
82
- }
83
-
84
- public function testIsLastMonthTrue()
85
- {
86
- $this->assertTrue(Carbon::now()->subMonth()->isLastMonth());
87
- }
88
-
89
- public function testIsNextMonthFalse()
90
- {
91
- $this->assertFalse(Carbon::now()->addMonth(2)->isNextMonth());
92
- }
93
-
94
- public function testIsLastMonthFalse()
95
- {
96
- $this->assertFalse(Carbon::now()->subMonth(2)->isLastMonth());
97
- }
98
-
99
- public function testIsNextYearTrue()
100
- {
101
- $this->assertTrue(Carbon::now()->addYear()->isNextYear());
102
- }
103
-
104
- public function testIsLastYearTrue()
105
- {
106
- $this->assertTrue(Carbon::now()->subYear()->isLastYear());
107
- }
108
-
109
- public function testIsNextYearFalse()
110
- {
111
- $this->assertFalse(Carbon::now()->addYear(2)->isNextYear());
112
- }
113
-
114
- public function testIsLastYearFalse()
115
- {
116
- $this->assertFalse(Carbon::now()->subYear(2)->isLastYear());
117
- }
118
-
119
- public function testIsTodayFalseWithYesterday()
120
- {
121
- $this->assertFalse(Carbon::now()->subDay()->endOfDay()->isToday());
122
- }
123
-
124
- public function testIsTodayFalseWithTomorrow()
125
- {
126
- $this->assertFalse(Carbon::now()->addDay()->startOfDay()->isToday());
127
- }
128
-
129
- public function testIsTodayWithTimezone()
130
- {
131
- $this->assertTrue(Carbon::now('Asia/Tokyo')->isToday());
132
- }
133
-
134
- public function testIsTomorrowTrue()
135
- {
136
- $this->assertTrue(Carbon::now()->addDay()->isTomorrow());
137
- }
138
-
139
- public function testIsTomorrowFalseWithToday()
140
- {
141
- $this->assertFalse(Carbon::now()->endOfDay()->isTomorrow());
142
- }
143
-
144
- public function testIsTomorrowFalseWith2Days()
145
- {
146
- $this->assertFalse(Carbon::now()->addDays(2)->startOfDay()->isTomorrow());
147
- }
148
-
149
- public function testIsFutureTrue()
150
- {
151
- $this->assertTrue(Carbon::now()->addSecond()->isFuture());
152
- }
153
-
154
- public function testIsFutureFalse()
155
- {
156
- $this->assertFalse(Carbon::now()->isFuture());
157
- }
158
-
159
- public function testIsFutureFalseInThePast()
160
- {
161
- $this->assertFalse(Carbon::now()->subSecond()->isFuture());
162
- }
163
-
164
- public function testIsPastTrue()
165
- {
166
- $this->assertTrue(Carbon::now()->subSecond()->isPast());
167
- }
168
-
169
- public function testIsPastFalse()
170
- {
171
- $this->assertFalse(Carbon::now()->addSecond()->isPast());
172
- }
173
-
174
- public function testNowIsPastFalse()
175
- {
176
- if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
177
- $this->markTestSkipped();
178
- }
179
-
180
- $this->assertFalse(Carbon::now()->isPast());
181
- }
182
-
183
- public function testIsLeapYearTrue()
184
- {
185
- $this->assertTrue(Carbon::createFromDate(2016, 1, 1)->isLeapYear());
186
- }
187
-
188
- public function testIsLeapYearFalse()
189
- {
190
- $this->assertFalse(Carbon::createFromDate(2014, 1, 1)->isLeapYear());
191
- }
192
-
193
- public function testIsCurrentYearTrue()
194
- {
195
- $this->assertTrue(Carbon::now()->isCurrentYear());
196
- }
197
-
198
- public function testIsCurrentYearFalse()
199
- {
200
- $this->assertFalse(Carbon::now()->subYear()->isCurrentYear());
201
- }
202
-
203
- public function testIsSameYearTrue()
204
- {
205
- $this->assertTrue(Carbon::now()->isSameYear(Carbon::now()));
206
- }
207
-
208
- public function testIsSameYearFalse()
209
- {
210
- $this->assertFalse(Carbon::now()->isSameYear(Carbon::now()->subYear()));
211
- }
212
-
213
- public function testIsCurrentMonthTrue()
214
- {
215
- $this->assertTrue(Carbon::now()->isCurrentMonth());
216
- }
217
-
218
- public function testIsCurrentMonthFalse()
219
- {
220
- $this->assertFalse(Carbon::now()->subMonth()->isCurrentMonth());
221
- }
222
-
223
- public function testIsSameMonthTrue()
224
- {
225
- $this->assertTrue(Carbon::now()->isSameMonth(Carbon::now()));
226
- }
227
-
228
- public function testIsSameMonthFalse()
229
- {
230
- $this->assertFalse(Carbon::now()->isSameMonth(Carbon::now()->subMonth()));
231
- }
232
-
233
- public function testIsSameMonthAndYearTrue()
234
- {
235
- $this->assertTrue(Carbon::now()->isSameMonth(Carbon::now(), true));
236
- }
237
-
238
- public function testIsSameMonthAndYearFalse()
239
- {
240
- $this->assertFalse(Carbon::now()->isSameMonth(Carbon::now()->subYear(), true));
241
- }
242
-
243
- public function testIsSameDayTrue()
244
- {
245
- $current = Carbon::createFromDate(2012, 1, 2);
246
- $this->assertTrue($current->isSameDay(Carbon::createFromDate(2012, 1, 2)));
247
- }
248
-
249
- public function testIsSameDayFalse()
250
- {
251
- $current = Carbon::createFromDate(2012, 1, 2);
252
- $this->assertFalse($current->isSameDay(Carbon::createFromDate(2012, 1, 3)));
253
- }
254
-
255
- public function testIsSunday()
256
- {
257
- // True in the past past
258
- $this->assertTrue(Carbon::createFromDate(2015, 5, 31)->isSunday());
259
- $this->assertTrue(Carbon::createFromDate(2015, 6, 21)->isSunday());
260
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::SUNDAY)->isSunday());
261
-
262
- // True in the future
263
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::SUNDAY)->isSunday());
264
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::SUNDAY)->isSunday());
265
-
266
- // False in the past
267
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::MONDAY)->isSunday());
268
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::MONDAY)->isSunday());
269
-
270
- // False in the future
271
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::MONDAY)->isSunday());
272
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::MONDAY)->isSunday());
273
- }
274
-
275
- public function testIsMonday()
276
- {
277
- // True in the past past
278
- $this->assertTrue(Carbon::createFromDate(2015, 6, 1)->isMonday());
279
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::MONDAY)->isMonday());
280
-
281
- // True in the future
282
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::MONDAY)->isMonday());
283
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::MONDAY)->isMonday());
284
-
285
- // False in the past
286
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::TUESDAY)->isMonday());
287
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::TUESDAY)->isMonday());
288
-
289
- // False in the future
290
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::TUESDAY)->isMonday());
291
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::TUESDAY)->isMonday());
292
- }
293
-
294
- public function testIsTuesday()
295
- {
296
- // True in the past past
297
- $this->assertTrue(Carbon::createFromDate(2015, 6, 2)->isTuesday());
298
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::TUESDAY)->isTuesday());
299
-
300
- // True in the future
301
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::TUESDAY)->isTuesday());
302
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::TUESDAY)->isTuesday());
303
-
304
- // False in the past
305
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::WEDNESDAY)->isTuesday());
306
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::WEDNESDAY)->isTuesday());
307
-
308
- // False in the future
309
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::WEDNESDAY)->isTuesday());
310
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::WEDNESDAY)->isTuesday());
311
- }
312
-
313
- public function testIsWednesday()
314
- {
315
- // True in the past past
316
- $this->assertTrue(Carbon::createFromDate(2015, 6, 3)->isWednesday());
317
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::WEDNESDAY)->isWednesday());
318
-
319
- // True in the future
320
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::WEDNESDAY)->isWednesday());
321
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::WEDNESDAY)->isWednesday());
322
-
323
- // False in the past
324
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::THURSDAY)->isWednesday());
325
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::THURSDAY)->isWednesday());
326
-
327
- // False in the future
328
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::THURSDAY)->isWednesday());
329
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::THURSDAY)->isWednesday());
330
- }
331
-
332
- public function testIsThursday()
333
- {
334
- // True in the past past
335
- $this->assertTrue(Carbon::createFromDate(2015, 6, 4)->isThursday());
336
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::THURSDAY)->isThursday());
337
-
338
- // True in the future
339
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::THURSDAY)->isThursday());
340
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::THURSDAY)->isThursday());
341
-
342
- // False in the past
343
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::FRIDAY)->isThursday());
344
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::FRIDAY)->isThursday());
345
-
346
- // False in the future
347
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::FRIDAY)->isThursday());
348
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::FRIDAY)->isThursday());
349
- }
350
-
351
- public function testIsFriday()
352
- {
353
- // True in the past past
354
- $this->assertTrue(Carbon::createFromDate(2015, 6, 5)->isFriday());
355
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::FRIDAY)->isFriday());
356
-
357
- // True in the future
358
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::FRIDAY)->isFriday());
359
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::FRIDAY)->isFriday());
360
-
361
- // False in the past
362
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::SATURDAY)->isFriday());
363
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::SATURDAY)->isFriday());
364
-
365
- // False in the future
366
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::SATURDAY)->isFriday());
367
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::SATURDAY)->isFriday());
368
- }
369
-
370
- public function testIsSaturday()
371
- {
372
- // True in the past past
373
- $this->assertTrue(Carbon::createFromDate(2015, 6, 6)->isSaturday());
374
- $this->assertTrue(Carbon::now()->subWeek()->previous(Carbon::SATURDAY)->isSaturday());
375
-
376
- // True in the future
377
- $this->assertTrue(Carbon::now()->addWeek()->previous(Carbon::SATURDAY)->isSaturday());
378
- $this->assertTrue(Carbon::now()->addMonth()->previous(Carbon::SATURDAY)->isSaturday());
379
-
380
- // False in the past
381
- $this->assertFalse(Carbon::now()->subWeek()->previous(Carbon::SUNDAY)->isSaturday());
382
- $this->assertFalse(Carbon::now()->subMonth()->previous(Carbon::SUNDAY)->isSaturday());
383
-
384
- // False in the future
385
- $this->assertFalse(Carbon::now()->addWeek()->previous(Carbon::SUNDAY)->isSaturday());
386
- $this->assertFalse(Carbon::now()->addMonth()->previous(Carbon::SUNDAY)->isSaturday());
387
- }
388
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/IssetTest.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class IssetTest extends AbstractTestCase
18
- {
19
- public function testIssetReturnFalseForUnknownProperty()
20
- {
21
- $this->assertFalse(isset(Carbon::create(1234, 5, 6, 7, 8, 9)->sdfsdfss));
22
- }
23
-
24
- public function providerTestIssetReturnTrueForProperties()
25
- {
26
- return array(
27
- array('age'),
28
- array('day'),
29
- array('dayOfWeek'),
30
- array('dayOfYear'),
31
- array('daysInMonth'),
32
- array('dst'),
33
- array('hour'),
34
- array('local'),
35
- array('micro'),
36
- array('minute'),
37
- array('month'),
38
- array('offset'),
39
- array('offsetHours'),
40
- array('quarter'),
41
- array('second'),
42
- array('timestamp'),
43
- array('timezone'),
44
- array('timezoneName'),
45
- array('tz'),
46
- array('tzName'),
47
- array('utc'),
48
- array('weekOfMonth'),
49
- array('weekOfYear'),
50
- array('year'),
51
- );
52
- }
53
-
54
- /**
55
- * @dataProvider \Tests\Carbon\IssetTest::providerTestIssetReturnTrueForProperties
56
- *
57
- * @param string $property
58
- */
59
- public function testIssetReturnTrueForProperties($property)
60
- {
61
- $this->assertTrue(isset(Carbon::now()->$property));
62
- }
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/LocalizationTest.php DELETED
@@ -1,164 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Symfony\Component\Translation\Loader\ArrayLoader;
16
- use Symfony\Component\Translation\Translator;
17
- use Tests\AbstractTestCase;
18
-
19
- class LocalizationTest extends AbstractTestCase
20
- {
21
- public function testGetTranslator()
22
- {
23
- $t = Carbon::getTranslator();
24
- $this->assertNotNull($t);
25
- $this->assertSame('en', $t->getLocale());
26
- }
27
-
28
- /**
29
- * @see \Tests\Carbon\LocalizationTest::testSetLocale
30
- * @see \Tests\Carbon\LocalizationTest::testSetTranslator
31
- *
32
- * @return array
33
- */
34
- public function providerLocales()
35
- {
36
- return array(
37
- array('af'),
38
- array('ar'),
39
- array('az'),
40
- array('bg'),
41
- array('bn'),
42
- array('ca'),
43
- array('cs'),
44
- array('da'),
45
- array('de'),
46
- array('el'),
47
- array('en'),
48
- array('eo'),
49
- array('es'),
50
- array('et'),
51
- array('eu'),
52
- array('fa'),
53
- array('fi'),
54
- array('fo'),
55
- array('fr'),
56
- array('gl'),
57
- array('he'),
58
- array('hr'),
59
- array('hu'),
60
- array('hy'),
61
- array('id'),
62
- array('it'),
63
- array('ja'),
64
- array('ka'),
65
- array('km'),
66
- array('ko'),
67
- array('lt'),
68
- array('lv'),
69
- array('mk'),
70
- array('ms'),
71
- array('nl'),
72
- array('no'),
73
- array('pl'),
74
- array('pt'),
75
- array('pt_BR'),
76
- array('ro'),
77
- array('ru'),
78
- array('sk'),
79
- array('sl'),
80
- array('sq'),
81
- array('sr'),
82
- array('sv'),
83
- array('th'),
84
- array('tr'),
85
- array('uk'),
86
- array('ur'),
87
- array('uz'),
88
- array('vi'),
89
- array('zh'),
90
- array('zh_TW'),
91
- );
92
- }
93
-
94
- /**
95
- * @dataProvider \Tests\Carbon\LocalizationTest::providerLocales
96
- *
97
- * @param string $locale
98
- */
99
- public function testSetLocale($locale)
100
- {
101
- $this->assertTrue(Carbon::setLocale($locale));
102
- $this->assertSame($locale, Carbon::getLocale());
103
- }
104
-
105
- /**
106
- * @dataProvider \Tests\Carbon\LocalizationTest::providerLocales
107
- *
108
- * @param string $locale
109
- */
110
- public function testSetTranslator($locale)
111
- {
112
- $t = new Translator($locale);
113
- $t->addLoader('array', new ArrayLoader());
114
- Carbon::setTranslator($t);
115
-
116
- $t = Carbon::getTranslator();
117
- $this->assertNotNull($t);
118
- $this->assertSame($locale, $t->getLocale());
119
- }
120
-
121
- public function testSetLocaleWithKnownLocale()
122
- {
123
- $this->assertTrue(Carbon::setLocale('fr'));
124
- }
125
-
126
- /**
127
- * @see \Tests\Carbon\LocalizationTest::testSetLocaleWithMalformedLocale
128
- *
129
- * @return array
130
- */
131
- public function dataProviderTestSetLocaleWithMalformedLocale()
132
- {
133
- return array(
134
- array('DE'),
135
- array('pt-BR'),
136
- array('pt-br'),
137
- array('PT-br'),
138
- array('PT-BR'),
139
- array('pt_br'),
140
- array('PT_br'),
141
- array('PT_BR'),
142
- );
143
- }
144
-
145
- /**
146
- * @dataProvider \Tests\Carbon\LocalizationTest::dataProviderTestSetLocaleWithMalformedLocale
147
- *
148
- * @param string $malformedLocale
149
- */
150
- public function testSetLocaleWithMalformedLocale($malformedLocale)
151
- {
152
- $this->assertTrue(Carbon::setLocale($malformedLocale));
153
- }
154
-
155
- public function testSetLocaleWithNonExistingLocale()
156
- {
157
- $this->assertFalse(Carbon::setLocale('pt-XX'));
158
- }
159
-
160
- public function testSetLocaleWithUnknownLocale()
161
- {
162
- $this->assertFalse(Carbon::setLocale('zz'));
163
- }
164
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/ModifyTest.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class ModifyTest extends AbstractTestCase
18
- {
19
- public function testSimpleModify()
20
- {
21
- $a = new Carbon('2014-03-30 00:00:00');
22
- $b = $a->copy();
23
- $b->addHours(24);
24
- $this->assertSame(24, $a->diffInHours($b));
25
- }
26
-
27
- public function testTimezoneModify()
28
- {
29
- $a = new Carbon('2014-03-30 00:00:00', 'Europe/London');
30
- $b = $a->copy();
31
- $b->addHours(24);
32
- $this->assertSame(24, $a->diffInHours($b));
33
- }
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/NowAndOtherStaticHelpersTest.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTime;
16
- use DateTimeZone;
17
- use Tests\AbstractTestCase;
18
-
19
- class NowAndOtherStaticHelpersTest extends AbstractTestCase
20
- {
21
- public function testNow()
22
- {
23
- $dt = Carbon::now();
24
- $this->assertSame(time(), $dt->timestamp);
25
- }
26
-
27
- public function testNowWithTimezone()
28
- {
29
- $dt = Carbon::now('Europe/London');
30
- $this->assertSame(time(), $dt->timestamp);
31
- $this->assertSame('Europe/London', $dt->tzName);
32
- }
33
-
34
- public function testToday()
35
- {
36
- $dt = Carbon::today();
37
- $this->assertSame(date('Y-m-d 00:00:00'), $dt->toDateTimeString());
38
- }
39
-
40
- public function testTodayWithTimezone()
41
- {
42
- $dt = Carbon::today('Europe/London');
43
- $dt2 = new DateTime('now', new DateTimeZone('Europe/London'));
44
- $this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
45
- }
46
-
47
- public function testTomorrow()
48
- {
49
- $dt = Carbon::tomorrow();
50
- $dt2 = new DateTime('tomorrow');
51
- $this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
52
- }
53
-
54
- public function testTomorrowWithTimezone()
55
- {
56
- $dt = Carbon::tomorrow('Europe/London');
57
- $dt2 = new DateTime('tomorrow', new DateTimeZone('Europe/London'));
58
- $this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
59
- }
60
-
61
- public function testYesterday()
62
- {
63
- $dt = Carbon::yesterday();
64
- $dt2 = new DateTime('yesterday');
65
- $this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
66
- }
67
-
68
- public function testYesterdayWithTimezone()
69
- {
70
- $dt = Carbon::yesterday('Europe/London');
71
- $dt2 = new DateTime('yesterday', new DateTimeZone('Europe/London'));
72
- $this->assertSame($dt2->format('Y-m-d 00:00:00'), $dt->toDateTimeString());
73
- }
74
-
75
- public function testMinValue()
76
- {
77
- $this->assertLessThanOrEqual(-2147483647, Carbon::minValue()->getTimestamp());
78
- }
79
-
80
- public function testMaxValue()
81
- {
82
- $this->assertGreaterThanOrEqual(2147483647, Carbon::maxValue()->getTimestamp());
83
- }
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/RelativeTest.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class RelativeTest extends AbstractTestCase
18
- {
19
- public function testSecondsSinceMidnight()
20
- {
21
- $d = Carbon::today()->addSeconds(30);
22
- $this->assertSame(30, $d->secondsSinceMidnight());
23
-
24
- $d = Carbon::today()->addDays(1);
25
- $this->assertSame(0, $d->secondsSinceMidnight());
26
-
27
- $d = Carbon::today()->addDays(1)->addSeconds(120);
28
- $this->assertSame(120, $d->secondsSinceMidnight());
29
-
30
- $d = Carbon::today()->addMonths(3)->addSeconds(42);
31
- $this->assertSame(42, $d->secondsSinceMidnight());
32
- }
33
-
34
- public function testSecondsUntilEndOfDay()
35
- {
36
- $d = Carbon::today()->endOfDay();
37
- $this->assertSame(0, $d->secondsUntilEndOfDay());
38
-
39
- $d = Carbon::today()->endOfDay()->subSeconds(60);
40
- $this->assertSame(60, $d->secondsUntilEndOfDay());
41
-
42
- $d = Carbon::create(2014, 10, 24, 12, 34, 56);
43
- $this->assertSame(41103, $d->secondsUntilEndOfDay());
44
-
45
- $d = Carbon::create(2014, 10, 24, 0, 0, 0);
46
- $this->assertSame(86399, $d->secondsUntilEndOfDay());
47
- }
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/SerializationTest.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class SerializationTest extends AbstractTestCase
18
- {
19
- /**
20
- * @var string
21
- */
22
- protected $serialized;
23
-
24
- public function setUp()
25
- {
26
- parent::setUp();
27
-
28
- if (version_compare(PHP_VERSION, '5.4.0', '<')) {
29
- $this->serialized = 'O:13:"Carbon\Carbon":3:{s:4:"date";s:19:"2016-02-01 13:20:25";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"America/Toronto";}';
30
- } else {
31
- $this->serialized = 'O:13:"Carbon\Carbon":3:{s:4:"date";s:26:"2016-02-01 13:20:25.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:15:"America/Toronto";}';
32
- }
33
- }
34
-
35
- public function testSerialize()
36
- {
37
- $dt = Carbon::create(2016, 2, 1, 13, 20, 25);
38
- $this->assertSame($this->serialized, $dt->serialize());
39
- }
40
-
41
- public function testFromUnserialized()
42
- {
43
- $dt = Carbon::fromSerialized($this->serialized);
44
- $this->assertCarbon($dt, 2016, 2, 1, 13, 20, 25);
45
- }
46
-
47
- public function providerTestFromUnserializedWithInvalidValue()
48
- {
49
- return array(
50
- array(null),
51
- array(true),
52
- array(false),
53
- array(123),
54
- array('foobar'),
55
- );
56
- }
57
-
58
- /**
59
- * @param mixed $value
60
- *
61
- * @expectedException \InvalidArgumentException
62
- * @expectedExceptionMessage Invalid serialized value.
63
- * @dataProvider \Tests\Carbon\SerializationTest::providerTestFromUnserializedWithInvalidValue
64
- */
65
- public function testFromUnserializedWithInvalidValue($value)
66
- {
67
- Carbon::fromSerialized($value);
68
- }
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/SettersTest.php DELETED
@@ -1,305 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTimeZone;
16
- use Tests\AbstractTestCase;
17
-
18
- class SettersTest extends AbstractTestCase
19
- {
20
- public function testYearSetter()
21
- {
22
- $d = Carbon::now();
23
- $d->year = 1995;
24
- $this->assertSame(1995, $d->year);
25
- }
26
-
27
- public function testMonthSetter()
28
- {
29
- $d = Carbon::now();
30
- $d->month = 3;
31
- $this->assertSame(3, $d->month);
32
- }
33
-
34
- public function testMonthSetterWithWrap()
35
- {
36
- $d = Carbon::now();
37
- $d->month = 13;
38
- $this->assertSame(1, $d->month);
39
- }
40
-
41
- public function testDaySetter()
42
- {
43
- $d = Carbon::now();
44
- $d->day = 2;
45
- $this->assertSame(2, $d->day);
46
- }
47
-
48
- public function testDaySetterWithWrap()
49
- {
50
- $d = Carbon::createFromDate(2012, 8, 5);
51
- $d->day = 32;
52
- $this->assertSame(1, $d->day);
53
- }
54
-
55
- public function testHourSetter()
56
- {
57
- $d = Carbon::now();
58
- $d->hour = 2;
59
- $this->assertSame(2, $d->hour);
60
- }
61
-
62
- public function testHourSetterWithWrap()
63
- {
64
- $d = Carbon::now();
65
- $d->hour = 25;
66
- $this->assertSame(1, $d->hour);
67
- }
68
-
69
- public function testMinuteSetter()
70
- {
71
- $d = Carbon::now();
72
- $d->minute = 2;
73
- $this->assertSame(2, $d->minute);
74
- }
75
-
76
- public function testMinuteSetterWithWrap()
77
- {
78
- $d = Carbon::now();
79
- $d->minute = 65;
80
- $this->assertSame(5, $d->minute);
81
- }
82
-
83
- public function testSecondSetter()
84
- {
85
- $d = Carbon::now();
86
- $d->second = 2;
87
- $this->assertSame(2, $d->second);
88
- }
89
-
90
- public function testTimeSetter()
91
- {
92
- $d = Carbon::now();
93
- $d->setTime(1, 1, 1);
94
- $this->assertSame(1, $d->second);
95
- $d->setTime(1, 1);
96
- $this->assertSame(0, $d->second);
97
- }
98
-
99
- public function testTimeSetterWithChaining()
100
- {
101
- $d = Carbon::now();
102
- $d->setTime(2, 2, 2)->setTime(1, 1, 1);
103
- $this->assertInstanceOfCarbon($d);
104
- $this->assertSame(1, $d->second);
105
- $d->setTime(2, 2, 2)->setTime(1, 1);
106
- $this->assertInstanceOfCarbon($d);
107
- $this->assertSame(0, $d->second);
108
- }
109
-
110
- public function testTimeSetterWithZero()
111
- {
112
- $d = Carbon::now();
113
- $d->setTime(1, 1);
114
- $this->assertSame(0, $d->second);
115
- }
116
-
117
- public function testDateTimeSetter()
118
- {
119
- $d = Carbon::now();
120
- $d->setDateTime($d->year, $d->month, $d->day, 1, 1, 1);
121
- $this->assertSame(1, $d->second);
122
- }
123
-
124
- public function testDateTimeSetterWithZero()
125
- {
126
- $d = Carbon::now();
127
- $d->setDateTime($d->year, $d->month, $d->day, 1, 1);
128
- $this->assertSame(0, $d->second);
129
- }
130
-
131
- public function testDateTimeSetterWithChaining()
132
- {
133
- $d = Carbon::now();
134
- $d->setDateTime(2013, 9, 24, 17, 4, 29);
135
- $this->assertInstanceOfCarbon($d);
136
- $d->setDateTime(2014, 10, 25, 18, 5, 30);
137
- $this->assertInstanceOfCarbon($d);
138
- $this->assertCarbon($d, 2014, 10, 25, 18, 5, 30);
139
- }
140
-
141
- /**
142
- * @link https://github.com/briannesbitt/Carbon/issues/539
143
- */
144
- public function testSetDateAfterStringCreation()
145
- {
146
- $d = new Carbon('first day of this month');
147
- $this->assertSame(1, $d->day);
148
- $d->setDate($d->year, $d->month, 12);
149
- $this->assertSame(12, $d->day);
150
- }
151
-
152
- public function testSecondSetterWithWrap()
153
- {
154
- $d = Carbon::now();
155
- $d->second = 65;
156
- $this->assertSame(5, $d->second);
157
- }
158
-
159
- public function testTimestampSetter()
160
- {
161
- $d = Carbon::now();
162
- $d->timestamp = 10;
163
- $this->assertSame(10, $d->timestamp);
164
-
165
- $d->setTimestamp(11);
166
- $this->assertSame(11, $d->timestamp);
167
- }
168
-
169
- /**
170
- * @expectedException \InvalidArgumentException
171
- */
172
- public function testSetTimezoneWithInvalidTimezone()
173
- {
174
- $d = Carbon::now();
175
- $d->setTimezone('sdf');
176
- }
177
-
178
- /**
179
- * @expectedException \InvalidArgumentException
180
- * @expectedExceptionMessage Unknown or bad timezone (sdf)
181
- */
182
- public function testTimezoneWithInvalidTimezone()
183
- {
184
- $d = Carbon::now();
185
- $d->timezone = 'sdf';
186
- }
187
-
188
- /**
189
- * @expectedException \InvalidArgumentException
190
- * @expectedExceptionMessage Unknown or bad timezone (sdf)
191
- */
192
- public function testTimezoneWithInvalidTimezoneSetter()
193
- {
194
- $d = Carbon::now();
195
- $d->timezone('sdf');
196
- }
197
-
198
- /**
199
- * @expectedException \InvalidArgumentException
200
- * @expectedExceptionMessage Unknown or bad timezone (sdf)
201
- */
202
- public function testTzWithInvalidTimezone()
203
- {
204
- $d = Carbon::now();
205
- $d->tz = 'sdf';
206
- }
207
-
208
- /**
209
- * @expectedException \InvalidArgumentException
210
- * @expectedExceptionMessage Unknown or bad timezone (sdf)
211
- */
212
- public function testTzWithInvalidTimezoneSetter()
213
- {
214
- $d = Carbon::now();
215
- $d->tz('sdf');
216
- }
217
-
218
- public function testSetTimezoneUsingString()
219
- {
220
- $d = Carbon::now();
221
- $d->setTimezone('America/Toronto');
222
- $this->assertSame('America/Toronto', $d->tzName);
223
- }
224
-
225
- public function testTimezoneUsingString()
226
- {
227
- $d = Carbon::now();
228
- $d->timezone = 'America/Toronto';
229
- $this->assertSame('America/Toronto', $d->tzName);
230
-
231
- $d->timezone('America/Vancouver');
232
- $this->assertSame('America/Vancouver', $d->tzName);
233
- }
234
-
235
- public function testTzUsingString()
236
- {
237
- $d = Carbon::now();
238
- $d->tz = 'America/Toronto';
239
- $this->assertSame('America/Toronto', $d->tzName);
240
-
241
- $d->tz('America/Vancouver');
242
- $this->assertSame('America/Vancouver', $d->tzName);
243
- }
244
-
245
- public function testSetTimezoneUsingDateTimeZone()
246
- {
247
- $d = Carbon::now();
248
- $d->setTimezone(new DateTimeZone('America/Toronto'));
249
- $this->assertSame('America/Toronto', $d->tzName);
250
- }
251
-
252
- public function testTimezoneUsingDateTimeZone()
253
- {
254
- $d = Carbon::now();
255
- $d->timezone = new DateTimeZone('America/Toronto');
256
- $this->assertSame('America/Toronto', $d->tzName);
257
-
258
- $d->timezone(new DateTimeZone('America/Vancouver'));
259
- $this->assertSame('America/Vancouver', $d->tzName);
260
- }
261
-
262
- public function testTzUsingDateTimeZone()
263
- {
264
- $d = Carbon::now();
265
- $d->tz = new DateTimeZone('America/Toronto');
266
- $this->assertSame('America/Toronto', $d->tzName);
267
-
268
- $d->tz(new DateTimeZone('America/Vancouver'));
269
- $this->assertSame('America/Vancouver', $d->tzName);
270
- }
271
-
272
- /**
273
- * @expectedException \InvalidArgumentException
274
- */
275
- public function testInvalidSetter()
276
- {
277
- $d = Carbon::now();
278
- $d->doesNotExit = 'bb';
279
- }
280
-
281
- /**
282
- * @dataProvider \Tests\Carbon\SettersTest::dataProviderTestSetTimeFromTimeString
283
- *
284
- * @param int $hour
285
- * @param int $minute
286
- * @param int $second
287
- * @param string $time
288
- */
289
- public function testSetTimeFromTimeString($hour, $minute, $second, $time)
290
- {
291
- Carbon::setTestNow(Carbon::create(2016, 2, 12, 1, 2, 3));
292
- $d = Carbon::now()->setTimeFromTimeString($time);
293
- $this->assertCarbon($d, 2016, 2, 12, $hour, $minute, $second);
294
- Carbon::setTestNow();
295
- }
296
-
297
- public function dataProviderTestSetTimeFromTimeString()
298
- {
299
- return array(
300
- array(9, 15, 30, '09:15:30'),
301
- array(9, 15, 0, '09:15'),
302
- array(9, 0, 0, '09'),
303
- );
304
- }
305
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/StartEndOfTest.php DELETED
@@ -1,314 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class StartEndOfTest extends AbstractTestCase
18
- {
19
- public function testStartOfDay()
20
- {
21
- $dt = Carbon::now();
22
- $this->assertInstanceOfCarbon($dt->startOfDay());
23
- $this->assertCarbon($dt, $dt->year, $dt->month, $dt->day, 0, 0, 0);
24
- }
25
-
26
- public function testEndOfDay()
27
- {
28
- $dt = Carbon::now();
29
- $this->assertInstanceOfCarbon($dt->endOfDay());
30
- $this->assertCarbon($dt, $dt->year, $dt->month, $dt->day, 23, 59, 59);
31
- }
32
-
33
- public function testStartOfMonthIsFluid()
34
- {
35
- $dt = Carbon::now();
36
- $this->assertInstanceOfCarbon($dt->startOfMonth());
37
- }
38
-
39
- public function testStartOfMonthFromNow()
40
- {
41
- $dt = Carbon::now()->startOfMonth();
42
- $this->assertCarbon($dt, $dt->year, $dt->month, 1, 0, 0, 0);
43
- }
44
-
45
- public function testStartOfMonthFromLastDay()
46
- {
47
- $dt = Carbon::create(2000, 1, 31, 2, 3, 4)->startOfMonth();
48
- $this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
49
- }
50
-
51
- public function testStartOfYearIsFluid()
52
- {
53
- $dt = Carbon::now();
54
- $this->assertInstanceOfCarbon($dt->startOfYear());
55
- }
56
-
57
- public function testStartOfYearFromNow()
58
- {
59
- $dt = Carbon::now()->startOfYear();
60
- $this->assertCarbon($dt, $dt->year, 1, 1, 0, 0, 0);
61
- }
62
-
63
- public function testStartOfYearFromFirstDay()
64
- {
65
- $dt = Carbon::create(2000, 1, 1, 1, 1, 1)->startOfYear();
66
- $this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
67
- }
68
-
69
- public function testStartOfYearFromLastDay()
70
- {
71
- $dt = Carbon::create(2000, 12, 31, 23, 59, 59)->startOfYear();
72
- $this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
73
- }
74
-
75
- public function testEndOfMonthIsFluid()
76
- {
77
- $dt = Carbon::now();
78
- $this->assertInstanceOfCarbon($dt->endOfMonth());
79
- }
80
-
81
- public function testEndOfMonth()
82
- {
83
- $dt = Carbon::create(2000, 1, 1, 2, 3, 4)->endOfMonth();
84
- $this->assertCarbon($dt, 2000, 1, 31, 23, 59, 59);
85
- }
86
-
87
- public function testEndOfMonthFromLastDay()
88
- {
89
- $dt = Carbon::create(2000, 1, 31, 2, 3, 4)->endOfMonth();
90
- $this->assertCarbon($dt, 2000, 1, 31, 23, 59, 59);
91
- }
92
-
93
- public function testEndOfYearIsFluid()
94
- {
95
- $dt = Carbon::now();
96
- $this->assertInstanceOfCarbon($dt->endOfYear());
97
- }
98
-
99
- public function testEndOfYearFromNow()
100
- {
101
- $dt = Carbon::now()->endOfYear();
102
- $this->assertCarbon($dt, $dt->year, 12, 31, 23, 59, 59);
103
- }
104
-
105
- public function testEndOfYearFromFirstDay()
106
- {
107
- $dt = Carbon::create(2000, 1, 1, 1, 1, 1)->endOfYear();
108
- $this->assertCarbon($dt, 2000, 12, 31, 23, 59, 59);
109
- }
110
-
111
- public function testEndOfYearFromLastDay()
112
- {
113
- $dt = Carbon::create(2000, 12, 31, 23, 59, 59)->endOfYear();
114
- $this->assertCarbon($dt, 2000, 12, 31, 23, 59, 59);
115
- }
116
-
117
- public function testStartOfDecadeIsFluid()
118
- {
119
- $dt = Carbon::now();
120
- $this->assertInstanceOfCarbon($dt->startOfDecade());
121
- }
122
-
123
- public function testStartOfDecadeFromNow()
124
- {
125
- $dt = Carbon::now()->startOfDecade();
126
- $this->assertCarbon($dt, $dt->year - $dt->year % 10, 1, 1, 0, 0, 0);
127
- }
128
-
129
- public function testStartOfDecadeFromFirstDay()
130
- {
131
- $dt = Carbon::create(2000, 1, 1, 1, 1, 1)->startOfDecade();
132
- $this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
133
- }
134
-
135
- public function testStartOfDecadeFromLastDay()
136
- {
137
- $dt = Carbon::create(2009, 12, 31, 23, 59, 59)->startOfDecade();
138
- $this->assertCarbon($dt, 2000, 1, 1, 0, 0, 0);
139
- }
140
-
141
- public function testEndOfDecadeIsFluid()
142
- {
143
- $dt = Carbon::now();
144
- $this->assertInstanceOfCarbon($dt->endOfDecade());
145
- }
146
-
147
- public function testEndOfDecadeFromNow()
148
- {
149
- $dt = Carbon::now()->endOfDecade();
150
- $this->assertCarbon($dt, $dt->year - $dt->year % 10 + 9, 12, 31, 23, 59, 59);
151
- }
152
-
153
- public function testEndOfDecadeFromFirstDay()
154
- {
155
- $dt = Carbon::create(2000, 1, 1, 1, 1, 1)->endOfDecade();
156
- $this->assertCarbon($dt, 2009, 12, 31, 23, 59, 59);
157
- }
158
-
159
- public function testEndOfDecadeFromLastDay()
160
- {
161
- $dt = Carbon::create(2009, 12, 31, 23, 59, 59)->endOfDecade();
162
- $this->assertCarbon($dt, 2009, 12, 31, 23, 59, 59);
163
- }
164
-
165
- public function testStartOfCenturyIsFluid()
166
- {
167
- $dt = Carbon::now();
168
- $this->assertInstanceOfCarbon($dt->startOfCentury());
169
- }
170
-
171
- public function testStartOfCenturyFromNow()
172
- {
173
- $now = Carbon::now();
174
- $dt = Carbon::now()->startOfCentury();
175
- $this->assertCarbon($dt, $now->year - $now->year % 100 + 1, 1, 1, 0, 0, 0);
176
- }
177
-
178
- public function testStartOfCenturyFromFirstDay()
179
- {
180
- $dt = Carbon::create(2001, 1, 1, 1, 1, 1)->startOfCentury();
181
- $this->assertCarbon($dt, 2001, 1, 1, 0, 0, 0);
182
- }
183
-
184
- public function testStartOfCenturyFromLastDay()
185
- {
186
- $dt = Carbon::create(2100, 12, 31, 23, 59, 59)->startOfCentury();
187
- $this->assertCarbon($dt, 2001, 1, 1, 0, 0, 0);
188
- }
189
-
190
- public function testEndOfCenturyIsFluid()
191
- {
192
- $dt = Carbon::now();
193
- $this->assertInstanceOfCarbon($dt->endOfCentury());
194
- }
195
-
196
- public function testEndOfCenturyFromNow()
197
- {
198
- $now = Carbon::now();
199
- $dt = Carbon::now()->endOfCentury();
200
- $this->assertCarbon($dt, $now->year - $now->year % 100 + 100, 12, 31, 23, 59, 59);
201
- }
202
-
203
- public function testEndOfCenturyFromFirstDay()
204
- {
205
- $dt = Carbon::create(2001, 1, 1, 1, 1, 1)->endOfCentury();
206
- $this->assertCarbon($dt, 2100, 12, 31, 23, 59, 59);
207
- }
208
-
209
- public function testEndOfCenturyFromLastDay()
210
- {
211
- $dt = Carbon::create(2100, 12, 31, 23, 59, 59)->endOfCentury();
212
- $this->assertCarbon($dt, 2100, 12, 31, 23, 59, 59);
213
- }
214
-
215
- public function testStartOfQuarterIsFluid()
216
- {
217
- $dt = Carbon::now();
218
- $this->assertInstanceOfCarbon($dt->startOfQuarter());
219
- }
220
-
221
- public function dataProviderTestStartOfQuarter()
222
- {
223
- return array(
224
- array(1, 1),
225
- array(2, 1),
226
- array(3, 1),
227
- array(4, 4),
228
- array(5, 4),
229
- array(6, 4),
230
- array(7, 7),
231
- array(8, 7),
232
- array(9, 7),
233
- array(10, 10),
234
- array(11, 10),
235
- array(12, 10),
236
- );
237
- }
238
-
239
- /**
240
- * @dataProvider \Tests\Carbon\StartEndOfTest::dataProviderTestStartOfQuarter
241
- *
242
- * @param int $month
243
- * @param int $startOfQuarterMonth
244
- */
245
- public function testStartOfQuarter($month, $startOfQuarterMonth)
246
- {
247
- $dt = Carbon::create(2015, $month, 15, 1, 2, 3);
248
- $this->assertCarbon($dt->startOfQuarter(), 2015, $startOfQuarterMonth, 1, 0, 0, 0);
249
- }
250
-
251
- public function testEndOfQuarterIsFluid()
252
- {
253
- $dt = Carbon::now();
254
- $this->assertInstanceOfCarbon($dt->endOfQuarter());
255
- }
256
-
257
- public function dataProviderTestEndOfQuarter()
258
- {
259
- return array(
260
- array(1, 3, 31),
261
- array(2, 3, 31),
262
- array(3, 3, 31),
263
- array(4, 6, 30),
264
- array(5, 6, 30),
265
- array(6, 6, 30),
266
- array(7, 9, 30),
267
- array(8, 9, 30),
268
- array(9, 9, 30),
269
- array(10, 12, 31),
270
- array(11, 12, 31),
271
- array(12, 12, 31),
272
- );
273
- }
274
-
275
- /**
276
- * @dataProvider \Tests\Carbon\StartEndOfTest::dataProviderTestEndOfQuarter
277
- *
278
- * @param int $month
279
- * @param int $endOfQuarterMonth
280
- * @param int $endOfQuarterDay
281
- */
282
- public function testEndOfQuarter($month, $endOfQuarterMonth, $endOfQuarterDay)
283
- {
284
- $dt = Carbon::create(2015, $month, 15, 1, 2, 3);
285
- $this->assertCarbon($dt->endOfQuarter(), 2015, $endOfQuarterMonth, $endOfQuarterDay, 23, 59, 59);
286
- }
287
-
288
- public function testAverageIsFluid()
289
- {
290
- $dt = Carbon::now()->average();
291
- $this->assertInstanceOfCarbon($dt);
292
- }
293
-
294
- public function testAverageFromSame()
295
- {
296
- $dt1 = Carbon::create(2000, 1, 31, 2, 3, 4);
297
- $dt2 = Carbon::create(2000, 1, 31, 2, 3, 4)->average($dt1);
298
- $this->assertCarbon($dt2, 2000, 1, 31, 2, 3, 4);
299
- }
300
-
301
- public function testAverageFromGreater()
302
- {
303
- $dt1 = Carbon::create(2000, 1, 1, 1, 1, 1);
304
- $dt2 = Carbon::create(2009, 12, 31, 23, 59, 59)->average($dt1);
305
- $this->assertCarbon($dt2, 2004, 12, 31, 12, 30, 30);
306
- }
307
-
308
- public function testAverageFromLower()
309
- {
310
- $dt1 = Carbon::create(2009, 12, 31, 23, 59, 59);
311
- $dt2 = Carbon::create(2000, 1, 1, 1, 1, 1)->average($dt1);
312
- $this->assertCarbon($dt2, 2004, 12, 31, 12, 30, 30);
313
- }
314
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/StringsTest.php DELETED
@@ -1,191 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use DateTime;
16
- use Tests\AbstractTestCase;
17
- use Tests\Carbon\Fixtures\MyCarbon;
18
-
19
- class StringsTest extends AbstractTestCase
20
- {
21
- public function testToString()
22
- {
23
- $d = Carbon::now();
24
- $this->assertSame(Carbon::now()->toDateTimeString(), ''.$d);
25
- }
26
-
27
- public function testSetToStringFormat()
28
- {
29
- Carbon::setToStringFormat('jS \o\f F, Y g:i:s a');
30
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
31
- $this->assertSame('25th of December, 1975 2:15:16 pm', ''.$d);
32
- }
33
-
34
- public function testResetToStringFormat()
35
- {
36
- $d = Carbon::now();
37
- Carbon::setToStringFormat('123');
38
- Carbon::resetToStringFormat();
39
- $this->assertSame($d->toDateTimeString(), ''.$d);
40
- }
41
-
42
- public function testExtendedClassToString()
43
- {
44
- $d = MyCarbon::now();
45
- $this->assertSame($d->toDateTimeString(), ''.$d);
46
- }
47
-
48
- public function testToDateString()
49
- {
50
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
51
- $this->assertSame('1975-12-25', $d->toDateString());
52
- }
53
-
54
- public function testToFormattedDateString()
55
- {
56
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
57
- $this->assertSame('Dec 25, 1975', $d->toFormattedDateString());
58
- }
59
-
60
- public function testToLocalizedFormattedDateString()
61
- {
62
- /*
63
- * Working out a Travis issue on how to set a different locale
64
- * other than EN to test this.
65
- *
66
- * $cache = setlocale(LC_TIME, 0);
67
- * setlocale(LC_TIME, 'German');
68
- * $d = Carbon::create(1975, 12, 25, 14, 15, 16);
69
- * $this->assertSame('Donnerstag 25 Dezember 1975', $d->formatLocalized('%A %d %B %Y'));
70
- * setlocale(LC_TIME, $cache);
71
- */
72
- }
73
-
74
- public function testToLocalizedFormattedDateStringWhenUtf8IsNedded()
75
- {
76
- /*
77
- * Working out a Travis issue on how to set a different locale
78
- * other than EN to test this.
79
- *
80
- * Carbon::setUtf8(true);
81
- * $cache = setlocale(LC_TIME, 0);
82
- * $d = Carbon::create(2016, 01, 06, 00, 00, 00);
83
- * setlocale(LC_TIME, 'spanish');
84
- * $this->assertSame(utf8_encode('mi�rcoles 06 enero 2016'), $d->formatLocalized('%A %d %B %Y'));
85
- * setlocale(LC_TIME, $cache);
86
- * Carbon::setUtf8(false);
87
- */
88
- }
89
-
90
- public function testToLocalizedFormattedTimezonedDateString()
91
- {
92
- $d = Carbon::create(1975, 12, 25, 14, 15, 16, 'Europe/London');
93
- $this->assertSame('Thursday 25 December 1975 14:15', $d->formatLocalized('%A %d %B %Y %H:%M'));
94
- }
95
-
96
- public function testToTimeString()
97
- {
98
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
99
- $this->assertSame('14:15:16', $d->toTimeString());
100
- }
101
-
102
- public function testToDateTimeString()
103
- {
104
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
105
- $this->assertSame('1975-12-25 14:15:16', $d->toDateTimeString());
106
- }
107
-
108
- public function testToDateTimeStringWithPaddedZeroes()
109
- {
110
- $d = Carbon::create(2000, 5, 2, 4, 3, 4);
111
- $this->assertSame('2000-05-02 04:03:04', $d->toDateTimeString());
112
- }
113
-
114
- public function testToDayDateTimeString()
115
- {
116
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
117
- $this->assertSame('Thu, Dec 25, 1975 2:15 PM', $d->toDayDateTimeString());
118
- }
119
-
120
- public function testToAtomString()
121
- {
122
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
123
- $this->assertSame('1975-12-25T14:15:16-05:00', $d->toAtomString());
124
- }
125
-
126
- public function testToCOOKIEString()
127
- {
128
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
129
- if (DateTime::COOKIE === 'l, d-M-y H:i:s T') {
130
- $cookieString = 'Thursday, 25-Dec-75 14:15:16 EST';
131
- } else {
132
- $cookieString = 'Thursday, 25-Dec-1975 14:15:16 EST';
133
- }
134
-
135
- $this->assertSame($cookieString, $d->toCOOKIEString());
136
- }
137
-
138
- public function testToIso8601String()
139
- {
140
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
141
- $this->assertSame('1975-12-25T14:15:16-05:00', $d->toIso8601String());
142
- }
143
-
144
- public function testToRC822String()
145
- {
146
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
147
- $this->assertSame('Thu, 25 Dec 75 14:15:16 -0500', $d->toRfc822String());
148
- }
149
-
150
- public function testToRfc850String()
151
- {
152
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
153
- $this->assertSame('Thursday, 25-Dec-75 14:15:16 EST', $d->toRfc850String());
154
- }
155
-
156
- public function testToRfc1036String()
157
- {
158
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
159
- $this->assertSame('Thu, 25 Dec 75 14:15:16 -0500', $d->toRfc1036String());
160
- }
161
-
162
- public function testToRfc1123String()
163
- {
164
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
165
- $this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRfc1123String());
166
- }
167
-
168
- public function testToRfc2822String()
169
- {
170
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
171
- $this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRfc2822String());
172
- }
173
-
174
- public function testToRfc3339String()
175
- {
176
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
177
- $this->assertSame('1975-12-25T14:15:16-05:00', $d->toRfc3339String());
178
- }
179
-
180
- public function testToRssString()
181
- {
182
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
183
- $this->assertSame('Thu, 25 Dec 1975 14:15:16 -0500', $d->toRssString());
184
- }
185
-
186
- public function testToW3cString()
187
- {
188
- $d = Carbon::create(1975, 12, 25, 14, 15, 16);
189
- $this->assertSame('1975-12-25T14:15:16-05:00', $d->toW3cString());
190
- }
191
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/SubTest.php DELETED
@@ -1,223 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class SubTest extends AbstractTestCase
18
- {
19
- public function testSubYearsPositive()
20
- {
21
- $this->assertSame(1974, Carbon::createFromDate(1975)->subYears(1)->year);
22
- }
23
-
24
- public function testSubYearsZero()
25
- {
26
- $this->assertSame(1975, Carbon::createFromDate(1975)->subYears(0)->year);
27
- }
28
-
29
- public function testSubYearsNegative()
30
- {
31
- $this->assertSame(1976, Carbon::createFromDate(1975)->subYears(-1)->year);
32
- }
33
-
34
- public function testSubYear()
35
- {
36
- $this->assertSame(1974, Carbon::createFromDate(1975)->subYear()->year);
37
- }
38
-
39
- public function testSubMonthsPositive()
40
- {
41
- $this->assertSame(12, Carbon::createFromDate(1975, 1, 1)->subMonths(1)->month);
42
- }
43
-
44
- public function testSubMonthsZero()
45
- {
46
- $this->assertSame(1, Carbon::createFromDate(1975, 1, 1)->subMonths(0)->month);
47
- }
48
-
49
- public function testSubMonthsNegative()
50
- {
51
- $this->assertSame(2, Carbon::createFromDate(1975, 1, 1)->subMonths(-1)->month);
52
- }
53
-
54
- public function testSubMonth()
55
- {
56
- $this->assertSame(12, Carbon::createFromDate(1975, 1, 1)->subMonth()->month);
57
- }
58
-
59
- public function testSubDaysPositive()
60
- {
61
- $this->assertSame(30, Carbon::createFromDate(1975, 5, 1)->subDays(1)->day);
62
- }
63
-
64
- public function testSubDaysZero()
65
- {
66
- $this->assertSame(1, Carbon::createFromDate(1975, 5, 1)->subDays(0)->day);
67
- }
68
-
69
- public function testSubDaysNegative()
70
- {
71
- $this->assertSame(2, Carbon::createFromDate(1975, 5, 1)->subDays(-1)->day);
72
- }
73
-
74
- public function testSubDay()
75
- {
76
- $this->assertSame(30, Carbon::createFromDate(1975, 5, 1)->subDay()->day);
77
- }
78
-
79
- public function testSubWeekdaysPositive()
80
- {
81
- $this->assertSame(22, Carbon::createFromDate(2012, 1, 4)->subWeekdays(9)->day);
82
- }
83
-
84
- public function testSubWeekdaysZero()
85
- {
86
- $this->assertSame(4, Carbon::createFromDate(2012, 1, 4)->subWeekdays(0)->day);
87
- }
88
-
89
- public function testSubWeekdaysNegative()
90
- {
91
- $this->assertSame(13, Carbon::createFromDate(2012, 1, 31)->subWeekdays(-9)->day);
92
- }
93
-
94
- public function testSubWeekday()
95
- {
96
- $this->assertSame(6, Carbon::createFromDate(2012, 1, 9)->subWeekday()->day);
97
- }
98
-
99
- public function testSubWeekdayDuringWeekend()
100
- {
101
- $this->assertSame(6, Carbon::createFromDate(2012, 1, 8)->subWeekday()->day);
102
- }
103
-
104
- public function testSubWeeksPositive()
105
- {
106
- $this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->subWeeks(1)->day);
107
- }
108
-
109
- public function testSubWeeksZero()
110
- {
111
- $this->assertSame(21, Carbon::createFromDate(1975, 5, 21)->subWeeks(0)->day);
112
- }
113
-
114
- public function testSubWeeksNegative()
115
- {
116
- $this->assertSame(28, Carbon::createFromDate(1975, 5, 21)->subWeeks(-1)->day);
117
- }
118
-
119
- public function testSubWeek()
120
- {
121
- $this->assertSame(14, Carbon::createFromDate(1975, 5, 21)->subWeek()->day);
122
- }
123
-
124
- public function testSubHoursPositive()
125
- {
126
- $this->assertSame(23, Carbon::createFromTime(0)->subHours(1)->hour);
127
- }
128
-
129
- public function testSubHoursZero()
130
- {
131
- $this->assertSame(0, Carbon::createFromTime(0)->subHours(0)->hour);
132
- }
133
-
134
- public function testSubHoursNegative()
135
- {
136
- $this->assertSame(1, Carbon::createFromTime(0)->subHours(-1)->hour);
137
- }
138
-
139
- public function testSubHour()
140
- {
141
- $this->assertSame(23, Carbon::createFromTime(0)->subHour()->hour);
142
- }
143
-
144
- public function testSubMinutesPositive()
145
- {
146
- $this->assertSame(59, Carbon::createFromTime(0, 0)->subMinutes(1)->minute);
147
- }
148
-
149
- public function testSubMinutesZero()
150
- {
151
- $this->assertSame(0, Carbon::createFromTime(0, 0)->subMinutes(0)->minute);
152
- }
153
-
154
- public function testSubMinutesNegative()
155
- {
156
- $this->assertSame(1, Carbon::createFromTime(0, 0)->subMinutes(-1)->minute);
157
- }
158
-
159
- public function testSubMinute()
160
- {
161
- $this->assertSame(59, Carbon::createFromTime(0, 0)->subMinute()->minute);
162
- }
163
-
164
- public function testSubSecondsPositive()
165
- {
166
- $this->assertSame(59, Carbon::createFromTime(0, 0, 0)->subSeconds(1)->second);
167
- }
168
-
169
- public function testSubSecondsZero()
170
- {
171
- $this->assertSame(0, Carbon::createFromTime(0, 0, 0)->subSeconds(0)->second);
172
- }
173
-
174
- public function testSubSecondsNegative()
175
- {
176
- $this->assertSame(1, Carbon::createFromTime(0, 0, 0)->subSeconds(-1)->second);
177
- }
178
-
179
- public function testSubSecond()
180
- {
181
- $this->assertSame(59, Carbon::createFromTime(0, 0, 0)->subSecond()->second);
182
- }
183
-
184
- /**
185
- * Test non plural methods with non default args.
186
- */
187
- public function testSubYearPassingArg()
188
- {
189
- $this->assertSame(1973, Carbon::createFromDate(1975)->subYear(2)->year);
190
- }
191
-
192
- public function testSubMonthPassingArg()
193
- {
194
- $this->assertSame(3, Carbon::createFromDate(1975, 5, 1)->subMonth(2)->month);
195
- }
196
-
197
- public function testSubMonthNoOverflowPassingArg()
198
- {
199
- $dt = Carbon::createFromDate(2011, 4, 30)->subMonthNoOverflow(2);
200
- $this->assertSame(2, $dt->month);
201
- $this->assertSame(28, $dt->day);
202
- }
203
-
204
- public function testSubDayPassingArg()
205
- {
206
- $this->assertSame(8, Carbon::createFromDate(1975, 5, 10)->subDay(2)->day);
207
- }
208
-
209
- public function testSubHourPassingArg()
210
- {
211
- $this->assertSame(22, Carbon::createFromTime(0)->subHour(2)->hour);
212
- }
213
-
214
- public function testSubMinutePassingArg()
215
- {
216
- $this->assertSame(58, Carbon::createFromTime(0)->subMinute(2)->minute);
217
- }
218
-
219
- public function testSubSecondPassingArg()
220
- {
221
- $this->assertSame(58, Carbon::createFromTime(0)->subSecond(2)->second);
222
- }
223
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Carbon/TestingAidsTest.php DELETED
@@ -1,142 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class TestingAidsTest extends AbstractTestCase
18
- {
19
- public function testTestingAidsWithTestNowNotSet()
20
- {
21
- Carbon::setTestNow();
22
-
23
- $this->assertFalse(Carbon::hasTestNow());
24
- $this->assertNull(Carbon::getTestNow());
25
- }
26
-
27
- public function testTestingAidsWithTestNowSet()
28
- {
29
- $testNow = Carbon::yesterday();
30
- Carbon::setTestNow($testNow);
31
-
32
- $this->assertTrue(Carbon::hasTestNow());
33
- $this->assertSame($testNow, Carbon::getTestNow());
34
- }
35
-
36
- public function testTestingAidsWithTestNowSetToString()
37
- {
38
- Carbon::setTestNow('2016-11-23');
39
- $this->assertTrue(Carbon::hasTestNow());
40
- $this->assertEquals(Carbon::getTestNow(), Carbon::parse('2016-11-23'));
41
- }
42
-
43
- public function testConstructorWithTestValueSet()
44
- {
45
- $testNow = Carbon::yesterday();
46
- Carbon::setTestNow($testNow);
47
-
48
- $this->assertEquals($testNow, new Carbon());
49
- $this->assertEquals($testNow, new Carbon(null));
50
- $this->assertEquals($testNow, new Carbon(''));
51
- $this->assertEquals($testNow, new Carbon('now'));
52
- }
53
-
54
- public function testNowWithTestValueSet()
55
- {
56
- $testNow = Carbon::yesterday();
57
- Carbon::setTestNow($testNow);
58
-
59
- $this->assertEquals($testNow, Carbon::now());
60
- }
61
-
62
- public function testParseWithTestValueSet()
63
- {
64
- $testNow = Carbon::yesterday();
65
-
66
- $scope = $this;
67
- $this->wrapWithTestNow(function () use ($scope, $testNow) {
68
- $scope->assertEquals($testNow, Carbon::parse());
69
- $scope->assertEquals($testNow, Carbon::parse(null));
70
- $scope->assertEquals($testNow, Carbon::parse(''));
71
- $scope->assertEquals($testNow, Carbon::parse('now'));
72
- }, $testNow);
73
- }
74
-
75
- public function testParseRelativeWithTestValueSet()
76
- {
77
- $testNow = Carbon::parse('2013-09-01 05:15:05');
78
-
79
- $scope = $this;
80
- $this->wrapWithTestNow(function () use ($scope) {
81
- $scope->assertSame('2013-09-01 05:10:05', Carbon::parse('5 minutes ago')->toDateTimeString());
82
- $scope->assertSame('2013-08-25 05:15:05', Carbon::parse('1 week ago')->toDateTimeString());
83
-
84
- $scope->assertSame('2013-09-02 00:00:00', Carbon::parse('tomorrow')->toDateTimeString());
85
- $scope->assertSame('2013-09-01 00:00:00', Carbon::parse('today')->toDateTimeString());
86
- $scope->assertSame('2013-08-31 00:00:00', Carbon::parse('yesterday')->toDateTimeString());
87
-
88
- $scope->assertSame('2013-09-02 05:15:05', Carbon::parse('+1 day')->toDateTimeString());
89
- $scope->assertSame('2013-08-31 05:15:05', Carbon::parse('-1 day')->toDateTimeString());
90
-
91
- $scope->assertSame('2013-09-02 00:00:00', Carbon::parse('next monday')->toDateTimeString());
92
- $scope->assertSame('2013-09-03 00:00:00', Carbon::parse('next tuesday')->toDateTimeString());
93
- $scope->assertSame('2013-09-04 00:00:00', Carbon::parse('next wednesday')->toDateTimeString());
94
- $scope->assertSame('2013-09-05 00:00:00', Carbon::parse('next thursday')->toDateTimeString());
95
- $scope->assertSame('2013-09-06 00:00:00', Carbon::parse('next friday')->toDateTimeString());
96
- $scope->assertSame('2013-09-07 00:00:00', Carbon::parse('next saturday')->toDateTimeString());
97
- $scope->assertSame('2013-09-08 00:00:00', Carbon::parse('next sunday')->toDateTimeString());
98
-
99
- $scope->assertSame('2013-08-26 00:00:00', Carbon::parse('last monday')->toDateTimeString());
100
- $scope->assertSame('2013-08-27 00:00:00', Carbon::parse('last tuesday')->toDateTimeString());
101
- $scope->assertSame('2013-08-28 00:00:00', Carbon::parse('last wednesday')->toDateTimeString());
102
- $scope->assertSame('2013-08-29 00:00:00', Carbon::parse('last thursday')->toDateTimeString());
103
- $scope->assertSame('2013-08-30 00:00:00', Carbon::parse('last friday')->toDateTimeString());
104
- $scope->assertSame('2013-08-31 00:00:00', Carbon::parse('last saturday')->toDateTimeString());
105
- $scope->assertSame('2013-08-25 00:00:00', Carbon::parse('last sunday')->toDateTimeString());
106
-
107
- $scope->assertSame('2013-09-02 00:00:00', Carbon::parse('this monday')->toDateTimeString());
108
- $scope->assertSame('2013-09-03 00:00:00', Carbon::parse('this tuesday')->toDateTimeString());
109
- $scope->assertSame('2013-09-04 00:00:00', Carbon::parse('this wednesday')->toDateTimeString());
110
- $scope->assertSame('2013-09-05 00:00:00', Carbon::parse('this thursday')->toDateTimeString());
111
- $scope->assertSame('2013-09-06 00:00:00', Carbon::parse('this friday')->toDateTimeString());
112
- $scope->assertSame('2013-09-07 00:00:00', Carbon::parse('this saturday')->toDateTimeString());
113
- $scope->assertSame('2013-09-01 00:00:00', Carbon::parse('this sunday')->toDateTimeString());
114
-
115
- $scope->assertSame('2013-10-01 05:15:05', Carbon::parse('first day of next month')->toDateTimeString());
116
- $scope->assertSame('2013-09-30 05:15:05', Carbon::parse('last day of this month')->toDateTimeString());
117
- }, $testNow);
118
- }
119
-
120
- public function testParseRelativeWithMinusSignsInDate()
121
- {
122
- $testNow = Carbon::parse('2013-09-01 05:15:05');
123
-
124
- $scope = $this;
125
- $this->wrapWithTestNow(function () use ($scope) {
126
- $scope->assertSame('2000-01-03 00:00:00', Carbon::parse('2000-1-3')->toDateTimeString());
127
- $scope->assertSame('2000-10-10 00:00:00', Carbon::parse('2000-10-10')->toDateTimeString());
128
- }, $testNow);
129
- }
130
-
131
- public function testTimeZoneWithTestValueSet()
132
- {
133
- $testNow = Carbon::parse('2013-07-01 12:00:00', 'America/New_York');
134
-
135
- $scope = $this;
136
- $this->wrapWithTestNow(function () use ($scope) {
137
- $scope->assertSame('2013-07-01T12:00:00-04:00', Carbon::parse('now')->toIso8601String());
138
- $scope->assertSame('2013-07-01T11:00:00-05:00', Carbon::parse('now', 'America/Mexico_City')->toIso8601String());
139
- $scope->assertSame('2013-07-01T09:00:00-07:00', Carbon::parse('now', 'America/Vancouver')->toIso8601String());
140
- }, $testNow);
141
- }
142
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/CarbonInterval/AddTest.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\CarbonInterval;
13
-
14
- use Carbon\Carbon;
15
- use Carbon\CarbonInterval;
16
- use DateInterval;
17
- use Tests\AbstractTestCase;
18
-
19
- class AddTest extends AbstractTestCase
20
- {
21
- public function testAdd()
22
- {
23
- $ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add(new DateInterval('P2Y1M5DT22H33M44S'));
24
- $this->assertCarbonInterval($ci, 6, 4, 54, 30, 43, 55);
25
- }
26
-
27
- public function testAddWithDiffDateInterval()
28
- {
29
- $diff = Carbon::now()->diff(Carbon::now()->addWeeks(3));
30
- $ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add($diff);
31
- $this->assertCarbonInterval($ci, 4, 3, 70, 8, 10, 11);
32
- }
33
-
34
- public function testAddWithNegativeDiffDateInterval()
35
- {
36
- $diff = Carbon::now()->diff(Carbon::now()->subWeeks(3));
37
- $ci = CarbonInterval::create(4, 3, 6, 7, 8, 10, 11)->add($diff);
38
- $this->assertCarbonInterval($ci, 4, 3, 28, 8, 10, 11);
39
- }
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/CarbonInterval/ConstructTest.php DELETED
@@ -1,238 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\CarbonInterval;
13
-
14
- use Carbon\Carbon;
15
- use Carbon\CarbonInterval;
16
- use DateInterval;
17
- use Tests\AbstractTestCase;
18
-
19
- class ConstructTest extends AbstractTestCase
20
- {
21
- public function testDefaults()
22
- {
23
- $ci = new CarbonInterval();
24
- $this->assertInstanceOfCarbonInterval($ci);
25
- $this->assertCarbonInterval($ci, 1, 0, 0, 0, 0, 0);
26
- }
27
-
28
- public function testNulls()
29
- {
30
- $ci = new CarbonInterval(null, null, null, null, null, null);
31
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 0);
32
- $ci = CarbonInterval::days(null);
33
- $this->assertInstanceOfCarbonInterval($ci);
34
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 0);
35
- }
36
-
37
- public function testZeroes()
38
- {
39
- $ci = new CarbonInterval(0, 0, 0, 0, 0, 0);
40
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 0);
41
-
42
- $ci = CarbonInterval::days(0);
43
- $this->assertInstanceOfCarbonInterval($ci);
44
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 0);
45
- }
46
-
47
- public function testZeroesChained()
48
- {
49
- $ci = CarbonInterval::days(0)->week(0)->minutes(0);
50
- $this->assertInstanceOfCarbonInterval($ci);
51
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 0);
52
- }
53
-
54
- public function testYears()
55
- {
56
- $ci = new CarbonInterval(1);
57
- $this->assertInstanceOfCarbonInterval($ci);
58
- $this->assertCarbonInterval($ci, 1, 0, 0, 0, 0, 0);
59
-
60
- $ci = CarbonInterval::years(2);
61
- $this->assertInstanceOfCarbonInterval($ci);
62
- $this->assertCarbonInterval($ci, 2, 0, 0, 0, 0, 0);
63
-
64
- $ci = CarbonInterval::year();
65
- $this->assertInstanceOfCarbonInterval($ci);
66
- $this->assertCarbonInterval($ci, 1, 0, 0, 0, 0, 0);
67
-
68
- $ci = CarbonInterval::year(3);
69
- $this->assertInstanceOfCarbonInterval($ci);
70
- $this->assertCarbonInterval($ci, 3, 0, 0, 0, 0, 0);
71
- }
72
-
73
- public function testMonths()
74
- {
75
- $ci = new CarbonInterval(0, 1);
76
- $this->assertInstanceOfCarbonInterval($ci);
77
- $this->assertCarbonInterval($ci, 0, 1, 0, 0, 0, 0);
78
-
79
- $ci = CarbonInterval::months(2);
80
- $this->assertInstanceOfCarbonInterval($ci);
81
- $this->assertCarbonInterval($ci, 0, 2, 0, 0, 0, 0);
82
-
83
- $ci = CarbonInterval::month();
84
- $this->assertInstanceOfCarbonInterval($ci);
85
- $this->assertCarbonInterval($ci, 0, 1, 0, 0, 0, 0);
86
-
87
- $ci = CarbonInterval::month(3);
88
- $this->assertInstanceOfCarbonInterval($ci);
89
- $this->assertCarbonInterval($ci, 0, 3, 0, 0, 0, 0);
90
- }
91
-
92
- public function testWeeks()
93
- {
94
- $ci = new CarbonInterval(0, 0, 1);
95
- $this->assertInstanceOfCarbonInterval($ci);
96
- $this->assertCarbonInterval($ci, 0, 0, 7, 0, 0, 0);
97
-
98
- $ci = CarbonInterval::weeks(2);
99
- $this->assertInstanceOfCarbonInterval($ci);
100
- $this->assertCarbonInterval($ci, 0, 0, 14, 0, 0, 0);
101
-
102
- $ci = CarbonInterval::week();
103
- $this->assertInstanceOfCarbonInterval($ci);
104
- $this->assertCarbonInterval($ci, 0, 0, 7, 0, 0, 0);
105
-
106
- $ci = CarbonInterval::week(3);
107
- $this->assertInstanceOfCarbonInterval($ci);
108
- $this->assertCarbonInterval($ci, 0, 0, 21, 0, 0, 0);
109
- }
110
-
111
- public function testDays()
112
- {
113
- $ci = new CarbonInterval(0, 0, 0, 1);
114
- $this->assertInstanceOfCarbonInterval($ci);
115
- $this->assertCarbonInterval($ci, 0, 0, 1, 0, 0, 0);
116
-
117
- $ci = CarbonInterval::days(2);
118
- $this->assertInstanceOfCarbonInterval($ci);
119
- $this->assertCarbonInterval($ci, 0, 0, 2, 0, 0, 0);
120
-
121
- $ci = CarbonInterval::dayz(2);
122
- $this->assertInstanceOfCarbonInterval($ci);
123
- $this->assertCarbonInterval($ci, 0, 0, 2, 0, 0, 0);
124
-
125
- $ci = CarbonInterval::day();
126
- $this->assertInstanceOfCarbonInterval($ci);
127
- $this->assertCarbonInterval($ci, 0, 0, 1, 0, 0, 0);
128
-
129
- $ci = CarbonInterval::day(3);
130
- $this->assertInstanceOfCarbonInterval($ci);
131
- $this->assertCarbonInterval($ci, 0, 0, 3, 0, 0, 0);
132
- }
133
-
134
- public function testHours()
135
- {
136
- $ci = new CarbonInterval(0, 0, 0, 0, 1);
137
- $this->assertInstanceOfCarbonInterval($ci);
138
- $this->assertCarbonInterval($ci, 0, 0, 0, 1, 0, 0);
139
-
140
- $ci = CarbonInterval::hours(2);
141
- $this->assertInstanceOfCarbonInterval($ci);
142
- $this->assertCarbonInterval($ci, 0, 0, 0, 2, 0, 0);
143
-
144
- $ci = CarbonInterval::hour();
145
- $this->assertInstanceOfCarbonInterval($ci);
146
- $this->assertCarbonInterval($ci, 0, 0, 0, 1, 0, 0);
147
-
148
- $ci = CarbonInterval::hour(3);
149
- $this->assertInstanceOfCarbonInterval($ci);
150
- $this->assertCarbonInterval($ci, 0, 0, 0, 3, 0, 0);
151
- }
152
-
153
- public function testMinutes()
154
- {
155
- $ci = new CarbonInterval(0, 0, 0, 0, 0, 1);
156
- $this->assertInstanceOfCarbonInterval($ci);
157
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 1, 0);
158
-
159
- $ci = CarbonInterval::minutes(2);
160
- $this->assertInstanceOfCarbonInterval($ci);
161
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 2, 0);
162
-
163
- $ci = CarbonInterval::minute();
164
- $this->assertInstanceOfCarbonInterval($ci);
165
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 1, 0);
166
-
167
- $ci = CarbonInterval::minute(3);
168
- $this->assertInstanceOfCarbonInterval($ci);
169
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 3, 0);
170
- }
171
-
172
- public function testSeconds()
173
- {
174
- $ci = new CarbonInterval(0, 0, 0, 0, 0, 0, 1);
175
- $this->assertInstanceOfCarbonInterval($ci);
176
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 1);
177
-
178
- $ci = CarbonInterval::seconds(2);
179
- $this->assertInstanceOfCarbonInterval($ci);
180
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 2);
181
-
182
- $ci = CarbonInterval::second();
183
- $this->assertInstanceOfCarbonInterval($ci);
184
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 1);
185
-
186
- $ci = CarbonInterval::second(3);
187
- $this->assertInstanceOfCarbonInterval($ci);
188
- $this->assertCarbonInterval($ci, 0, 0, 0, 0, 0, 3);
189
- }
190
-
191
- public function testYearsAndHours()
192
- {
193
- $ci = new CarbonInterval(5, 0, 0, 0, 3, 0, 0);
194
- $this->assertInstanceOfCarbonInterval($ci);
195
- $this->assertCarbonInterval($ci, 5, 0, 0, 3, 0, 0);
196
- }
197
-
198
- public function testAll()
199
- {
200
- $ci = new CarbonInterval(5, 6, 2, 5, 9, 10, 11);
201
- $this->assertInstanceOfCarbonInterval($ci);
202
- $this->assertCarbonInterval($ci, 5, 6, 19, 9, 10, 11);
203
- }
204
-
205
- public function testAllWithCreate()
206
- {
207
- $ci = CarbonInterval::create(5, 6, 2, 5, 9, 10, 11);
208
- $this->assertInstanceOfCarbonInterval($ci);
209
- $this->assertCarbonInterval($ci, 5, 6, 19, 9, 10, 11);
210
- }
211
-
212
- public function testInstance()
213
- {
214
- $ci = CarbonInterval::instance(new DateInterval('P2Y1M5DT22H33M44S'));
215
- $this->assertInstanceOfCarbonInterval($ci);
216
- $this->assertCarbonInterval($ci, 2, 1, 5, 22, 33, 44);
217
- $this->assertTrue($ci->days === false || $ci->days === CarbonInterval::PHP_DAYS_FALSE);
218
- }
219
-
220
- public function testInstanceWithNegativeDateInterval()
221
- {
222
- $di = new DateInterval('P2Y1M5DT22H33M44S');
223
- $di->invert = 1;
224
- $ci = CarbonInterval::instance($di);
225
- $this->assertInstanceOfCarbonInterval($ci);
226
- $this->assertCarbonInterval($ci, 2, 1, 5, 22, 33, 44);
227
- $this->assertTrue($ci->days === false || $ci->days === CarbonInterval::PHP_DAYS_FALSE);
228
- $this->assertSame(1, $ci->invert);
229
- }
230
-
231
- /**
232
- * @expectedException \InvalidArgumentException
233
- */
234
- public function testInstanceWithDaysThrowsException()
235
- {
236
- CarbonInterval::instance(Carbon::now()->diff(Carbon::now()->addWeeks(3)));
237
- }
238
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/CarbonInterval/ForHumansTest.php DELETED
@@ -1,131 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\CarbonInterval;
13
-
14
- use Carbon\CarbonInterval;
15
- use Symfony\Component\Translation\Loader\ArrayLoader;
16
- use Symfony\Component\Translation\Translator;
17
- use Tests\AbstractTestCase;
18
-
19
- class ForHumansTest extends AbstractTestCase
20
- {
21
- public function testGetTranslator()
22
- {
23
- $t = CarbonInterval::getTranslator();
24
- $this->assertNotNull($t);
25
- $this->assertSame('en', $t->getLocale());
26
- }
27
-
28
- public function testSetTranslator()
29
- {
30
- $t = new Translator('fr');
31
- $t->addLoader('array', new ArrayLoader());
32
- CarbonInterval::setTranslator($t);
33
-
34
- $t = CarbonInterval::getTranslator();
35
- $this->assertNotNull($t);
36
- $this->assertSame('fr', $t->getLocale());
37
- }
38
-
39
- public function testGetLocale()
40
- {
41
- CarbonInterval::setLocale('en');
42
- $this->assertSame('en', CarbonInterval::getLocale());
43
- }
44
-
45
- public function testSetLocale()
46
- {
47
- CarbonInterval::setLocale('en');
48
- $this->assertSame('en', CarbonInterval::getLocale());
49
- CarbonInterval::setLocale('fr');
50
- $this->assertSame('fr', CarbonInterval::getLocale());
51
- }
52
-
53
- public function testYear()
54
- {
55
- CarbonInterval::setLocale('en');
56
- $this->assertSame('1 year', CarbonInterval::year()->forHumans());
57
- }
58
-
59
- public function testYearToString()
60
- {
61
- CarbonInterval::setLocale('en');
62
- $this->assertSame('1 year:abc', CarbonInterval::year().':abc');
63
- }
64
-
65
- public function testYears()
66
- {
67
- CarbonInterval::setLocale('en');
68
- $this->assertSame('2 years', CarbonInterval::years(2)->forHumans());
69
- }
70
-
71
- public function testYearsAndMonth()
72
- {
73
- CarbonInterval::setLocale('en');
74
- $this->assertSame('2 years 1 month', CarbonInterval::create(2, 1)->forHumans());
75
- }
76
-
77
- public function testAll()
78
- {
79
- CarbonInterval::setLocale('en');
80
- $ci = CarbonInterval::create(11, 1, 2, 5, 22, 33, 55)->forHumans();
81
- $this->assertSame('11 years 1 month 2 weeks 5 days 22 hours 33 minutes 55 seconds', $ci);
82
- }
83
-
84
- public function testYearsAndMonthInFrench()
85
- {
86
- CarbonInterval::setLocale('fr');
87
- $this->assertSame('2 ans 1 mois', CarbonInterval::create(2, 1)->forHumans());
88
- }
89
-
90
- public function testYearsAndMonthInGerman()
91
- {
92
- CarbonInterval::setLocale('de');
93
- $this->assertSame('1 Jahr 1 Monat', CarbonInterval::create(1, 1)->forHumans());
94
- $this->assertSame('2 Jahre 1 Monat', CarbonInterval::create(2, 1)->forHumans());
95
- }
96
-
97
- public function testYearsAndMonthInBulgarian()
98
- {
99
- CarbonInterval::setLocale('bg');
100
- $this->assertSame('1 година 1 месец', CarbonInterval::create(1, 1)->forHumans());
101
- $this->assertSame('2 години 1 месец', CarbonInterval::create(2, 1)->forHumans());
102
- }
103
-
104
- public function testYearsAndMonthInCatalan()
105
- {
106
- CarbonInterval::setLocale('ca');
107
- $this->assertSame('1 any 1 mes', CarbonInterval::create(1, 1)->forHumans());
108
- $this->assertSame('2 anys 1 mes', CarbonInterval::create(2, 1)->forHumans());
109
- }
110
-
111
- public function testYearsAndMonthInCzech()
112
- {
113
- CarbonInterval::setLocale('cs');
114
- $this->assertSame('1 rok 1 měsíc', CarbonInterval::create(1, 1)->forHumans());
115
- $this->assertSame('2 roky 1 měsíc', CarbonInterval::create(2, 1)->forHumans());
116
- }
117
-
118
- public function testYearsAndMonthInGreek()
119
- {
120
- CarbonInterval::setLocale('el');
121
- $this->assertSame('1 χρόνος 1 μήνας', CarbonInterval::create(1, 1)->forHumans());
122
- $this->assertSame('2 χρόνια 1 μήνας', CarbonInterval::create(2, 1)->forHumans());
123
- }
124
-
125
- public function testYearsAndMonthsInDanish()
126
- {
127
- CarbonInterval::setLocale('da');
128
- $this->assertSame('1 år 1 måned', CarbonInterval::create(1, 1)->forHumans());
129
- $this->assertSame('2 år 1 måned', CarbonInterval::create(2, 1)->forHumans());
130
- }
131
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/CarbonInterval/GettersTest.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\CarbonInterval;
13
-
14
- use Carbon\CarbonInterval;
15
- use Tests\AbstractTestCase;
16
-
17
- class GettersTest extends AbstractTestCase
18
- {
19
- /**
20
- * @expectedException \InvalidArgumentException
21
- */
22
- public function testGettersThrowExceptionOnUnknownGetter()
23
- {
24
- CarbonInterval::year()->sdfsdfss;
25
- }
26
-
27
- public function testYearsGetter()
28
- {
29
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
30
- $this->assertSame(4, $ci->years);
31
- }
32
-
33
- public function testMonthsGetter()
34
- {
35
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
36
- $this->assertSame(5, $ci->months);
37
- }
38
-
39
- public function testWeeksGetter()
40
- {
41
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
42
- $this->assertSame(6, $ci->weeks);
43
- }
44
-
45
- public function testDayzExcludingWeeksGetter()
46
- {
47
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
48
- $this->assertSame(5, $ci->daysExcludeWeeks);
49
- $this->assertSame(5, $ci->dayzExcludeWeeks);
50
- }
51
-
52
- public function testDayzGetter()
53
- {
54
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
55
- $this->assertSame(6 * 7 + 5, $ci->dayz);
56
- }
57
-
58
- public function testHoursGetter()
59
- {
60
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
61
- $this->assertSame(8, $ci->hours);
62
- }
63
-
64
- public function testMinutesGetter()
65
- {
66
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
67
- $this->assertSame(9, $ci->minutes);
68
- }
69
-
70
- public function testSecondsGetter()
71
- {
72
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
73
- $this->assertSame(10, $ci->seconds);
74
- }
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/CarbonInterval/SettersTest.php DELETED
@@ -1,102 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\CarbonInterval;
13
-
14
- use Carbon\CarbonInterval;
15
- use Tests\AbstractTestCase;
16
-
17
- class SettersTest extends AbstractTestCase
18
- {
19
- public function testYearsSetter()
20
- {
21
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
22
- $ci->years = 2;
23
- $this->assertSame(2, $ci->years);
24
- }
25
-
26
- public function testMonthsSetter()
27
- {
28
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
29
- $ci->months = 11;
30
- $this->assertSame(11, $ci->months);
31
- }
32
-
33
- public function testWeeksSetter()
34
- {
35
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
36
- $ci->weeks = 11;
37
- $this->assertSame(11, $ci->weeks);
38
- $this->assertSame(7 * 11, $ci->dayz);
39
- }
40
-
41
- public function testDayzSetter()
42
- {
43
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
44
- $ci->dayz = 11;
45
- $this->assertSame(11, $ci->dayz);
46
- $this->assertSame(1, $ci->weeks);
47
- $this->assertSame(4, $ci->dayzExcludeWeeks);
48
- }
49
-
50
- public function testHoursSetter()
51
- {
52
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
53
- $ci->hours = 12;
54
- $this->assertSame(12, $ci->hours);
55
- }
56
-
57
- public function testMinutesSetter()
58
- {
59
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
60
- $ci->minutes = 11;
61
- $this->assertSame(11, $ci->minutes);
62
- }
63
-
64
- public function testSecondsSetter()
65
- {
66
- $ci = CarbonInterval::create(4, 5, 6, 5, 8, 9, 10);
67
- $ci->seconds = 34;
68
- $this->assertSame(34, $ci->seconds);
69
- }
70
-
71
- public function testFluentSetters()
72
- {
73
- $ci = CarbonInterval::years(4)->months(2)->dayz(5)->hours(3)->minute()->seconds(59);
74
- $this->assertInstanceOfCarbonInterval($ci);
75
- $this->assertCarbonInterval($ci, 4, 2, 5, 3, 1, 59);
76
-
77
- $ci = CarbonInterval::years(4)->months(2)->weeks(2)->hours(3)->minute()->seconds(59);
78
- $this->assertInstanceOfCarbonInterval($ci);
79
- $this->assertCarbonInterval($ci, 4, 2, 14, 3, 1, 59);
80
- }
81
-
82
- public function testFluentSettersDaysOverwritesWeeks()
83
- {
84
- $ci = CarbonInterval::weeks(3)->days(5);
85
- $this->assertCarbonInterval($ci, 0, 0, 5, 0, 0, 0);
86
- }
87
-
88
- public function testFluentSettersWeeksOverwritesDays()
89
- {
90
- $ci = CarbonInterval::days(5)->weeks(3);
91
- $this->assertCarbonInterval($ci, 0, 0, 3 * 7, 0, 0, 0);
92
- }
93
-
94
- public function testFluentSettersWeeksAndDaysIsCumulative()
95
- {
96
- $ci = CarbonInterval::year(5)->weeksAndDays(2, 6);
97
- $this->assertCarbonInterval($ci, 5, 0, 20, 0, 0, 0);
98
- $this->assertSame(20, $ci->dayz);
99
- $this->assertSame(2, $ci->weeks);
100
- $this->assertSame(6, $ci->dayzExcludeWeeks);
101
- }
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/CarbonInterval/SpecTest.php DELETED
@@ -1,91 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\CarbonInterval;
13
-
14
- use Carbon\CarbonInterval;
15
- use DateInterval;
16
- use Tests\AbstractTestCase;
17
-
18
- class SpecTest extends AbstractTestCase
19
- {
20
- public function testZeroInterval()
21
- {
22
- $ci = new CarbonInterval(0, 0, 0, 0, 0, 0, 0);
23
- $this->assertEquals('PT0S', $ci->spec());
24
- }
25
-
26
- public function testYearInterval()
27
- {
28
- $ci = new CarbonInterval();
29
- $this->assertEquals('P1Y', $ci->spec());
30
- }
31
-
32
- public function testMonthInterval()
33
- {
34
- $ci = new CarbonInterval(0, 1);
35
- $this->assertEquals('P1M', $ci->spec());
36
- }
37
-
38
- public function testWeekInterval()
39
- {
40
- $ci = new CarbonInterval(0, 0, 1);
41
- $this->assertEquals('P7D', $ci->spec());
42
- }
43
-
44
- public function testDayInterval()
45
- {
46
- $ci = new CarbonInterval(0, 0, 0, 1);
47
- $this->assertEquals('P1D', $ci->spec());
48
- }
49
-
50
- public function testMixedDateInterval()
51
- {
52
- $ci = new CarbonInterval(1, 2, 0, 3);
53
- $this->assertEquals('P1Y2M3D', $ci->spec());
54
- }
55
-
56
- public function testHourInterval()
57
- {
58
- $ci = new CarbonInterval(0, 0, 0, 0, 1);
59
- $this->assertEquals('PT1H', $ci->spec());
60
- }
61
-
62
- public function testMinuteInterval()
63
- {
64
- $ci = new CarbonInterval(0, 0, 0, 0, 0, 1);
65
- $this->assertEquals('PT1M', $ci->spec());
66
- }
67
-
68
- public function testSecondInterval()
69
- {
70
- $ci = new CarbonInterval(0, 0, 0, 0, 0, 0, 1);
71
- $this->assertEquals('PT1S', $ci->spec());
72
- }
73
-
74
- public function testMixedTimeInterval()
75
- {
76
- $ci = new CarbonInterval(0, 0, 0, 0, 1, 2, 3);
77
- $this->assertEquals('PT1H2M3S', $ci->spec());
78
- }
79
-
80
- public function testMixedDateAndTimeInterval()
81
- {
82
- $ci = new CarbonInterval(1, 2, 0, 3, 4, 5, 6);
83
- $this->assertEquals('P1Y2M3DT4H5M6S', $ci->spec());
84
- }
85
-
86
- public function testCreatingInstanceEquals()
87
- {
88
- $ci = new CarbonInterval(1, 2, 0, 3, 4, 5, 6);
89
- $this->assertEquals($ci, CarbonInterval::instance(new DateInterval($ci->spec())));
90
- }
91
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/CaTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class CaTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInCatalan()
20
- {
21
- Carbon::setLocale('ca');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('fa 1 segon', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('fa 2 segons', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('fa 1 minut', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('fa 2 minuts', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('fa 1 hora', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('fa 2 hores', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('fa 1 dia', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('fa 2 dies', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('fa 1 setmana', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('fa 2 setmanes', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('fa 1 mes', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('fa 2 mesos', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('fa 1 any', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('fa 2 anys', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('dins de 1 segon', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 segon després', $d->diffForHumans($d2));
73
- $scope->assertSame('1 segon abans', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 segon', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 segons', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/DaTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class DaTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInDanish()
20
- {
21
- Carbon::setLocale('da');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 sekund siden', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 sekunder siden', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 minut siden', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 minutter siden', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 time siden', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 timer siden', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 dag siden', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 dage siden', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 uge siden', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 uger siden', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 måned siden', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 måneder siden', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 år siden', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 år siden', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('om 1 sekund', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 sekund efter', $d->diffForHumans($d2));
73
- $scope->assertSame('1 sekund før', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 sekund', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 sekunder', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/DeTest.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class DeTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInGerman()
20
- {
21
- Carbon::setLocale('de');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->addYear();
26
- $scope->assertSame('in 1 Jahr', $d->diffForHumans());
27
- $scope->assertSame('1J', $d->diffForHumans(null, true, true));
28
-
29
- $d = Carbon::now()->addYears(2);
30
- $scope->assertSame('in 2 Jahren', $d->diffForHumans());
31
- $scope->assertSame('2J', $d->diffForHumans(null, true, true));
32
- $scope->assertSame('in 2J', $d->diffForHumans(null, false, true));
33
-
34
- $d = Carbon::now()->subYear();
35
- $scope->assertSame('1 Jahr später', Carbon::now()->diffForHumans($d));
36
-
37
- $d = Carbon::now()->subYears(2);
38
- $scope->assertSame('2 Jahre später', Carbon::now()->diffForHumans($d));
39
-
40
- $d = Carbon::now()->addYear();
41
- $scope->assertSame('1 Jahr zuvor', Carbon::now()->diffForHumans($d));
42
-
43
- $d = Carbon::now()->addYears(2);
44
- $scope->assertSame('2 Jahre zuvor', Carbon::now()->diffForHumans($d));
45
-
46
- $d = Carbon::now()->subYear();
47
- $scope->assertSame('vor 1 Jahr', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subYears(2);
50
- $scope->assertSame('vor 2 Jahren', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subMinute();
53
- $scope->assertSame('1Min', $d->diffForHumans(null, true, true));
54
-
55
- $d = Carbon::now()->subHours(2);
56
- $scope->assertSame('vor 2Std', $d->diffForHumans(null, false, true));
57
-
58
- $d = Carbon::now()->subDay();
59
- $scope->assertSame('vor 1Tg', $d->diffForHumans(null, false, true));
60
-
61
- $d = Carbon::now()->subWeeks(2);
62
- $scope->assertSame('vor 2Wo', $d->diffForHumans(null, false, true));
63
-
64
- $d = Carbon::now()->subMonths(2);
65
- $scope->assertSame('vor 2Mon', $d->diffForHumans(null, false, true));
66
-
67
- $d = Carbon::now()->addYear();
68
- $scope->assertSame('in 1J', $d->diffForHumans(null, false, true));
69
-
70
- $d = Carbon::now()->subSeconds(2);
71
- $scope->assertSame('vor 2Sek', $d->diffForHumans(null, false, true));
72
- });
73
- }
74
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/EnTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class EnTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansUsingShortUnitsEnglish()
20
- {
21
- Carbon::setLocale('en');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1s ago', $d->diffForHumans(null, false, true));
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2s ago', $d->diffForHumans(null, false, true));
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1m ago', $d->diffForHumans(null, false, true));
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2m ago', $d->diffForHumans(null, false, true));
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1h ago', $d->diffForHumans(null, false, true));
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2h ago', $d->diffForHumans(null, false, true));
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1d ago', $d->diffForHumans(null, false, true));
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2d ago', $d->diffForHumans(null, false, true));
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1w ago', $d->diffForHumans(null, false, true));
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2w ago', $d->diffForHumans(null, false, true));
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1mo ago', $d->diffForHumans(null, false, true));
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2mos ago', $d->diffForHumans(null, false, true));
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1yr ago', $d->diffForHumans(null, false, true));
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2yrs ago', $d->diffForHumans(null, false, true));
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1s from now', $d->diffForHumans(null, false, true));
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1s after', $d->diffForHumans($d2, false, true));
73
- $scope->assertSame('1s before', $d2->diffForHumans($d, false, true));
74
-
75
- $scope->assertSame('1s', $d->diffForHumans($d2, true, true));
76
- $scope->assertSame('2s', $d2->diffForHumans($d->addSecond(), true, true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/EsTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class EsTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInSpanish()
20
- {
21
- Carbon::setLocale('es');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('hace 1 segundo', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(3);
29
- $scope->assertSame('hace 3 segundos', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('hace 1 minuto', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('hace 2 minutos', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('hace 1 hora', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('hace 2 horas', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('hace 1 día', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('hace 2 días', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('hace 1 semana', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('hace 2 semanas', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('hace 1 mes', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('hace 2 meses', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('hace 1 año', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('hace 2 años', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('dentro de 1 segundo', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 segundo después', $d->diffForHumans($d2));
73
- $scope->assertSame('1 segundo antes', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 segundo', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 segundos', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/FaTest.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class FaTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInFarsi()
20
- {
21
- Carbon::setLocale('fa');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 ثانیه پیش', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 ثانیه پیش', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 دقیقه پیش', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 دقیقه پیش', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 ساعت پیش', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 ساعت پیش', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 روز پیش', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 روز پیش', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 هفته پیش', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 هفته پیش', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 ماه پیش', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 ماه پیش', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 سال پیش', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 سال پیش', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 ثانیه بعد', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 ثانیه پس از', $d->diffForHumans($d2));
73
- $scope->assertSame('1 ثانیه پیش از', $d2->diffForHumans($d));
74
-
75
- $d = Carbon::now()->addSecond();
76
- $d2 = Carbon::now();
77
- $scope->assertSame('1 ثانیه پس از', $d->diffForHumans($d2));
78
- $scope->assertSame('1 ثانیه پیش از', $d2->diffForHumans($d));
79
-
80
- $scope->assertSame('1 ثانیه', $d->diffForHumans($d2, true));
81
- $scope->assertSame('2 ثانیه', $d2->diffForHumans($d->addSecond(), true));
82
- });
83
- }
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/FoTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class FoTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInFaroese()
20
- {
21
- Carbon::setLocale('fo');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 sekund síðan', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 sekundir síðan', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 minutt síðan', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 minuttir síðan', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 tími síðan', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 tímar síðan', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 dag síðan', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 dagar síðan', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 vika síðan', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 vikur síðan', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 mánaður síðan', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 mánaðir síðan', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 ár síðan', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 ár síðan', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('um 1 sekund', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 sekund aftaná', $d->diffForHumans($d2));
73
- $scope->assertSame('1 sekund áðrenn', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 sekund', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 sekundir', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/FrTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class FrTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInFrench()
20
- {
21
- Carbon::setLocale('fr');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('il y a 1 seconde', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('il y a 2 secondes', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('il y a 1 minute', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('il y a 2 minutes', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('il y a 1 heure', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('il y a 2 heures', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('il y a 1 jour', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('il y a 2 jours', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('il y a 1 semaine', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('il y a 2 semaines', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('il y a 1 mois', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('il y a 2 mois', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('il y a 1 an', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('il y a 2 ans', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('dans 1 seconde', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 seconde après', $d->diffForHumans($d2));
73
- $scope->assertSame('1 seconde avant', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 seconde', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 secondes', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/GlTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class GlTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInGalician()
20
- {
21
- Carbon::setLocale('gl');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('fai 1 segundo', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(3);
29
- $scope->assertSame('fai 3 segundos', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('fai 1 minuto', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('fai 2 minutos', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('fai 1 hora', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('fai 2 horas', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('fai 1 día', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('fai 2 días', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('fai 1 semana', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('fai 2 semanas', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('fai 1 mes', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('fai 2 meses', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('fai 1 ano', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('fai 2 anos', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('dentro de 1 segundo', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 segundo despois', $d->diffForHumans($d2));
73
- $scope->assertSame('1 segundo antes', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 segundo', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 segundos', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/HuTest.php DELETED
@@ -1,208 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class HuTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInHungarian()
20
- {
21
- Carbon::setLocale('hu');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 másodperce', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 másodperce', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 perce', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 perce', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 órája', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 órája', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 napja', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 napja', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 hete', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 hete', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 hónapja', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 hónapja', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 éve', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 éve', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 másodperc múlva', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSeconds(2);
71
- $scope->assertSame('2 másodperc múlva', $d->diffForHumans());
72
-
73
- $d = Carbon::now()->addMinute();
74
- $scope->assertSame('1 perc múlva', $d->diffForHumans());
75
-
76
- $d = Carbon::now()->addMinutes(2);
77
- $scope->assertSame('2 perc múlva', $d->diffForHumans());
78
-
79
- $d = Carbon::now()->addHour();
80
- $scope->assertSame('1 óra múlva', $d->diffForHumans());
81
-
82
- $d = Carbon::now()->addHours(2);
83
- $scope->assertSame('2 óra múlva', $d->diffForHumans());
84
-
85
- $d = Carbon::now()->addDay();
86
- $scope->assertSame('1 nap múlva', $d->diffForHumans());
87
-
88
- $d = Carbon::now()->addDays(2);
89
- $scope->assertSame('2 nap múlva', $d->diffForHumans());
90
-
91
- $d = Carbon::now()->addWeek();
92
- $scope->assertSame('1 hét múlva', $d->diffForHumans());
93
-
94
- $d = Carbon::now()->addWeeks(2);
95
- $scope->assertSame('2 hét múlva', $d->diffForHumans());
96
-
97
- $d = Carbon::now()->addMonth();
98
- $scope->assertSame('1 hónap múlva', $d->diffForHumans());
99
-
100
- $d = Carbon::now()->addMonths(2);
101
- $scope->assertSame('2 hónap múlva', $d->diffForHumans());
102
-
103
- $d = Carbon::now()->addYear();
104
- $scope->assertSame('1 év múlva', $d->diffForHumans());
105
-
106
- $d = Carbon::now()->addYears(2);
107
- $scope->assertSame('2 év múlva', $d->diffForHumans());
108
-
109
- $d = Carbon::now()->addSecond();
110
- $d2 = Carbon::now();
111
- $scope->assertSame('1 másodperccel később', $d->diffForHumans($d2));
112
- $scope->assertSame('1 másodperccel korábban', $d2->diffForHumans($d));
113
- $d = Carbon::now()->addSecond(2);
114
- $d2 = Carbon::now();
115
- $scope->assertSame('2 másodperccel később', $d->diffForHumans($d2));
116
- $scope->assertSame('2 másodperccel korábban', $d2->diffForHumans($d));
117
-
118
- $d = Carbon::now()->addMinute();
119
- $d2 = Carbon::now();
120
- $scope->assertSame('1 perccel később', $d->diffForHumans($d2));
121
- $scope->assertSame('1 perccel korábban', $d2->diffForHumans($d));
122
- $d = Carbon::now()->addMinute(2);
123
- $d2 = Carbon::now();
124
- $scope->assertSame('2 perccel később', $d->diffForHumans($d2));
125
- $scope->assertSame('2 perccel korábban', $d2->diffForHumans($d));
126
-
127
- $d = Carbon::now()->addHour();
128
- $d2 = Carbon::now();
129
- $scope->assertSame('1 órával később', $d->diffForHumans($d2));
130
- $scope->assertSame('1 órával korábban', $d2->diffForHumans($d));
131
- $d = Carbon::now()->addHour(2);
132
- $d2 = Carbon::now();
133
- $scope->assertSame('2 órával később', $d->diffForHumans($d2));
134
- $scope->assertSame('2 órával korábban', $d2->diffForHumans($d));
135
-
136
- $d = Carbon::now()->addDay();
137
- $d2 = Carbon::now();
138
- $scope->assertSame('1 nappal később', $d->diffForHumans($d2));
139
- $scope->assertSame('1 nappal korábban', $d2->diffForHumans($d));
140
- $d = Carbon::now()->addDay(2);
141
- $d2 = Carbon::now();
142
- $scope->assertSame('2 nappal később', $d->diffForHumans($d2));
143
- $scope->assertSame('2 nappal korábban', $d2->diffForHumans($d));
144
-
145
- $d = Carbon::now()->addWeek();
146
- $d2 = Carbon::now();
147
- $scope->assertSame('1 héttel később', $d->diffForHumans($d2));
148
- $scope->assertSame('1 héttel korábban', $d2->diffForHumans($d));
149
- $d = Carbon::now()->addWeek(2);
150
- $d2 = Carbon::now();
151
- $scope->assertSame('2 héttel később', $d->diffForHumans($d2));
152
- $scope->assertSame('2 héttel korábban', $d2->diffForHumans($d));
153
-
154
- $d = Carbon::now()->addMonth();
155
- $d2 = Carbon::now();
156
- $scope->assertSame('1 hónappal később', $d->diffForHumans($d2));
157
- $scope->assertSame('1 hónappal korábban', $d2->diffForHumans($d));
158
- $d = Carbon::now()->addMonth(2);
159
- $d2 = Carbon::now();
160
- $scope->assertSame('2 hónappal később', $d->diffForHumans($d2));
161
- $scope->assertSame('2 hónappal korábban', $d2->diffForHumans($d));
162
-
163
- $d = Carbon::now()->addYear();
164
- $d2 = Carbon::now();
165
- $scope->assertSame('1 évvel később', $d->diffForHumans($d2));
166
- $scope->assertSame('1 évvel korábban', $d2->diffForHumans($d));
167
- $d = Carbon::now()->addYear(2);
168
- $d2 = Carbon::now();
169
- $scope->assertSame('2 évvel később', $d->diffForHumans($d2));
170
- $scope->assertSame('2 évvel korábban', $d2->diffForHumans($d));
171
-
172
- $d = Carbon::now()->addSecond();
173
- $d2 = Carbon::now();
174
- $scope->assertSame('1 másodperc', $d->diffForHumans($d2, true));
175
- $scope->assertSame('2 másodperc', $d2->diffForHumans($d->addSecond(), true));
176
-
177
- $d = Carbon::now()->addMinute();
178
- $d2 = Carbon::now();
179
- $scope->assertSame('1 perc', $d->diffForHumans($d2, true));
180
- $scope->assertSame('2 perc', $d2->diffForHumans($d->addMinute(), true));
181
-
182
- $d = Carbon::now()->addHour();
183
- $d2 = Carbon::now();
184
- $scope->assertSame('1 óra', $d->diffForHumans($d2, true));
185
- $scope->assertSame('2 óra', $d2->diffForHumans($d->addHour(), true));
186
-
187
- $d = Carbon::now()->addDay();
188
- $d2 = Carbon::now();
189
- $scope->assertSame('1 nap', $d->diffForHumans($d2, true));
190
- $scope->assertSame('2 nap', $d2->diffForHumans($d->addDay(), true));
191
-
192
- $d = Carbon::now()->addWeek();
193
- $d2 = Carbon::now();
194
- $scope->assertSame('1 hét', $d->diffForHumans($d2, true));
195
- $scope->assertSame('2 hét', $d2->diffForHumans($d->addWeek(), true));
196
-
197
- $d = Carbon::now()->addMonth();
198
- $d2 = Carbon::now();
199
- $scope->assertSame('1 hónap', $d->diffForHumans($d2, true));
200
- $scope->assertSame('2 hónap', $d2->diffForHumans($d->addMonth(), true));
201
-
202
- $d = Carbon::now()->addYear();
203
- $d2 = Carbon::now();
204
- $scope->assertSame('1 év', $d->diffForHumans($d2, true));
205
- $scope->assertSame('2 év', $d2->diffForHumans($d->addYear(), true));
206
- });
207
- }
208
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/HyTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class HyTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInArmenian()
20
- {
21
- Carbon::setLocale('hy');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 վայրկյան առաջ', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 վայրկյան առաջ', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 րոպե առաջ', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 րոպե առաջ', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 ժամ առաջ', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 ժամ առաջ', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 օր առաջ', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 օր առաջ', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 շաբաթ առաջ', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 շաբաթ առաջ', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 ամիս առաջ', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 ամիս առաջ', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 տարի առաջ', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 տարի առաջ', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 վայրկյան հետո', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 վայրկյան հետո', $d->diffForHumans($d2));
73
- $scope->assertSame('1 վայրկյան առաջ', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 վայրկյան', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 վայրկյան', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/ItTest.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class ItTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInItalian()
20
- {
21
- Carbon::setLocale('it');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->addYear();
26
- $scope->assertSame('1 anno da adesso', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->addYears(2);
29
- $scope->assertSame('2 anni da adesso', $d->diffForHumans());
30
- });
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/JaTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class JaTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInJapanese()
20
- {
21
- Carbon::setLocale('ja');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 秒 前', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 秒 前', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 分 前', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 分 前', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 時間 前', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 時間 前', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 日 前', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 日 前', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 週間 前', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 週間 前', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 ヶ月 前', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 ヶ月 前', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 年 前', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 年 前', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('今から 1 秒', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 秒 後', $d->diffForHumans($d2));
73
- $scope->assertSame('1 秒 前', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 秒', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 秒', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/KaTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class KaTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInGeorgian()
20
- {
21
- Carbon::setLocale('ka');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 წამის უკან', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 წამის უკან', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 წუთის უკან', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 წუთის უკან', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 საათის უკან', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 საათის უკან', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 დღის უკან', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 დღის უკან', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 კვირის უკან', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 კვირის უკან', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 თვის უკან', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 თვის უკან', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 წლის უკან', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 წლის უკან', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 წამის შემდეგ', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 წამის შემდეგ', $d->diffForHumans($d2));
73
- $scope->assertSame('1 წამის უკან', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 წამის', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 წამის', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/KmTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class KmTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInKhmer()
20
- {
21
- Carbon::setLocale('km');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 វិនាទីមុន', $d->diffForHumans(null, false));
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 វិនាទីមុន', $d->diffForHumans(null, false));
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 នាទីមុន', $d->diffForHumans(null, false));
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 នាទីមុន', $d->diffForHumans(null, false));
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 ម៉ោងមុន', $d->diffForHumans(null, false));
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 ម៉ោងមុន', $d->diffForHumans(null, false));
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 ថ្ងៃមុន', $d->diffForHumans(null, false));
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 ថ្ងៃមុន', $d->diffForHumans(null, false));
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 សប្ដាហ៍មុន', $d->diffForHumans(null, false));
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 សប្ដាហ៍មុន', $d->diffForHumans(null, false));
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 ខែមុន', $d->diffForHumans(null, false));
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 ខែមុន', $d->diffForHumans(null, false));
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 ឆ្នាំមុន', $d->diffForHumans(null, false));
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 ឆ្នាំមុន', $d->diffForHumans(null, false));
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 វិនាទីពី​ឥឡូវ', $d->diffForHumans(null, false));
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('នៅ​ក្រោយ 1 វិនាទី', $d->diffForHumans($d2, false, true));
73
- $scope->assertSame('នៅ​មុន 1 វិនាទី', $d2->diffForHumans($d, false, true));
74
-
75
- $scope->assertSame('1 វិនាទី', $d->diffForHumans($d2, true, true));
76
- $scope->assertSame('2 វិនាទី', $d2->diffForHumans($d->addSecond(), true, true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/KoTest.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class KoTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInKorean()
20
- {
21
- Carbon::setLocale('ko');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->addYear();
26
- $scope->assertSame('1 년 후', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->addYears(2);
29
- $scope->assertSame('2 년 후', $d->diffForHumans());
30
- });
31
- }
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/LtTest.php DELETED
@@ -1,128 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class LtTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInLithuanian()
20
- {
21
- Carbon::setLocale('lt');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('prieš 1 sekundę', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('prieš 2 sekundes', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subSeconds(21);
32
- $scope->assertSame('prieš 21 sekundę', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinute();
35
- $scope->assertSame('prieš 1 minutę', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subMinutes(2);
38
- $scope->assertSame('prieš 2 minutes', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHour();
41
- $scope->assertSame('prieš 1 valandą', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subHours(2);
44
- $scope->assertSame('prieš 2 valandas', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subHours(21);
47
- $scope->assertSame('prieš 21 valandą', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subDay();
50
- $scope->assertSame('prieš 1 dieną', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subDays(2);
53
- $scope->assertSame('prieš 2 dienas', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subWeek();
56
- $scope->assertSame('prieš 1 savaitę', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subWeeks(2);
59
- $scope->assertSame('prieš 2 savaites', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subMonth();
62
- $scope->assertSame('prieš 1 mėnesį', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subMonths(2);
65
- $scope->assertSame('prieš 2 mėnesius', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->subYear();
68
- $scope->assertSame('prieš 1 metus', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->subYears(2);
71
- $scope->assertSame('prieš 2 metus', $d->diffForHumans());
72
-
73
- $d = Carbon::now()->addSecond();
74
- $scope->assertSame('už 1 sekundės', $d->diffForHumans());
75
-
76
- $d = Carbon::now()->addSeconds(21);
77
- $scope->assertSame('už 21 sekundės', $d->diffForHumans());
78
-
79
- $d = Carbon::now()->addSeconds(15);
80
- $scope->assertSame('už 15 sekundžių', $d->diffForHumans());
81
-
82
- $d = Carbon::now()->addMinute();
83
- $scope->assertSame('už 1 minutės', $d->diffForHumans());
84
-
85
- $d = Carbon::now()->addMinutes(15);
86
- $scope->assertSame('už 15 minučių', $d->diffForHumans());
87
-
88
- $d = Carbon::now()->addMinutes(21);
89
- $scope->assertSame('už 21 minutės', $d->diffForHumans());
90
-
91
- $d = Carbon::now()->addHour();
92
- $scope->assertSame('už 1 valandos', $d->diffForHumans());
93
-
94
- $d = Carbon::now()->addHours(15);
95
- $scope->assertSame('už 15 valandų', $d->diffForHumans());
96
-
97
- $d = Carbon::now()->addHours(21);
98
- $scope->assertSame('už 21 valandos', $d->diffForHumans());
99
-
100
- $d = Carbon::now()->addDay();
101
- $scope->assertSame('už 1 dienos', $d->diffForHumans());
102
-
103
- $d = Carbon::now()->addDays(2);
104
- $scope->assertSame('už 2 dienų', $d->diffForHumans());
105
-
106
- $d = Carbon::now()->addWeek();
107
- $scope->assertSame('už 1 savaitės', $d->diffForHumans());
108
-
109
- $d = Carbon::now()->addWeek(2);
110
- $scope->assertSame('už 2 savaičių', $d->diffForHumans());
111
-
112
- $d = Carbon::now()->addMonth();
113
- $scope->assertSame('už 1 mėnesio', $d->diffForHumans());
114
-
115
- $d = Carbon::now()->addMonths(2);
116
- $scope->assertSame('už 2 mėnesių', $d->diffForHumans());
117
-
118
- $d = Carbon::now()->addMonths(11);
119
- $scope->assertSame('už 11 mėnesių', $d->diffForHumans());
120
-
121
- $d = Carbon::now()->addYear();
122
- $scope->assertSame('už 1 metų', $d->diffForHumans());
123
-
124
- $d = Carbon::now()->addYears(10);
125
- $scope->assertSame('už 10 metų', $d->diffForHumans());
126
- });
127
- }
128
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/MkTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class MkTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInMacedonian()
20
- {
21
- Carbon::setLocale('mk');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('пред 1 секунда', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(3);
29
- $scope->assertSame('пред 3 секунди', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('пред 1 минута', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('пред 2 минути', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('пред 1 час', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('пред 2 часа', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('пред 1 ден', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('пред 2 дена', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('пред 1 седмица', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('пред 2 седмици', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('пред 1 месец', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('пред 2 месеци', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('пред 1 година', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('пред 2 години', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 секунда од сега', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('по 1 секунда', $d->diffForHumans($d2));
73
- $scope->assertSame('пред 1 секунда', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 секунда', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 секунди', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/NlTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class NlTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInDutch()
20
- {
21
- Carbon::setLocale('nl');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 seconde geleden', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 seconden geleden', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 minuut geleden', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 minuten geleden', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 uur geleden', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 uur geleden', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 dag geleden', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 dagen geleden', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 week geleden', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 weken geleden', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 maand geleden', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 maanden geleden', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 jaar geleden', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 jaar geleden', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('over 1 seconde', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 seconde later', $d->diffForHumans($d2));
73
- $scope->assertSame('1 seconde eerder', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 seconde', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 seconden', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/PtTest.php DELETED
@@ -1,198 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class PtTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInPortuguese()
20
- {
21
- Carbon::setLocale('pt');
22
- $scope = $this;
23
- $this->wrapWithNonDstDate(function () use ($scope) {
24
- $d = Carbon::now()->subSecond();
25
- $scope->assertSame('1 segundo atrás', $d->diffForHumans());
26
-
27
- $d = Carbon::now()->subSeconds(2);
28
- $scope->assertSame('2 segundos atrás', $d->diffForHumans());
29
-
30
- $d = Carbon::now()->subMinute();
31
- $scope->assertSame('1 minuto atrás', $d->diffForHumans());
32
-
33
- $d = Carbon::now()->subMinutes(2);
34
- $scope->assertSame('2 minutos atrás', $d->diffForHumans());
35
-
36
- $d = Carbon::now()->subHour();
37
- $scope->assertSame('1 hora atrás', $d->diffForHumans());
38
-
39
- $d = Carbon::now()->subHours(2);
40
- $scope->assertSame('2 horas atrás', $d->diffForHumans());
41
-
42
- $d = Carbon::now()->subDay();
43
- $scope->assertSame('1 dia atrás', $d->diffForHumans());
44
-
45
- $d = Carbon::now()->subDays(2);
46
- $scope->assertSame('2 dias atrás', $d->diffForHumans());
47
-
48
- $d = Carbon::now()->subWeek();
49
- $scope->assertSame('1 semana atrás', $d->diffForHumans());
50
-
51
- $d = Carbon::now()->subWeeks(2);
52
- $scope->assertSame('2 semanas atrás', $d->diffForHumans());
53
-
54
- $d = Carbon::now()->subMonth();
55
- $scope->assertSame('1 mês atrás', $d->diffForHumans());
56
-
57
- $d = Carbon::now()->subMonths(2);
58
- $scope->assertSame('2 meses atrás', $d->diffForHumans());
59
-
60
- $d = Carbon::now()->subYear();
61
- $scope->assertSame('1 ano atrás', $d->diffForHumans());
62
-
63
- $d = Carbon::now()->subYears(2);
64
- $scope->assertSame('2 anos atrás', $d->diffForHumans());
65
-
66
- $d = Carbon::now()->addSecond();
67
- $scope->assertSame('em 1 segundo', $d->diffForHumans());
68
-
69
- $d = Carbon::now()->addSecond();
70
- $d2 = Carbon::now();
71
- $scope->assertSame('1 segundo depois', $d->diffForHumans($d2));
72
- $scope->assertSame('1 segundo antes', $d2->diffForHumans($d));
73
-
74
- $scope->assertSame('1 segundo', $d->diffForHumans($d2, true));
75
- $scope->assertSame('2 segundos', $d2->diffForHumans($d->addSecond(), true));
76
- });
77
- }
78
-
79
- public function testDiffForHumansLocalizedInPortugueseBrazil()
80
- {
81
- Carbon::setLocale('pt-BR');
82
- $scope = $this;
83
- $this->wrapWithNonDstDate(function () use ($scope) {
84
- $d = Carbon::now()->subSecond();
85
- $scope->assertSame('há 1 segundo', $d->diffForHumans());
86
-
87
- $d = Carbon::now()->subSeconds(2);
88
- $scope->assertSame('há 2 segundos', $d->diffForHumans());
89
-
90
- $d = Carbon::now()->subMinute();
91
- $scope->assertSame('há 1 minuto', $d->diffForHumans());
92
-
93
- $d = Carbon::now()->subMinutes(2);
94
- $scope->assertSame('há 2 minutos', $d->diffForHumans());
95
-
96
- $d = Carbon::now()->subHour();
97
- $scope->assertSame('há 1 hora', $d->diffForHumans());
98
-
99
- $d = Carbon::now()->subHours(2);
100
- $scope->assertSame('há 2 horas', $d->diffForHumans());
101
-
102
- $d = Carbon::now()->subDay();
103
- $scope->assertSame('há 1 dia', $d->diffForHumans());
104
-
105
- $d = Carbon::now()->subDays(2);
106
- $scope->assertSame('há 2 dias', $d->diffForHumans());
107
-
108
- $d = Carbon::now()->subWeek();
109
- $scope->assertSame('há 1 semana', $d->diffForHumans());
110
-
111
- $d = Carbon::now()->subWeeks(2);
112
- $scope->assertSame('há 2 semanas', $d->diffForHumans());
113
-
114
- $d = Carbon::now()->subMonth();
115
- $scope->assertSame('há 1 mês', $d->diffForHumans());
116
-
117
- $d = Carbon::now()->subMonths(2);
118
- $scope->assertSame('há 2 meses', $d->diffForHumans());
119
-
120
- $d = Carbon::now()->subYear();
121
- $scope->assertSame('há 1 ano', $d->diffForHumans());
122
-
123
- $d = Carbon::now()->subYears(2);
124
- $scope->assertSame('há 2 anos', $d->diffForHumans());
125
-
126
- $d = Carbon::now()->addSecond();
127
- $scope->assertSame('em 1 segundo', $d->diffForHumans());
128
-
129
- $d = Carbon::now()->addSecond();
130
- $d2 = Carbon::now();
131
- $scope->assertSame('após 1 segundo', $d->diffForHumans($d2));
132
- $scope->assertSame('1 segundo atrás', $d2->diffForHumans($d));
133
-
134
- $scope->assertSame('1 segundo', $d->diffForHumans($d2, true));
135
- $scope->assertSame('2 segundos', $d2->diffForHumans($d->addSecond(), true));
136
- });
137
- }
138
-
139
- public function testDiffForHumansLocalizedInPortugueseBrazilBC()
140
- {
141
- Carbon::setLocale('pt_BR');
142
- $scope = $this;
143
- $this->wrapWithNonDstDate(function () use ($scope) {
144
- $d = Carbon::now()->subSecond();
145
- $scope->assertSame('há 1 segundo', $d->diffForHumans());
146
-
147
- $d = Carbon::now()->subSeconds(2);
148
- $scope->assertSame('há 2 segundos', $d->diffForHumans());
149
-
150
- $d = Carbon::now()->subMinute();
151
- $scope->assertSame('há 1 minuto', $d->diffForHumans());
152
-
153
- $d = Carbon::now()->subMinutes(2);
154
- $scope->assertSame('há 2 minutos', $d->diffForHumans());
155
-
156
- $d = Carbon::now()->subHour();
157
- $scope->assertSame('há 1 hora', $d->diffForHumans());
158
-
159
- $d = Carbon::now()->subHours(2);
160
- $scope->assertSame('há 2 horas', $d->diffForHumans());
161
-
162
- $d = Carbon::now()->subDay();
163
- $scope->assertSame('há 1 dia', $d->diffForHumans());
164
-
165
- $d = Carbon::now()->subDays(2);
166
- $scope->assertSame('há 2 dias', $d->diffForHumans());
167
-
168
- $d = Carbon::now()->subWeek();
169
- $scope->assertSame('há 1 semana', $d->diffForHumans());
170
-
171
- $d = Carbon::now()->subWeeks(2);
172
- $scope->assertSame('há 2 semanas', $d->diffForHumans());
173
-
174
- $d = Carbon::now()->subMonth();
175
- $scope->assertSame('há 1 mês', $d->diffForHumans());
176
-
177
- $d = Carbon::now()->subMonths(2);
178
- $scope->assertSame('há 2 meses', $d->diffForHumans());
179
-
180
- $d = Carbon::now()->subYear();
181
- $scope->assertSame('há 1 ano', $d->diffForHumans());
182
-
183
- $d = Carbon::now()->subYears(2);
184
- $scope->assertSame('há 2 anos', $d->diffForHumans());
185
-
186
- $d = Carbon::now()->addSecond();
187
- $scope->assertSame('em 1 segundo', $d->diffForHumans());
188
-
189
- $d = Carbon::now()->addSecond();
190
- $d2 = Carbon::now();
191
- $scope->assertSame('após 1 segundo', $d->diffForHumans($d2));
192
- $scope->assertSame('1 segundo atrás', $d2->diffForHumans($d));
193
-
194
- $scope->assertSame('1 segundo', $d->diffForHumans($d2, true));
195
- $scope->assertSame('2 segundos', $d2->diffForHumans($d->addSecond(), true));
196
- });
197
- }
198
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/SrMeTest.php DELETED
@@ -1,985 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class SrMeTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInMontenegrinLatin()
20
- {
21
- Carbon::setLocale('sr-ME');
22
- $this->diffForHumansLocalizedInMontenegrinLatin();
23
-
24
- Carbon::setLocale('sr-Latn-ME');
25
- $this->diffForHumansLocalizedInMontenegrinLatin();
26
- }
27
-
28
- protected function DiffForHumansLocalizedInMontenegrinLatin()
29
- {
30
- $scope = $this;
31
- $this->wrapWithNonDstDate(function () use ($scope) {
32
-
33
- /*
34
- * Year
35
- */
36
- $d = Carbon::now()->addYear();
37
- $scope->assertSame('za 1 godinu', $d->diffForHumans());
38
- $scope->assertSame('1 godina', $d->diffForHumans(null, true));
39
- $scope->assertSame('za 1 g.', $d->diffForHumans(null, false, true));
40
- $scope->assertSame('1 g.', $d->diffForHumans(null, true, true));
41
-
42
- $d = Carbon::now()->addYears(2);
43
- $scope->assertSame('za 2 godine', $d->diffForHumans());
44
- $scope->assertSame('2 godine', $d->diffForHumans(null, true));
45
- $scope->assertSame('za 2 g.', $d->diffForHumans(null, false, true));
46
- $scope->assertSame('2 g.', $d->diffForHumans(null, true, true));
47
-
48
- $d = Carbon::now()->addYears(5);
49
- $scope->assertSame('za 5 godina', $d->diffForHumans());
50
- $scope->assertSame('5 godina', $d->diffForHumans(null, true));
51
- $scope->assertSame('za 5 g.', $d->diffForHumans(null, false, true));
52
- $scope->assertSame('5 g.', $d->diffForHumans(null, true, true));
53
-
54
- $d = Carbon::now()->subYear();
55
- $scope->assertSame('1 godina nakon', Carbon::now()->diffForHumans($d));
56
-
57
- $d = Carbon::now()->subYears(2);
58
- $scope->assertSame('2 godine nakon', Carbon::now()->diffForHumans($d));
59
-
60
- $d = Carbon::now()->subYears(5);
61
- $scope->assertSame('5 godina nakon', Carbon::now()->diffForHumans($d));
62
-
63
- $d = Carbon::now()->addYear();
64
- $scope->assertSame('1 godina prije', Carbon::now()->diffForHumans($d));
65
-
66
- $d = Carbon::now()->addYears(2);
67
- $scope->assertSame('2 godine prije', Carbon::now()->diffForHumans($d));
68
-
69
- $d = Carbon::now()->addYears(5);
70
- $scope->assertSame('5 godina prije', Carbon::now()->diffForHumans($d));
71
-
72
- $d = Carbon::now()->subYear();
73
- $scope->assertSame('prije 1 godinu', $d->diffForHumans());
74
-
75
- $d = Carbon::now()->subYears(2);
76
- $scope->assertSame('prije 2 godine', $d->diffForHumans());
77
-
78
- $d = Carbon::now()->subYears(5);
79
- $scope->assertSame('prije 5 godina', $d->diffForHumans());
80
-
81
- /*
82
- * Month
83
- */
84
- $d = Carbon::now()->addMonth();
85
- $scope->assertSame('za 1 mjesec', $d->diffForHumans());
86
- $scope->assertSame('1 mjesec', $d->diffForHumans(null, true));
87
- $scope->assertSame('za 1 mj.', $d->diffForHumans(null, false, true));
88
- $scope->assertSame('1 mj.', $d->diffForHumans(null, true, true));
89
-
90
- $d = Carbon::now()->addMonths(2);
91
- $scope->assertSame('za 2 mjeseca', $d->diffForHumans());
92
- $scope->assertSame('2 mjeseca', $d->diffForHumans(null, true));
93
- $scope->assertSame('za 2 mj.', $d->diffForHumans(null, false, true));
94
- $scope->assertSame('2 mj.', $d->diffForHumans(null, true, true));
95
-
96
- $d = Carbon::now()->addMonths(5);
97
- $scope->assertSame('za 5 mjeseci', $d->diffForHumans());
98
- $scope->assertSame('5 mjeseci', $d->diffForHumans(null, true));
99
- $scope->assertSame('za 5 mj.', $d->diffForHumans(null, false, true));
100
- $scope->assertSame('5 mj.', $d->diffForHumans(null, true, true));
101
-
102
- $d = Carbon::now()->subMonth();
103
- $scope->assertSame('1 mjesec nakon', Carbon::now()->diffForHumans($d));
104
-
105
- $d = Carbon::now()->subMonths(2);
106
- $scope->assertSame('2 mjeseca nakon', Carbon::now()->diffForHumans($d));
107
-
108
- $d = Carbon::now()->subMonths(5);
109
- $scope->assertSame('5 mjeseci nakon', Carbon::now()->diffForHumans($d));
110
-
111
- $d = Carbon::now()->addMonth();
112
- $scope->assertSame('1 mjesec prije', Carbon::now()->diffForHumans($d));
113
-
114
- $d = Carbon::now()->addMonths(2);
115
- $scope->assertSame('2 mjeseca prije', Carbon::now()->diffForHumans($d));
116
-
117
- $d = Carbon::now()->addMonths(5);
118
- $scope->assertSame('5 mjeseci prije', Carbon::now()->diffForHumans($d));
119
-
120
- $d = Carbon::now()->subMonth();
121
- $scope->assertSame('prije 1 mjesec', $d->diffForHumans());
122
-
123
- $d = Carbon::now()->subMonths(2);
124
- $scope->assertSame('prije 2 mjeseca', $d->diffForHumans());
125
-
126
- $d = Carbon::now()->subMonths(5);
127
- $scope->assertSame('prije 5 mjeseci', $d->diffForHumans());
128
-
129
- /*
130
- * Week
131
- */
132
- $d = Carbon::now()->addWeek();
133
- $scope->assertSame('za 1 nedjelju', $d->diffForHumans());
134
- $scope->assertSame('1 nedjelja', $d->diffForHumans(null, true));
135
- $scope->assertSame('za 1 ned.', $d->diffForHumans(null, false, true));
136
- $scope->assertSame('1 ned.', $d->diffForHumans(null, true, true));
137
-
138
- $d = Carbon::now()->addWeeks(2);
139
- $scope->assertSame('za 2 nedjelje', $d->diffForHumans());
140
- $scope->assertSame('2 nedjelje', $d->diffForHumans(null, true));
141
- $scope->assertSame('za 2 ned.', $d->diffForHumans(null, false, true));
142
- $scope->assertSame('2 ned.', $d->diffForHumans(null, true, true));
143
-
144
- $d = Carbon::now()->subWeek();
145
- $scope->assertSame('1 nedjelja nakon', Carbon::now()->diffForHumans($d));
146
-
147
- $d = Carbon::now()->subWeeks(2);
148
- $scope->assertSame('2 nedjelje nakon', Carbon::now()->diffForHumans($d));
149
-
150
- $d = Carbon::now()->addWeek();
151
- $scope->assertSame('1 nedjelja prije', Carbon::now()->diffForHumans($d));
152
-
153
- $d = Carbon::now()->addWeeks(2);
154
- $scope->assertSame('2 nedjelje prije', Carbon::now()->diffForHumans($d));
155
-
156
- $d = Carbon::now()->subWeek();
157
- $scope->assertSame('prije 1 nedjelju', $d->diffForHumans());
158
-
159
- $d = Carbon::now()->subWeeks(2);
160
- $scope->assertSame('prije 2 nedjelje', $d->diffForHumans());
161
-
162
- /*
163
- * Day
164
- */
165
- $d = Carbon::now()->addDay();
166
- $scope->assertSame('za 1 dan', $d->diffForHumans());
167
- $scope->assertSame('1 dan', $d->diffForHumans(null, true));
168
- $scope->assertSame('za 1 d.', $d->diffForHumans(null, false, true));
169
- $scope->assertSame('1 d.', $d->diffForHumans(null, true, true));
170
-
171
- $d = Carbon::now()->addDays(2);
172
- $scope->assertSame('za 2 dana', $d->diffForHumans());
173
- $scope->assertSame('2 dana', $d->diffForHumans(null, true));
174
- $scope->assertSame('za 2 d.', $d->diffForHumans(null, false, true));
175
- $scope->assertSame('2 d.', $d->diffForHumans(null, true, true));
176
-
177
- $d = Carbon::now()->subDay();
178
- $scope->assertSame('1 dan nakon', Carbon::now()->diffForHumans($d));
179
-
180
- $d = Carbon::now()->subDays(2);
181
- $scope->assertSame('2 dana nakon', Carbon::now()->diffForHumans($d));
182
-
183
- $d = Carbon::now()->addDay();
184
- $scope->assertSame('1 dan prije', Carbon::now()->diffForHumans($d));
185
-
186
- $d = Carbon::now()->addDays(2);
187
- $scope->assertSame('2 dana prije', Carbon::now()->diffForHumans($d));
188
-
189
- $d = Carbon::now()->subDay();
190
- $scope->assertSame('prije 1 dan', $d->diffForHumans());
191
-
192
- $d = Carbon::now()->subDays(2);
193
- $scope->assertSame('prije 2 dana', $d->diffForHumans());
194
-
195
- /*
196
- * Hour
197
- */
198
- $d = Carbon::now()->addHour();
199
- $scope->assertSame('za 1 sat', $d->diffForHumans());
200
- $scope->assertSame('1 sat', $d->diffForHumans(null, true));
201
- $scope->assertSame('za 1 č.', $d->diffForHumans(null, false, true));
202
- $scope->assertSame('1 č.', $d->diffForHumans(null, true, true));
203
-
204
- $d = Carbon::now()->addHours(2);
205
- $scope->assertSame('za 2 sata', $d->diffForHumans());
206
- $scope->assertSame('2 sata', $d->diffForHumans(null, true));
207
- $scope->assertSame('za 2 č.', $d->diffForHumans(null, false, true));
208
- $scope->assertSame('2 č.', $d->diffForHumans(null, true, true));
209
-
210
- $d = Carbon::now()->addHours(5);
211
- $scope->assertSame('za 5 sati', $d->diffForHumans());
212
- $scope->assertSame('5 sati', $d->diffForHumans(null, true));
213
- $scope->assertSame('za 5 č.', $d->diffForHumans(null, false, true));
214
- $scope->assertSame('5 č.', $d->diffForHumans(null, true, true));
215
-
216
- $d = Carbon::now()->addHours(19);
217
- $scope->assertSame('za 19 sati', $d->diffForHumans());
218
- $scope->assertSame('19 sati', $d->diffForHumans(null, true));
219
- $scope->assertSame('za 19 č.', $d->diffForHumans(null, false, true));
220
- $scope->assertSame('19 č.', $d->diffForHumans(null, true, true));
221
-
222
- $d = Carbon::now()->addHours(20);
223
- $scope->assertSame('za 20 sati', $d->diffForHumans());
224
- $scope->assertSame('20 sati', $d->diffForHumans(null, true));
225
- $scope->assertSame('za 20 č.', $d->diffForHumans(null, false, true));
226
- $scope->assertSame('20 č.', $d->diffForHumans(null, true, true));
227
-
228
- $d = Carbon::now()->addHours(21);
229
- $scope->assertSame('za 21 sat', $d->diffForHumans());
230
- $scope->assertSame('21 sat', $d->diffForHumans(null, true));
231
- $scope->assertSame('za 21 č.', $d->diffForHumans(null, false, true));
232
- $scope->assertSame('21 č.', $d->diffForHumans(null, true, true));
233
-
234
- $d = Carbon::now()->addHours(22);
235
- $scope->assertSame('za 22 sata', $d->diffForHumans());
236
- $scope->assertSame('22 sata', $d->diffForHumans(null, true));
237
- $scope->assertSame('za 22 č.', $d->diffForHumans(null, false, true));
238
- $scope->assertSame('22 č.', $d->diffForHumans(null, true, true));
239
-
240
- $d = Carbon::now()->addHours(23);
241
- $scope->assertSame('za 23 sata', $d->diffForHumans());
242
- $scope->assertSame('23 sata', $d->diffForHumans(null, true));
243
- $scope->assertSame('za 23 č.', $d->diffForHumans(null, false, true));
244
- $scope->assertSame('23 č.', $d->diffForHumans(null, true, true));
245
-
246
- $d = Carbon::now()->subHour();
247
- $scope->assertSame('1 sat nakon', Carbon::now()->diffForHumans($d));
248
-
249
- $d = Carbon::now()->subHours(2);
250
- $scope->assertSame('2 sata nakon', Carbon::now()->diffForHumans($d));
251
-
252
- $d = Carbon::now()->subHours(5);
253
- $scope->assertSame('5 sati nakon', Carbon::now()->diffForHumans($d));
254
-
255
- $d = Carbon::now()->subHours(19);
256
- $scope->assertSame('19 sati nakon', Carbon::now()->diffForHumans($d));
257
-
258
- $d = Carbon::now()->subHours(20);
259
- $scope->assertSame('20 sati nakon', Carbon::now()->diffForHumans($d));
260
-
261
- $d = Carbon::now()->subHours(21);
262
- $scope->assertSame('21 sat nakon', Carbon::now()->diffForHumans($d));
263
-
264
- $d = Carbon::now()->subHours(22);
265
- $scope->assertSame('22 sata nakon', Carbon::now()->diffForHumans($d));
266
-
267
- $d = Carbon::now()->subHours(23);
268
- $scope->assertSame('23 sata nakon', Carbon::now()->diffForHumans($d));
269
-
270
- $d = Carbon::now()->addHour();
271
- $scope->assertSame('1 sat prije', Carbon::now()->diffForHumans($d));
272
-
273
- $d = Carbon::now()->addHours(2);
274
- $scope->assertSame('2 sata prije', Carbon::now()->diffForHumans($d));
275
-
276
- $d = Carbon::now()->addHours(5);
277
- $scope->assertSame('5 sati prije', Carbon::now()->diffForHumans($d));
278
-
279
- $d = Carbon::now()->addHours(19);
280
- $scope->assertSame('19 sati prije', Carbon::now()->diffForHumans($d));
281
-
282
- $d = Carbon::now()->addHours(20);
283
- $scope->assertSame('20 sati prije', Carbon::now()->diffForHumans($d));
284
-
285
- $d = Carbon::now()->addHours(21);
286
- $scope->assertSame('21 sat prije', Carbon::now()->diffForHumans($d));
287
-
288
- $d = Carbon::now()->addHours(22);
289
- $scope->assertSame('22 sata prije', Carbon::now()->diffForHumans($d));
290
-
291
- $d = Carbon::now()->addHours(23);
292
- $scope->assertSame('23 sata prije', Carbon::now()->diffForHumans($d));
293
-
294
- $d = Carbon::now()->subHour();
295
- $scope->assertSame('prije 1 sat', $d->diffForHumans());
296
-
297
- $d = Carbon::now()->subHours(2);
298
- $scope->assertSame('prije 2 sata', $d->diffForHumans());
299
-
300
- $d = Carbon::now()->subHours(5);
301
- $scope->assertSame('prije 5 sati', $d->diffForHumans());
302
-
303
- $d = Carbon::now()->subHours(19);
304
- $scope->assertSame('prije 19 sati', $d->diffForHumans());
305
-
306
- $d = Carbon::now()->subHours(20);
307
- $scope->assertSame('prije 20 sati', $d->diffForHumans());
308
-
309
- $d = Carbon::now()->subHours(21);
310
- $scope->assertSame('prije 21 sat', $d->diffForHumans());
311
-
312
- $d = Carbon::now()->subHours(22);
313
- $scope->assertSame('prije 22 sata', $d->diffForHumans());
314
-
315
- $d = Carbon::now()->subHours(23);
316
- $scope->assertSame('prije 23 sata', $d->diffForHumans());
317
-
318
- /*
319
- * Minute
320
- */
321
- $d = Carbon::now()->addMinute();
322
- $scope->assertSame('za 1 minut', $d->diffForHumans());
323
- $scope->assertSame('1 minut', $d->diffForHumans(null, true));
324
- $scope->assertSame('za 1 min.', $d->diffForHumans(null, false, true));
325
- $scope->assertSame('1 min.', $d->diffForHumans(null, true, true));
326
-
327
- $d = Carbon::now()->addMinutes(2);
328
- $scope->assertSame('za 2 minuta', $d->diffForHumans());
329
- $scope->assertSame('2 minuta', $d->diffForHumans(null, true));
330
- $scope->assertSame('za 2 min.', $d->diffForHumans(null, false, true));
331
- $scope->assertSame('2 min.', $d->diffForHumans(null, true, true));
332
-
333
- $d = Carbon::now()->addMinutes(21);
334
- $scope->assertSame('za 21 minut', $d->diffForHumans());
335
- $scope->assertSame('21 minut', $d->diffForHumans(null, true));
336
- $scope->assertSame('za 21 min.', $d->diffForHumans(null, false, true));
337
- $scope->assertSame('21 min.', $d->diffForHumans(null, true, true));
338
-
339
- $d = Carbon::now()->addMinutes(31);
340
- $scope->assertSame('za 31 minut', $d->diffForHumans());
341
- $scope->assertSame('31 minut', $d->diffForHumans(null, true));
342
- $scope->assertSame('za 31 min.', $d->diffForHumans(null, false, true));
343
- $scope->assertSame('31 min.', $d->diffForHumans(null, true, true));
344
-
345
- $d = Carbon::now()->addMinutes(41);
346
- $scope->assertSame('za 41 minut', $d->diffForHumans());
347
- $scope->assertSame('41 minut', $d->diffForHumans(null, true));
348
- $scope->assertSame('za 41 min.', $d->diffForHumans(null, false, true));
349
- $scope->assertSame('41 min.', $d->diffForHumans(null, true, true));
350
-
351
- $d = Carbon::now()->addMinutes(51);
352
- $scope->assertSame('za 51 minut', $d->diffForHumans());
353
- $scope->assertSame('51 minut', $d->diffForHumans(null, true));
354
- $scope->assertSame('za 51 min.', $d->diffForHumans(null, false, true));
355
- $scope->assertSame('51 min.', $d->diffForHumans(null, true, true));
356
-
357
- $d = Carbon::now()->subMinute();
358
- $scope->assertSame('1 minut nakon', Carbon::now()->diffForHumans($d));
359
-
360
- $d = Carbon::now()->subMinutes(2);
361
- $scope->assertSame('2 minuta nakon', Carbon::now()->diffForHumans($d));
362
-
363
- $d = Carbon::now()->subMinutes(21);
364
- $scope->assertSame('21 minut nakon', Carbon::now()->diffForHumans($d));
365
-
366
- $d = Carbon::now()->subMinutes(31);
367
- $scope->assertSame('31 minut nakon', Carbon::now()->diffForHumans($d));
368
-
369
- $d = Carbon::now()->subMinutes(41);
370
- $scope->assertSame('41 minut nakon', Carbon::now()->diffForHumans($d));
371
-
372
- $d = Carbon::now()->subMinutes(51);
373
- $scope->assertSame('51 minut nakon', Carbon::now()->diffForHumans($d));
374
-
375
- $d = Carbon::now()->addMinute();
376
- $scope->assertSame('1 minut prije', Carbon::now()->diffForHumans($d));
377
-
378
- $d = Carbon::now()->addMinutes(2);
379
- $scope->assertSame('2 minuta prije', Carbon::now()->diffForHumans($d));
380
-
381
- $d = Carbon::now()->addMinutes(21);
382
- $scope->assertSame('21 minut prije', Carbon::now()->diffForHumans($d));
383
-
384
- $d = Carbon::now()->addMinutes(31);
385
- $scope->assertSame('31 minut prije', Carbon::now()->diffForHumans($d));
386
-
387
- $d = Carbon::now()->addMinutes(41);
388
- $scope->assertSame('41 minut prije', Carbon::now()->diffForHumans($d));
389
-
390
- $d = Carbon::now()->addMinutes(51);
391
- $scope->assertSame('51 minut prije', Carbon::now()->diffForHumans($d));
392
-
393
- $d = Carbon::now()->subMinute();
394
- $scope->assertSame('prije 1 minut', $d->diffForHumans());
395
-
396
- $d = Carbon::now()->subMinutes(2);
397
- $scope->assertSame('prije 2 minuta', $d->diffForHumans());
398
-
399
- $d = Carbon::now()->subMinutes(21);
400
- $scope->assertSame('prije 21 minut', $d->diffForHumans());
401
-
402
- $d = Carbon::now()->subMinutes(31);
403
- $scope->assertSame('prije 31 minut', $d->diffForHumans());
404
-
405
- $d = Carbon::now()->subMinutes(41);
406
- $scope->assertSame('prije 41 minut', $d->diffForHumans());
407
-
408
- $d = Carbon::now()->subMinutes(51);
409
- $scope->assertSame('prije 51 minut', $d->diffForHumans());
410
-
411
- /*
412
- * Second
413
- */
414
- $d = Carbon::now()->addSecond();
415
- $scope->assertSame('za 1 sekund', $d->diffForHumans());
416
- $scope->assertSame('1 sekund', $d->diffForHumans(null, true));
417
- $scope->assertSame('za 1 sek.', $d->diffForHumans(null, false, true));
418
- $scope->assertSame('1 sek.', $d->diffForHumans(null, true, true));
419
-
420
- $d = Carbon::now()->addSeconds(2);
421
- $scope->assertSame('za 2 sekunde', $d->diffForHumans());
422
- $scope->assertSame('2 sekunde', $d->diffForHumans(null, true));
423
- $scope->assertSame('za 2 sek.', $d->diffForHumans(null, false, true));
424
- $scope->assertSame('2 sek.', $d->diffForHumans(null, true, true));
425
-
426
- $d = Carbon::now()->addSeconds(21);
427
- $scope->assertSame('za 21 sekund', $d->diffForHumans());
428
- $scope->assertSame('21 sekund', $d->diffForHumans(null, true));
429
- $scope->assertSame('za 21 sek.', $d->diffForHumans(null, false, true));
430
- $scope->assertSame('21 sek.', $d->diffForHumans(null, true, true));
431
-
432
- $d = Carbon::now()->addSeconds(31);
433
- $scope->assertSame('za 31 sekund', $d->diffForHumans());
434
- $scope->assertSame('31 sekund', $d->diffForHumans(null, true));
435
- $scope->assertSame('za 31 sek.', $d->diffForHumans(null, false, true));
436
- $scope->assertSame('31 sek.', $d->diffForHumans(null, true, true));
437
-
438
- $d = Carbon::now()->addSeconds(41);
439
- $scope->assertSame('za 41 sekund', $d->diffForHumans());
440
- $scope->assertSame('41 sekund', $d->diffForHumans(null, true));
441
- $scope->assertSame('za 41 sek.', $d->diffForHumans(null, false, true));
442
- $scope->assertSame('41 sek.', $d->diffForHumans(null, true, true));
443
-
444
- $d = Carbon::now()->addSeconds(51);
445
- $scope->assertSame('za 51 sekund', $d->diffForHumans());
446
- $scope->assertSame('51 sekund', $d->diffForHumans(null, true));
447
- $scope->assertSame('za 51 sek.', $d->diffForHumans(null, false, true));
448
- $scope->assertSame('51 sek.', $d->diffForHumans(null, true, true));
449
-
450
- $d = Carbon::now()->subSecond();
451
- $scope->assertSame('1 sekund nakon', Carbon::now()->diffForHumans($d));
452
-
453
- $d = Carbon::now()->subSeconds(2);
454
- $scope->assertSame('2 sekunde nakon', Carbon::now()->diffForHumans($d));
455
-
456
- $d = Carbon::now()->subSeconds(21);
457
- $scope->assertSame('21 sekund nakon', Carbon::now()->diffForHumans($d));
458
-
459
- $d = Carbon::now()->subSeconds(31);
460
- $scope->assertSame('31 sekund nakon', Carbon::now()->diffForHumans($d));
461
-
462
- $d = Carbon::now()->subSeconds(41);
463
- $scope->assertSame('41 sekund nakon', Carbon::now()->diffForHumans($d));
464
-
465
- $d = Carbon::now()->subSeconds(51);
466
- $scope->assertSame('51 sekund nakon', Carbon::now()->diffForHumans($d));
467
-
468
- $d = Carbon::now()->addSecond();
469
- $scope->assertSame('1 sekund prije', Carbon::now()->diffForHumans($d));
470
-
471
- $d = Carbon::now()->addSeconds(2);
472
- $scope->assertSame('2 sekunde prije', Carbon::now()->diffForHumans($d));
473
-
474
- $d = Carbon::now()->addSeconds(21);
475
- $scope->assertSame('21 sekund prije', Carbon::now()->diffForHumans($d));
476
-
477
- $d = Carbon::now()->addSeconds(31);
478
- $scope->assertSame('31 sekund prije', Carbon::now()->diffForHumans($d));
479
-
480
- $d = Carbon::now()->addSeconds(41);
481
- $scope->assertSame('41 sekund prije', Carbon::now()->diffForHumans($d));
482
-
483
- $d = Carbon::now()->addSeconds(51);
484
- $scope->assertSame('51 sekund prije', Carbon::now()->diffForHumans($d));
485
-
486
- $d = Carbon::now()->subSecond();
487
- $scope->assertSame('prije 1 sekund', $d->diffForHumans());
488
-
489
- $d = Carbon::now()->subSeconds(2);
490
- $scope->assertSame('prije 2 sekunde', $d->diffForHumans());
491
-
492
- $d = Carbon::now()->subSeconds(21);
493
- $scope->assertSame('prije 21 sekund', $d->diffForHumans());
494
-
495
- $d = Carbon::now()->subSeconds(31);
496
- $scope->assertSame('prije 31 sekund', $d->diffForHumans());
497
-
498
- $d = Carbon::now()->subSeconds(41);
499
- $scope->assertSame('prije 41 sekund', $d->diffForHumans());
500
-
501
- $d = Carbon::now()->subSeconds(51);
502
- $scope->assertSame('prije 51 sekund', $d->diffForHumans());
503
- });
504
- }
505
-
506
- public function testDiffForHumansLocalizedInMontenegrinCyrilic()
507
- {
508
- Carbon::setLocale('sr-Cyrl-ME');
509
-
510
- $scope = $this;
511
- $this->wrapWithNonDstDate(function () use ($scope) {
512
-
513
- /*
514
- * Year
515
- */
516
- $d = Carbon::now()->addYear();
517
- $scope->assertSame('за 1 годину', $d->diffForHumans());
518
- $scope->assertSame('1 година', $d->diffForHumans(null, true));
519
- $scope->assertSame('за 1 г.', $d->diffForHumans(null, false, true));
520
- $scope->assertSame('1 г.', $d->diffForHumans(null, true, true));
521
-
522
- $d = Carbon::now()->addYears(2);
523
- $scope->assertSame('за 2 године', $d->diffForHumans());
524
- $scope->assertSame('2 године', $d->diffForHumans(null, true));
525
- $scope->assertSame('за 2 г.', $d->diffForHumans(null, false, true));
526
- $scope->assertSame('2 г.', $d->diffForHumans(null, true, true));
527
-
528
- $d = Carbon::now()->addYears(5);
529
- $scope->assertSame('за 5 година', $d->diffForHumans());
530
- $scope->assertSame('5 година', $d->diffForHumans(null, true));
531
- $scope->assertSame('за 5 г.', $d->diffForHumans(null, false, true));
532
- $scope->assertSame('5 г.', $d->diffForHumans(null, true, true));
533
-
534
- $d = Carbon::now()->subYear();
535
- $scope->assertSame('1 година након', Carbon::now()->diffForHumans($d));
536
-
537
- $d = Carbon::now()->subYears(2);
538
- $scope->assertSame('2 године након', Carbon::now()->diffForHumans($d));
539
-
540
- $d = Carbon::now()->subYears(5);
541
- $scope->assertSame('5 година након', Carbon::now()->diffForHumans($d));
542
-
543
- $d = Carbon::now()->addYear();
544
- $scope->assertSame('1 година прије', Carbon::now()->diffForHumans($d));
545
-
546
- $d = Carbon::now()->addYears(2);
547
- $scope->assertSame('2 године прије', Carbon::now()->diffForHumans($d));
548
-
549
- $d = Carbon::now()->addYears(5);
550
- $scope->assertSame('5 година прије', Carbon::now()->diffForHumans($d));
551
-
552
- $d = Carbon::now()->subYear();
553
- $scope->assertSame('прије 1 годину', $d->diffForHumans());
554
-
555
- $d = Carbon::now()->subYears(2);
556
- $scope->assertSame('прије 2 године', $d->diffForHumans());
557
-
558
- $d = Carbon::now()->subYears(5);
559
- $scope->assertSame('прије 5 година', $d->diffForHumans());
560
-
561
- /*
562
- * Month
563
- */
564
- $d = Carbon::now()->addMonth();
565
- $scope->assertSame('за 1 мјесец', $d->diffForHumans());
566
- $scope->assertSame('1 мјесец', $d->diffForHumans(null, true));
567
- $scope->assertSame('за 1 мј.', $d->diffForHumans(null, false, true));
568
- $scope->assertSame('1 мј.', $d->diffForHumans(null, true, true));
569
-
570
- $d = Carbon::now()->addMonths(2);
571
- $scope->assertSame('за 2 мјесеца', $d->diffForHumans());
572
- $scope->assertSame('2 мјесеца', $d->diffForHumans(null, true));
573
- $scope->assertSame('за 2 мј.', $d->diffForHumans(null, false, true));
574
- $scope->assertSame('2 мј.', $d->diffForHumans(null, true, true));
575
-
576
- $d = Carbon::now()->addMonths(5);
577
- $scope->assertSame('за 5 мјесеци', $d->diffForHumans());
578
- $scope->assertSame('5 мјесеци', $d->diffForHumans(null, true));
579
- $scope->assertSame('за 5 мј.', $d->diffForHumans(null, false, true));
580
- $scope->assertSame('5 мј.', $d->diffForHumans(null, true, true));
581
-
582
- $d = Carbon::now()->subMonth();
583
- $scope->assertSame('1 мјесец након', Carbon::now()->diffForHumans($d));
584
-
585
- $d = Carbon::now()->subMonths(2);
586
- $scope->assertSame('2 мјесеца након', Carbon::now()->diffForHumans($d));
587
-
588
- $d = Carbon::now()->subMonths(5);
589
- $scope->assertSame('5 мјесеци након', Carbon::now()->diffForHumans($d));
590
-
591
- $d = Carbon::now()->addMonth();
592
- $scope->assertSame('1 мјесец прије', Carbon::now()->diffForHumans($d));
593
-
594
- $d = Carbon::now()->addMonths(2);
595
- $scope->assertSame('2 мјесеца прије', Carbon::now()->diffForHumans($d));
596
-
597
- $d = Carbon::now()->addMonths(5);
598
- $scope->assertSame('5 мјесеци прије', Carbon::now()->diffForHumans($d));
599
-
600
- $d = Carbon::now()->subMonth();
601
- $scope->assertSame('прије 1 мјесец', $d->diffForHumans());
602
-
603
- $d = Carbon::now()->subMonths(2);
604
- $scope->assertSame('прије 2 мјесеца', $d->diffForHumans());
605
-
606
- $d = Carbon::now()->subMonths(5);
607
- $scope->assertSame('прије 5 мјесеци', $d->diffForHumans());
608
-
609
- /*
610
- * Week
611
- */
612
- $d = Carbon::now()->addWeek();
613
- $scope->assertSame('за 1 недјељу', $d->diffForHumans());
614
- $scope->assertSame('1 недјеља', $d->diffForHumans(null, true));
615
- $scope->assertSame('за 1 нед.', $d->diffForHumans(null, false, true));
616
- $scope->assertSame('1 нед.', $d->diffForHumans(null, true, true));
617
-
618
- $d = Carbon::now()->addWeeks(2);
619
- $scope->assertSame('за 2 недјеље', $d->diffForHumans());
620
- $scope->assertSame('2 недјеље', $d->diffForHumans(null, true));
621
- $scope->assertSame('за 2 нед.', $d->diffForHumans(null, false, true));
622
- $scope->assertSame('2 нед.', $d->diffForHumans(null, true, true));
623
-
624
- $d = Carbon::now()->subWeek();
625
- $scope->assertSame('1 недјеља након', Carbon::now()->diffForHumans($d));
626
-
627
- $d = Carbon::now()->subWeeks(2);
628
- $scope->assertSame('2 недјеље након', Carbon::now()->diffForHumans($d));
629
-
630
- $d = Carbon::now()->addWeek();
631
- $scope->assertSame('1 недјеља прије', Carbon::now()->diffForHumans($d));
632
-
633
- $d = Carbon::now()->addWeeks(2);
634
- $scope->assertSame('2 недјеље прије', Carbon::now()->diffForHumans($d));
635
-
636
- $d = Carbon::now()->subWeek();
637
- $scope->assertSame('прије 1 недјељу', $d->diffForHumans());
638
-
639
- $d = Carbon::now()->subWeeks(2);
640
- $scope->assertSame('прије 2 недјеље', $d->diffForHumans());
641
-
642
- /*
643
- * Day
644
- */
645
- $d = Carbon::now()->addDay();
646
- $scope->assertSame('за 1 дан', $d->diffForHumans());
647
- $scope->assertSame('1 дан', $d->diffForHumans(null, true));
648
- $scope->assertSame('за 1 д.', $d->diffForHumans(null, false, true));
649
- $scope->assertSame('1 д.', $d->diffForHumans(null, true, true));
650
-
651
- $d = Carbon::now()->addDays(2);
652
- $scope->assertSame('за 2 дана', $d->diffForHumans());
653
- $scope->assertSame('2 дана', $d->diffForHumans(null, true));
654
- $scope->assertSame('за 2 д.', $d->diffForHumans(null, false, true));
655
- $scope->assertSame('2 д.', $d->diffForHumans(null, true, true));
656
-
657
- $d = Carbon::now()->subDay();
658
- $scope->assertSame('1 дан након', Carbon::now()->diffForHumans($d));
659
-
660
- $d = Carbon::now()->subDays(2);
661
- $scope->assertSame('2 дана након', Carbon::now()->diffForHumans($d));
662
-
663
- $d = Carbon::now()->addDay();
664
- $scope->assertSame('1 дан прије', Carbon::now()->diffForHumans($d));
665
-
666
- $d = Carbon::now()->addDays(2);
667
- $scope->assertSame('2 дана прије', Carbon::now()->diffForHumans($d));
668
-
669
- $d = Carbon::now()->subDay();
670
- $scope->assertSame('прије 1 дан', $d->diffForHumans());
671
-
672
- $d = Carbon::now()->subDays(2);
673
- $scope->assertSame('прије 2 дана', $d->diffForHumans());
674
-
675
- /*
676
- * Hour
677
- */
678
- $d = Carbon::now()->addHour();
679
- $scope->assertSame('за 1 сат', $d->diffForHumans());
680
- $scope->assertSame('1 сат', $d->diffForHumans(null, true));
681
- $scope->assertSame('за 1 ч.', $d->diffForHumans(null, false, true));
682
- $scope->assertSame('1 ч.', $d->diffForHumans(null, true, true));
683
-
684
- $d = Carbon::now()->addHours(2);
685
- $scope->assertSame('за 2 сата', $d->diffForHumans());
686
- $scope->assertSame('2 сата', $d->diffForHumans(null, true));
687
- $scope->assertSame('за 2 ч.', $d->diffForHumans(null, false, true));
688
- $scope->assertSame('2 ч.', $d->diffForHumans(null, true, true));
689
-
690
- $d = Carbon::now()->addHours(5);
691
- $scope->assertSame('за 5 сати', $d->diffForHumans());
692
- $scope->assertSame('5 сати', $d->diffForHumans(null, true));
693
- $scope->assertSame('за 5 ч.', $d->diffForHumans(null, false, true));
694
- $scope->assertSame('5 ч.', $d->diffForHumans(null, true, true));
695
-
696
- $d = Carbon::now()->addHours(19);
697
- $scope->assertSame('за 19 сати', $d->diffForHumans());
698
- $scope->assertSame('19 сати', $d->diffForHumans(null, true));
699
- $scope->assertSame('за 19 ч.', $d->diffForHumans(null, false, true));
700
- $scope->assertSame('19 ч.', $d->diffForHumans(null, true, true));
701
-
702
- $d = Carbon::now()->addHours(20);
703
- $scope->assertSame('за 20 сати', $d->diffForHumans());
704
- $scope->assertSame('20 сати', $d->diffForHumans(null, true));
705
- $scope->assertSame('за 20 ч.', $d->diffForHumans(null, false, true));
706
- $scope->assertSame('20 ч.', $d->diffForHumans(null, true, true));
707
-
708
- $d = Carbon::now()->addHours(21);
709
- $scope->assertSame('за 21 сат', $d->diffForHumans());
710
- $scope->assertSame('21 сат', $d->diffForHumans(null, true));
711
- $scope->assertSame('за 21 ч.', $d->diffForHumans(null, false, true));
712
- $scope->assertSame('21 ч.', $d->diffForHumans(null, true, true));
713
-
714
- $d = Carbon::now()->addHours(22);
715
- $scope->assertSame('за 22 сата', $d->diffForHumans());
716
- $scope->assertSame('22 сата', $d->diffForHumans(null, true));
717
- $scope->assertSame('за 22 ч.', $d->diffForHumans(null, false, true));
718
- $scope->assertSame('22 ч.', $d->diffForHumans(null, true, true));
719
-
720
- $d = Carbon::now()->addHours(23);
721
- $scope->assertSame('за 23 сата', $d->diffForHumans());
722
- $scope->assertSame('23 сата', $d->diffForHumans(null, true));
723
- $scope->assertSame('за 23 ч.', $d->diffForHumans(null, false, true));
724
- $scope->assertSame('23 ч.', $d->diffForHumans(null, true, true));
725
-
726
- $d = Carbon::now()->subHour();
727
- $scope->assertSame('1 сат након', Carbon::now()->diffForHumans($d));
728
-
729
- $d = Carbon::now()->subHours(2);
730
- $scope->assertSame('2 сата након', Carbon::now()->diffForHumans($d));
731
-
732
- $d = Carbon::now()->subHours(5);
733
- $scope->assertSame('5 сати након', Carbon::now()->diffForHumans($d));
734
-
735
- $d = Carbon::now()->subHours(19);
736
- $scope->assertSame('19 сати након', Carbon::now()->diffForHumans($d));
737
-
738
- $d = Carbon::now()->subHours(20);
739
- $scope->assertSame('20 сати након', Carbon::now()->diffForHumans($d));
740
-
741
- $d = Carbon::now()->subHours(21);
742
- $scope->assertSame('21 сат након', Carbon::now()->diffForHumans($d));
743
-
744
- $d = Carbon::now()->subHours(22);
745
- $scope->assertSame('22 сата након', Carbon::now()->diffForHumans($d));
746
-
747
- $d = Carbon::now()->subHours(23);
748
- $scope->assertSame('23 сата након', Carbon::now()->diffForHumans($d));
749
-
750
- $d = Carbon::now()->addHour();
751
- $scope->assertSame('1 сат прије', Carbon::now()->diffForHumans($d));
752
-
753
- $d = Carbon::now()->addHours(2);
754
- $scope->assertSame('2 сата прије', Carbon::now()->diffForHumans($d));
755
-
756
- $d = Carbon::now()->addHours(5);
757
- $scope->assertSame('5 сати прије', Carbon::now()->diffForHumans($d));
758
-
759
- $d = Carbon::now()->addHours(19);
760
- $scope->assertSame('19 сати прије', Carbon::now()->diffForHumans($d));
761
-
762
- $d = Carbon::now()->addHours(20);
763
- $scope->assertSame('20 сати прије', Carbon::now()->diffForHumans($d));
764
-
765
- $d = Carbon::now()->addHours(21);
766
- $scope->assertSame('21 сат прије', Carbon::now()->diffForHumans($d));
767
-
768
- $d = Carbon::now()->addHours(22);
769
- $scope->assertSame('22 сата прије', Carbon::now()->diffForHumans($d));
770
-
771
- $d = Carbon::now()->addHours(23);
772
- $scope->assertSame('23 сата прије', Carbon::now()->diffForHumans($d));
773
-
774
- $d = Carbon::now()->subHour();
775
- $scope->assertSame('прије 1 сат', $d->diffForHumans());
776
-
777
- $d = Carbon::now()->subHours(2);
778
- $scope->assertSame('прије 2 сата', $d->diffForHumans());
779
-
780
- $d = Carbon::now()->subHours(5);
781
- $scope->assertSame('прије 5 сати', $d->diffForHumans());
782
-
783
- $d = Carbon::now()->subHours(19);
784
- $scope->assertSame('прије 19 сати', $d->diffForHumans());
785
-
786
- $d = Carbon::now()->subHours(20);
787
- $scope->assertSame('прије 20 сати', $d->diffForHumans());
788
-
789
- $d = Carbon::now()->subHours(21);
790
- $scope->assertSame('прије 21 сат', $d->diffForHumans());
791
-
792
- $d = Carbon::now()->subHours(22);
793
- $scope->assertSame('прије 22 сата', $d->diffForHumans());
794
-
795
- $d = Carbon::now()->subHours(23);
796
- $scope->assertSame('прије 23 сата', $d->diffForHumans());
797
-
798
- /*
799
- * Minute
800
- */
801
- $d = Carbon::now()->addMinute();
802
- $scope->assertSame('за 1 минут', $d->diffForHumans());
803
- $scope->assertSame('1 минут', $d->diffForHumans(null, true));
804
- $scope->assertSame('за 1 мин.', $d->diffForHumans(null, false, true));
805
- $scope->assertSame('1 мин.', $d->diffForHumans(null, true, true));
806
-
807
- $d = Carbon::now()->addMinutes(2);
808
- $scope->assertSame('за 2 минута', $d->diffForHumans());
809
- $scope->assertSame('2 минута', $d->diffForHumans(null, true));
810
- $scope->assertSame('за 2 мин.', $d->diffForHumans(null, false, true));
811
- $scope->assertSame('2 мин.', $d->diffForHumans(null, true, true));
812
-
813
- $d = Carbon::now()->addMinutes(21);
814
- $scope->assertSame('за 21 минут', $d->diffForHumans());
815
- $scope->assertSame('21 минут', $d->diffForHumans(null, true));
816
- $scope->assertSame('за 21 мин.', $d->diffForHumans(null, false, true));
817
- $scope->assertSame('21 мин.', $d->diffForHumans(null, true, true));
818
-
819
- $d = Carbon::now()->addMinutes(31);
820
- $scope->assertSame('за 31 минут', $d->diffForHumans());
821
- $scope->assertSame('31 минут', $d->diffForHumans(null, true));
822
- $scope->assertSame('за 31 мин.', $d->diffForHumans(null, false, true));
823
- $scope->assertSame('31 мин.', $d->diffForHumans(null, true, true));
824
-
825
- $d = Carbon::now()->addMinutes(41);
826
- $scope->assertSame('за 41 минут', $d->diffForHumans());
827
- $scope->assertSame('41 минут', $d->diffForHumans(null, true));
828
- $scope->assertSame('за 41 мин.', $d->diffForHumans(null, false, true));
829
- $scope->assertSame('41 мин.', $d->diffForHumans(null, true, true));
830
-
831
- $d = Carbon::now()->addMinutes(51);
832
- $scope->assertSame('за 51 минут', $d->diffForHumans());
833
- $scope->assertSame('51 минут', $d->diffForHumans(null, true));
834
- $scope->assertSame('за 51 мин.', $d->diffForHumans(null, false, true));
835
- $scope->assertSame('51 мин.', $d->diffForHumans(null, true, true));
836
-
837
- $d = Carbon::now()->subMinute();
838
- $scope->assertSame('1 минут након', Carbon::now()->diffForHumans($d));
839
-
840
- $d = Carbon::now()->subMinutes(2);
841
- $scope->assertSame('2 минута након', Carbon::now()->diffForHumans($d));
842
-
843
- $d = Carbon::now()->subMinutes(21);
844
- $scope->assertSame('21 минут након', Carbon::now()->diffForHumans($d));
845
-
846
- $d = Carbon::now()->subMinutes(31);
847
- $scope->assertSame('31 минут након', Carbon::now()->diffForHumans($d));
848
-
849
- $d = Carbon::now()->subMinutes(41);
850
- $scope->assertSame('41 минут након', Carbon::now()->diffForHumans($d));
851
-
852
- $d = Carbon::now()->subMinutes(51);
853
- $scope->assertSame('51 минут након', Carbon::now()->diffForHumans($d));
854
-
855
- $d = Carbon::now()->addMinute();
856
- $scope->assertSame('1 минут прије', Carbon::now()->diffForHumans($d));
857
-
858
- $d = Carbon::now()->addMinutes(2);
859
- $scope->assertSame('2 минута прије', Carbon::now()->diffForHumans($d));
860
-
861
- $d = Carbon::now()->addMinutes(21);
862
- $scope->assertSame('21 минут прије', Carbon::now()->diffForHumans($d));
863
-
864
- $d = Carbon::now()->addMinutes(31);
865
- $scope->assertSame('31 минут прије', Carbon::now()->diffForHumans($d));
866
-
867
- $d = Carbon::now()->addMinutes(41);
868
- $scope->assertSame('41 минут прије', Carbon::now()->diffForHumans($d));
869
-
870
- $d = Carbon::now()->addMinutes(51);
871
- $scope->assertSame('51 минут прије', Carbon::now()->diffForHumans($d));
872
-
873
- $d = Carbon::now()->subMinute();
874
- $scope->assertSame('прије 1 минут', $d->diffForHumans());
875
-
876
- $d = Carbon::now()->subMinutes(2);
877
- $scope->assertSame('прије 2 минута', $d->diffForHumans());
878
-
879
- $d = Carbon::now()->subMinutes(21);
880
- $scope->assertSame('прије 21 минут', $d->diffForHumans());
881
-
882
- $d = Carbon::now()->subMinutes(31);
883
- $scope->assertSame('прије 31 минут', $d->diffForHumans());
884
-
885
- $d = Carbon::now()->subMinutes(41);
886
- $scope->assertSame('прије 41 минут', $d->diffForHumans());
887
-
888
- $d = Carbon::now()->subMinutes(51);
889
- $scope->assertSame('прије 51 минут', $d->diffForHumans());
890
-
891
- /*
892
- * Second
893
- */
894
- $d = Carbon::now()->addSecond();
895
- $scope->assertSame('за 1 секунд', $d->diffForHumans());
896
- $scope->assertSame('1 секунд', $d->diffForHumans(null, true));
897
- $scope->assertSame('за 1 сек.', $d->diffForHumans(null, false, true));
898
- $scope->assertSame('1 сек.', $d->diffForHumans(null, true, true));
899
-
900
- $d = Carbon::now()->addSeconds(2);
901
- $scope->assertSame('за 2 секунде', $d->diffForHumans());
902
- $scope->assertSame('2 секунде', $d->diffForHumans(null, true));
903
- $scope->assertSame('за 2 сек.', $d->diffForHumans(null, false, true));
904
- $scope->assertSame('2 сек.', $d->diffForHumans(null, true, true));
905
-
906
- $d = Carbon::now()->addSeconds(21);
907
- $scope->assertSame('за 21 секунд', $d->diffForHumans());
908
- $scope->assertSame('21 секунд', $d->diffForHumans(null, true));
909
- $scope->assertSame('за 21 сек.', $d->diffForHumans(null, false, true));
910
- $scope->assertSame('21 сек.', $d->diffForHumans(null, true, true));
911
-
912
- $d = Carbon::now()->addSeconds(31);
913
- $scope->assertSame('за 31 секунд', $d->diffForHumans());
914
- $scope->assertSame('31 секунд', $d->diffForHumans(null, true));
915
- $scope->assertSame('за 31 сек.', $d->diffForHumans(null, false, true));
916
- $scope->assertSame('31 сек.', $d->diffForHumans(null, true, true));
917
-
918
- $d = Carbon::now()->addSeconds(41);
919
- $scope->assertSame('за 41 секунд', $d->diffForHumans());
920
- $scope->assertSame('41 секунд', $d->diffForHumans(null, true));
921
- $scope->assertSame('за 41 сек.', $d->diffForHumans(null, false, true));
922
- $scope->assertSame('41 сек.', $d->diffForHumans(null, true, true));
923
-
924
- $d = Carbon::now()->addSeconds(51);
925
- $scope->assertSame('за 51 секунд', $d->diffForHumans());
926
- $scope->assertSame('51 секунд', $d->diffForHumans(null, true));
927
- $scope->assertSame('за 51 сек.', $d->diffForHumans(null, false, true));
928
- $scope->assertSame('51 сек.', $d->diffForHumans(null, true, true));
929
-
930
- $d = Carbon::now()->subSecond();
931
- $scope->assertSame('1 секунд након', Carbon::now()->diffForHumans($d));
932
-
933
- $d = Carbon::now()->subSeconds(2);
934
- $scope->assertSame('2 секунде након', Carbon::now()->diffForHumans($d));
935
-
936
- $d = Carbon::now()->subSeconds(21);
937
- $scope->assertSame('21 секунд након', Carbon::now()->diffForHumans($d));
938
-
939
- $d = Carbon::now()->subSeconds(31);
940
- $scope->assertSame('31 секунд након', Carbon::now()->diffForHumans($d));
941
-
942
- $d = Carbon::now()->subSeconds(41);
943
- $scope->assertSame('41 секунд након', Carbon::now()->diffForHumans($d));
944
-
945
- $d = Carbon::now()->subSeconds(51);
946
- $scope->assertSame('51 секунд након', Carbon::now()->diffForHumans($d));
947
-
948
- $d = Carbon::now()->addSecond();
949
- $scope->assertSame('1 секунд прије', Carbon::now()->diffForHumans($d));
950
-
951
- $d = Carbon::now()->addSeconds(2);
952
- $scope->assertSame('2 секунде прије', Carbon::now()->diffForHumans($d));
953
-
954
- $d = Carbon::now()->addSeconds(21);
955
- $scope->assertSame('21 секунд прије', Carbon::now()->diffForHumans($d));
956
-
957
- $d = Carbon::now()->addSeconds(31);
958
- $scope->assertSame('31 секунд прије', Carbon::now()->diffForHumans($d));
959
-
960
- $d = Carbon::now()->addSeconds(41);
961
- $scope->assertSame('41 секунд прије', Carbon::now()->diffForHumans($d));
962
-
963
- $d = Carbon::now()->addSeconds(51);
964
- $scope->assertSame('51 секунд прије', Carbon::now()->diffForHumans($d));
965
-
966
- $d = Carbon::now()->subSecond();
967
- $scope->assertSame('прије 1 секунд', $d->diffForHumans());
968
-
969
- $d = Carbon::now()->subSeconds(2);
970
- $scope->assertSame('прије 2 секунде', $d->diffForHumans());
971
-
972
- $d = Carbon::now()->subSeconds(21);
973
- $scope->assertSame('прије 21 секунд', $d->diffForHumans());
974
-
975
- $d = Carbon::now()->subSeconds(31);
976
- $scope->assertSame('прије 31 секунд', $d->diffForHumans());
977
-
978
- $d = Carbon::now()->subSeconds(41);
979
- $scope->assertSame('прије 41 секунд', $d->diffForHumans());
980
-
981
- $d = Carbon::now()->subSeconds(51);
982
- $scope->assertSame('прије 51 секунд', $d->diffForHumans());
983
- });
984
- }
985
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/TrTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class TrTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInTurkish()
20
- {
21
- Carbon::setLocale('tr');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 saniye önce', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 saniye önce', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 dakika önce', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 dakika önce', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 saat önce', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 saat önce', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 gün önce', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 gün önce', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 hafta önce', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 hafta önce', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 ay önce', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 ay önce', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 yıl önce', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 yıl önce', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 saniye sonra', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 saniye sonra', $d->diffForHumans($d2));
73
- $scope->assertSame('1 saniye önce', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1 saniye', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2 saniye', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/UkTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class UkTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansUsingShortUnitsUkrainian()
20
- {
21
- Carbon::setLocale('uk');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 секунду назад', $d->diffForHumans(null, false, true));
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 секунди назад', $d->diffForHumans(null, false, true));
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 хвилину назад', $d->diffForHumans(null, false, true));
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 хвилини назад', $d->diffForHumans(null, false, true));
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 година назад', $d->diffForHumans(null, false, true));
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 години назад', $d->diffForHumans(null, false, true));
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 день назад', $d->diffForHumans(null, false, true));
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 дні назад', $d->diffForHumans(null, false, true));
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 тиждень назад', $d->diffForHumans(null, false, true));
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 тижні назад', $d->diffForHumans(null, false, true));
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 місяць назад', $d->diffForHumans(null, false, true));
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 місяці назад', $d->diffForHumans(null, false, true));
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 рік назад', $d->diffForHumans(null, false, true));
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 роки назад', $d->diffForHumans(null, false, true));
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('через 1 секунду', $d->diffForHumans(null, false, true));
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 секунду після', $d->diffForHumans($d2, false, true));
73
- $scope->assertSame('1 секунду до', $d2->diffForHumans($d, false, true));
74
-
75
- $scope->assertSame('1 секунду', $d->diffForHumans($d2, true, true));
76
- $scope->assertSame('2 секунди', $d2->diffForHumans($d->addSecond(), true, true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/UrTest.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class UrTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInUrdu()
20
- {
21
- Carbon::setLocale('ur');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 سیکنڈ پہلے', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 سیکنڈ پہلے', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 منٹ پہلے', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 منٹ پہلے', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 گھنٹے پہلے', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 گھنٹے پہلے', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 روز پہلے', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 روز پہلے', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 ہفتے پہلے', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 ہفتے پہلے', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 ماه پہلے', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 ماه پہلے', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 سال پہلے', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 سال پہلے', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 سیکنڈ بعد', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 سیکنڈ بعد', $d->diffForHumans($d2));
73
- $scope->assertSame('1 سیکنڈ پہلے', $d2->diffForHumans($d));
74
-
75
- $d = Carbon::now()->addSecond();
76
- $d2 = Carbon::now();
77
- $scope->assertSame('1 سیکنڈ', $d->diffForHumans($d2, true));
78
- $scope->assertSame('2 سیکنڈ', $d2->diffForHumans($d->addSecond(), true));
79
- });
80
- }
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/UzTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Carbon;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class UzTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansUsingShortUnitsUzbek()
20
- {
21
- Carbon::setLocale('uz');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1 sekund avval', $d->diffForHumans(null, false, true));
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2 sekund avval', $d->diffForHumans(null, false, true));
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1 minut avval', $d->diffForHumans(null, false, true));
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2 minut avval', $d->diffForHumans(null, false, true));
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1 soat avval', $d->diffForHumans(null, false, true));
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2 soat avval', $d->diffForHumans(null, false, true));
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1 kun avval', $d->diffForHumans(null, false, true));
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2 kun avval', $d->diffForHumans(null, false, true));
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1 hafta avval', $d->diffForHumans(null, false, true));
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2 hafta avval', $d->diffForHumans(null, false, true));
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1 oy avval', $d->diffForHumans(null, false, true));
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2 oy avval', $d->diffForHumans(null, false, true));
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1 yil avval', $d->diffForHumans(null, false, true));
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2 yil avval', $d->diffForHumans(null, false, true));
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('1 sekund keyin', $d->diffForHumans(null, false, true));
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1 sekund keyin', $d->diffForHumans($d2, false, true));
73
- $scope->assertSame('1 sekund oldin', $d2->diffForHumans($d, false, true));
74
-
75
- $scope->assertSame('1 sekund', $d->diffForHumans($d2, true, true));
76
- $scope->assertSame('2 sekund', $d2->diffForHumans($d->addSecond(), true, true));
77
- });
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/nesbot/carbon/tests/Localization/ZhTest.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of the Carbon package.
5
- *
6
- * (c) Brian Nesbitt <brian@nesbot.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
- namespace Tests\Localization;
13
-
14
- use Carbon\Carbon;
15
- use Tests\AbstractTestCase;
16
-
17
- class ZhTest extends AbstractTestCase
18
- {
19
- public function testDiffForHumansLocalizedInTurkish()
20
- {
21
- Carbon::setLocale('zh');
22
-
23
- $scope = $this;
24
- $this->wrapWithNonDstDate(function () use ($scope) {
25
- $d = Carbon::now()->subSecond();
26
- $scope->assertSame('1秒前', $d->diffForHumans());
27
-
28
- $d = Carbon::now()->subSeconds(2);
29
- $scope->assertSame('2秒前', $d->diffForHumans());
30
-
31
- $d = Carbon::now()->subMinute();
32
- $scope->assertSame('1分钟前', $d->diffForHumans());
33
-
34
- $d = Carbon::now()->subMinutes(2);
35
- $scope->assertSame('2分钟前', $d->diffForHumans());
36
-
37
- $d = Carbon::now()->subHour();
38
- $scope->assertSame('1小时前', $d->diffForHumans());
39
-
40
- $d = Carbon::now()->subHours(2);
41
- $scope->assertSame('2小时前', $d->diffForHumans());
42
-
43
- $d = Carbon::now()->subDay();
44
- $scope->assertSame('1天前', $d->diffForHumans());
45
-
46
- $d = Carbon::now()->subDays(2);
47
- $scope->assertSame('2天前', $d->diffForHumans());
48
-
49
- $d = Carbon::now()->subWeek();
50
- $scope->assertSame('1周前', $d->diffForHumans());
51
-
52
- $d = Carbon::now()->subWeeks(2);
53
- $scope->assertSame('2周前', $d->diffForHumans());
54
-
55
- $d = Carbon::now()->subMonth();
56
- $scope->assertSame('1个月前', $d->diffForHumans());
57
-
58
- $d = Carbon::now()->subMonths(2);
59
- $scope->assertSame('2个月前', $d->diffForHumans());
60
-
61
- $d = Carbon::now()->subYear();
62
- $scope->assertSame('1年前', $d->diffForHumans());
63
-
64
- $d = Carbon::now()->subYears(2);
65
- $scope->assertSame('2年前', $d->diffForHumans());
66
-
67
- $d = Carbon::now()->addSecond();
68
- $scope->assertSame('距现在1秒', $d->diffForHumans());
69
-
70
- $d = Carbon::now()->addSecond();
71
- $d2 = Carbon::now();
72
- $scope->assertSame('1秒后', $d->diffForHumans($d2));
73
- $scope->assertSame('1秒前', $d2->diffForHumans($d));
74
-
75
- $scope->assertSame('1秒', $d->diffForHumans($d2, true));
76
- $scope->assertSame('2秒', $d2->diffForHumans($d->addSecond(), true));
77
- });
78
- }
79
- }