diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 4ce5a7735d6c..2ae1f76c8b99 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -324,7 +324,7 @@ protected function expressionPasses() $date = Date::now(); if ($this->timezone) { - $date->setTimezone($this->timezone); + $date = $date->setTimezone($this->timezone); } return (new CronExpression($this->expression))->isDue($date->toDateTimeString()); diff --git a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php index d45bc0f8275b..45b8896338ef 100644 --- a/src/Illuminate/Console/Scheduling/ManagesFrequencies.php +++ b/src/Illuminate/Console/Scheduling/ManagesFrequencies.php @@ -60,9 +60,9 @@ private function inTimeInterval($startTime, $endTime) if ($endTime->lessThan($startTime)) { if ($startTime->greaterThan($now)) { - $startTime->subDay(1); + $startTime = $startTime->subDay(1); } else { - $endTime->addDay(1); + $endTime = $endTime->addDay(1); } } diff --git a/src/Illuminate/Foundation/Testing/TestCase.php b/src/Illuminate/Foundation/Testing/TestCase.php index ee19a864b591..c085a3ce1418 100644 --- a/src/Illuminate/Foundation/Testing/TestCase.php +++ b/src/Illuminate/Foundation/Testing/TestCase.php @@ -2,11 +2,11 @@ namespace Illuminate\Foundation\Testing; -use Carbon\Carbon; use Carbon\CarbonImmutable; use Illuminate\Console\Application as Artisan; use Illuminate\Database\Eloquent\Model; use Illuminate\Queue\Queue; +use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\ParallelTesting; use Illuminate\Support\Str; diff --git a/src/Illuminate/Queue/Console/PruneBatchesCommand.php b/src/Illuminate/Queue/Console/PruneBatchesCommand.php index 808c82c5dcbf..deb4eb96f685 100644 --- a/src/Illuminate/Queue/Console/PruneBatchesCommand.php +++ b/src/Illuminate/Queue/Console/PruneBatchesCommand.php @@ -2,11 +2,11 @@ namespace Illuminate\Queue\Console; -use Carbon\Carbon; use Illuminate\Bus\BatchRepository; use Illuminate\Bus\DatabaseBatchRepository; use Illuminate\Bus\PrunableBatchRepository; use Illuminate\Console\Command; +use Illuminate\Support\Carbon; class PruneBatchesCommand extends Command { diff --git a/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php b/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php index f82d9be3b955..64badcad2d28 100644 --- a/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php +++ b/src/Illuminate/Queue/Console/PruneFailedJobsCommand.php @@ -2,9 +2,9 @@ namespace Illuminate\Queue\Console; -use Carbon\Carbon; use Illuminate\Console\Command; use Illuminate\Queue\Failed\PrunableFailedJobProvider; +use Illuminate\Support\Carbon; class PruneFailedJobsCommand extends Command { diff --git a/tests/Database/DatabaseEloquentIntegrationTest.php b/tests/Database/DatabaseEloquentIntegrationTest.php index 9624af06add4..4ef9b1ffc901 100644 --- a/tests/Database/DatabaseEloquentIntegrationTest.php +++ b/tests/Database/DatabaseEloquentIntegrationTest.php @@ -1374,8 +1374,8 @@ public function testIsAfterRetrievingTheSameModel() public function testFreshMethodOnModel() { - $now = Carbon::now(); - $nowSerialized = $now->startOfSecond()->toJSON(); + $now = Carbon::now()->startOfSecond(); + $nowSerialized = $now->toJSON(); $nowWithFractionsSerialized = $now->toJSON(); Carbon::setTestNow($now); diff --git a/tests/Pagination/CursorTest.php b/tests/Pagination/CursorTest.php index 05c2629619b9..78f7cfc2e4f9 100644 --- a/tests/Pagination/CursorTest.php +++ b/tests/Pagination/CursorTest.php @@ -2,8 +2,8 @@ namespace Illuminate\Tests\Pagination; -use Carbon\Carbon; use Illuminate\Pagination\Cursor; +use Illuminate\Support\Carbon; use PHPUnit\Framework\TestCase; class CursorTest extends TestCase diff --git a/tests/Queue/QueueSqsQueueTest.php b/tests/Queue/QueueSqsQueueTest.php index 60e02b161ebb..0ae708f91e9f 100755 --- a/tests/Queue/QueueSqsQueueTest.php +++ b/tests/Queue/QueueSqsQueueTest.php @@ -94,7 +94,7 @@ public function testDelayedPushWithDateTimeProperlyPushesJobOntoSqs() $queue = $this->getMockBuilder(SqsQueue::class)->onlyMethods(['createPayload', 'secondsUntil', 'getQueue'])->setConstructorArgs([$this->sqs, $this->queueName, $this->account])->getMock(); $queue->setContainer($container = m::spy(Container::class)); $queue->expects($this->once())->method('createPayload')->with($this->mockedJob, $this->queueName, $this->mockedData)->willReturn($this->mockedPayload); - $queue->expects($this->once())->method('secondsUntil')->with($now)->willReturn(5); + $queue->expects($this->once())->method('secondsUntil')->with($now->addSeconds(5))->willReturn(5); $queue->expects($this->once())->method('getQueue')->with($this->queueName)->willReturn($this->queueUrl); $this->sqs->shouldReceive('sendMessage')->once()->with(['QueueUrl' => $this->queueUrl, 'MessageBody' => $this->mockedPayload, 'DelaySeconds' => 5])->andReturn($this->mockedSendMessageResponseModel); $id = $queue->later($now->addSeconds(5), $this->mockedJob, $this->mockedData, $this->queueName); diff --git a/tests/Support/SupportCarbonTest.php b/tests/Support/SupportCarbonTest.php index cdd865b8b470..a01ca35ec254 100644 --- a/tests/Support/SupportCarbonTest.php +++ b/tests/Support/SupportCarbonTest.php @@ -5,7 +5,6 @@ use BadMethodCallException; use Carbon\Carbon as BaseCarbon; use Carbon\CarbonImmutable as BaseCarbonImmutable; -use DateTime; use DateTimeInterface; use Illuminate\Support\Carbon; use PHPUnit\Framework\TestCase; @@ -34,7 +33,7 @@ protected function tearDown(): void public function testInstance() { - $this->assertInstanceOf(DateTime::class, $this->now); + $this->assertInstanceOf(Carbon::class, $this->now); $this->assertInstanceOf(DateTimeInterface::class, $this->now); $this->assertInstanceOf(BaseCarbon::class, $this->now); $this->assertInstanceOf(Carbon::class, $this->now); diff --git a/tests/Support/SupportLazyCollectionTest.php b/tests/Support/SupportLazyCollectionTest.php index bb85818b7d8f..b7b0ebcbbb29 100644 --- a/tests/Support/SupportLazyCollectionTest.php +++ b/tests/Support/SupportLazyCollectionTest.php @@ -2,7 +2,7 @@ namespace Illuminate\Tests\Support; -use Carbon\Carbon; +use Illuminate\Support\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\LazyCollection; use Mockery as m;