diff --git a/tests/ArrayAccessItemsTest.php b/tests/ArrayAccessItemsTest.php index c4d7a97..1bdc354 100644 --- a/tests/ArrayAccessItemsTest.php +++ b/tests/ArrayAccessItemsTest.php @@ -5,13 +5,17 @@ use Blumilk\HeatmapBuilder\HeatmapBuilder; use Blumilk\HeatmapBuilder\Tile; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class ArrayAccessItemsTest extends TestCase { public function testBasicArrayAccessItems(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-18")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-18"), + timezone: new CarbonTimeZone("1"), + ); $result = $builder->build($this->getData()); $this->assertSame( @@ -25,7 +29,9 @@ public function testArrayAccessItemsWithIndexChanged(): void $builder = new HeatmapBuilder( now: Carbon::parse("2022-11-18"), arrayAccessIndex: "updated_at", + timezone: new CarbonTimeZone("1"), ); + $result = $builder->build($this->getData()); $this->assertSame( @@ -36,7 +42,10 @@ public function testArrayAccessItemsWithIndexChanged(): void public function testArrayAccessItemsWithIndexChangedByMethod(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-18")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-18"), + timezone: new CarbonTimeZone("1"), + ); $builder->changeArrayAccessIndex("updated_at"); $result = $builder->build($this->getData()); diff --git a/tests/ContractedItemsTest.php b/tests/ContractedItemsTest.php index 75a20b9..0486fb8 100644 --- a/tests/ContractedItemsTest.php +++ b/tests/ContractedItemsTest.php @@ -6,13 +6,17 @@ use Blumilk\HeatmapBuilder\HeatmapBuilder; use Blumilk\HeatmapBuilder\Tile; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class ContractedItemsTest extends TestCase { public function testBasicContractedItems(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-18")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-18"), + timezone: new CarbonTimeZone("1"), + ); $result = $builder->build($this->getData()); $this->assertSame( diff --git a/tests/DecoratorTest.php b/tests/DecoratorTest.php index b02435e..c9ce1a0 100644 --- a/tests/DecoratorTest.php +++ b/tests/DecoratorTest.php @@ -6,6 +6,7 @@ use Blumilk\HeatmapBuilder\HeatmapBuilder; use Blumilk\HeatmapBuilder\Tile; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class DecoratorTest extends TestCase @@ -33,6 +34,7 @@ public function testBasicArrayAccessItems(): void $builder = new HeatmapBuilder( now: Carbon::parse("2022-11-18"), decorator: new TailwindDecorator("green"), + timezone: new CarbonTimeZone("1"), ); $result = $builder->build($data); diff --git a/tests/NowChangedTest.php b/tests/NowChangedTest.php index d28655c..f2f9010 100644 --- a/tests/NowChangedTest.php +++ b/tests/NowChangedTest.php @@ -5,13 +5,17 @@ use Blumilk\HeatmapBuilder\HeatmapBuilder; use Blumilk\HeatmapBuilder\Tile; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class NowChangedTest extends TestCase { public function testChangingNow(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-19")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-19"), + timezone: new CarbonTimeZone("1"), + ); $result = $builder->build($this->getData()); $this->assertSame( @@ -23,7 +27,10 @@ public function testChangingNow(): void public function testChangingNowByMethod(): void { $builder = new HeatmapBuilder(); - $builder->changeNow(Carbon::parse("2022-11-20")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-20"), + timezone: new CarbonTimeZone("1"), + ); $result = $builder->build($this->getData()); diff --git a/tests/PeriodActionsTest.php b/tests/PeriodActionsTest.php index fd62c7c..115106e 100644 --- a/tests/PeriodActionsTest.php +++ b/tests/PeriodActionsTest.php @@ -4,13 +4,17 @@ use Blumilk\HeatmapBuilder\HeatmapBuilder; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class PeriodActionsTest extends TestCase { public function testChangingPeriodForMonth(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-19 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-19"), + timezone: new CarbonTimeZone("1"), + ); $builder->forLastMonth(); $result = $builder->build($this->getData()); @@ -23,7 +27,10 @@ public function testChangingPeriodForMonth(): void public function testChangingPeriodForShorterMonth(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-03-01 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-03-01 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forLastMonth(); $result = $builder->build($this->getData()); @@ -36,7 +43,10 @@ public function testChangingPeriodForShorterMonth(): void public function testChangingPeriodForYear(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-19 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-19 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forLastYear(); $result = $builder->build($this->getData()); @@ -49,7 +59,10 @@ public function testChangingPeriodForYear(): void public function testChangingPeriodForLeapYear(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2020-05-01 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2020-05-01 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forLastYear(); $result = $builder->build($this->getData()); @@ -62,7 +75,10 @@ public function testChangingPeriodForLeapYear(): void public function testChangingPeriodForNumberOfTiles(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-03-01 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2020-03-01 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forNumberOfTiles(100); $result = $builder->build($this->getData()); diff --git a/tests/PeriodAligningTest.php b/tests/PeriodAligningTest.php index fb90478..1922d90 100644 --- a/tests/PeriodAligningTest.php +++ b/tests/PeriodAligningTest.php @@ -4,13 +4,17 @@ use Blumilk\HeatmapBuilder\HeatmapBuilder; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class PeriodAligningTest extends TestCase { public function testAligningPeriodForDailyHeatmap(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-19 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-19 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forLastMonth()->alignedToStartOfPeriod(); $result = $builder->build($this->getData()); @@ -23,7 +27,10 @@ public function testAligningPeriodForDailyHeatmap(): void public function testAligningPeriodForDailyHeatmapFromBothSides(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-19 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-19 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forLastMonth()->alignedToStartOfPeriod()->alignedToEndOfPeriod(); $result = $builder->build($this->getData()); @@ -36,7 +43,10 @@ public function testAligningPeriodForDailyHeatmapFromBothSides(): void public function testAligningPeriodForNumberOfTiles(): void { - $builder = new HeatmapBuilder(now: Carbon::parse("2022-11-19 00:00:00")); + $builder = new HeatmapBuilder( + now: Carbon::parse("2022-11-19 00:00:00"), + timezone: new CarbonTimeZone("1"), + ); $builder->forNumberOfTiles(4)->alignedToStartOfPeriod(); $result = $builder->build($this->getData()); diff --git a/tests/PeriodChangedTest.php b/tests/PeriodChangedTest.php index a1ada5d..702b74a 100644 --- a/tests/PeriodChangedTest.php +++ b/tests/PeriodChangedTest.php @@ -6,6 +6,7 @@ use Blumilk\HeatmapBuilder\Tile; use Carbon\Carbon; use Carbon\CarbonPeriod; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class PeriodChangedTest extends TestCase @@ -14,7 +15,10 @@ public function testChangingPeriod(): void { $start = Carbon::parse("2022-11-01"); $end = Carbon::parse("2022-11-11"); - $builder = new HeatmapBuilder(period: new CarbonPeriod($start, "1 day", $end)); + $builder = new HeatmapBuilder( + period: new CarbonPeriod($start, "1 day", $end), + timezone: new CarbonTimeZone("1"), + ); $result = $builder->build($this->getData()); @@ -29,7 +33,7 @@ public function testChangingPeriodByMethod(): void $start = Carbon::parse("2022-11-01"); $end = Carbon::parse("2022-11-11"); - $builder = new HeatmapBuilder(); + $builder = new HeatmapBuilder(timezone: new CarbonTimeZone("1")); $builder->changePeriod(new CarbonPeriod($start, "1 day", $end)); $result = $builder->build($this->getData()); diff --git a/tests/PeriodIntervalTest.php b/tests/PeriodIntervalTest.php index e7e9771..5a01375 100644 --- a/tests/PeriodIntervalTest.php +++ b/tests/PeriodIntervalTest.php @@ -6,6 +6,7 @@ use Blumilk\HeatmapBuilder\PeriodInterval; use Blumilk\HeatmapBuilder\Tile; use Carbon\Carbon; +use Carbon\CarbonTimeZone; use PHPUnit\Framework\TestCase; class PeriodIntervalTest extends TestCase @@ -15,6 +16,7 @@ public function testChangingPeriodForMonth(): void $builder = new HeatmapBuilder( now: Carbon::parse("2022-11-19"), periodInterval: PeriodInterval::Monthly, + timezone: new CarbonTimeZone("1"), ); $builder->forLastYear();