Skip to content

Commit

Permalink
Add test message for mutability expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jun 15, 2023
1 parent 757dd02 commit ae0ae7c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/CarbonPeriod/MacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,18 @@ public function testMixinInstance()
$this->assertSame('Every 1 day from 2023-06-10 to 2023-06-13', (string) $copy);

$mutated = $period->oneMoreDay();
$expectedEnd = $this->periodClass === CarbonPeriodImmutable::class
? '2023-06-12'
: '2023-06-13';
$immutable = ($this->periodClass === CarbonPeriodImmutable::class);
$expectedEnd = $immutable ? '2023-06-12' : '2023-06-13';

$this->assertSame('Every 1 day from 2023-06-10 to 2023-06-13', (string) $mutated);
$this->assertSame("Every 1 day from 2023-06-10 to $expectedEnd", (string) $period);

if ($this->periodClass === CarbonPeriodImmutable::class) {
$this->assertNotSame($mutated, $period);
} else {
$this->assertSame($mutated, $period);
}
$expectedResult = $immutable ? 'a new instance' : 'the same instance';
$this->assertSame(
$immutable,
($mutated !== $period),
$this->periodClass . "::oneMoreDay() should return $expectedResult"
);

$this->assertNotSame($copy, $period);

Expand Down

0 comments on commit ae0ae7c

Please sign in to comment.