Skip to content

Commit 335abe5

Browse files
committed
fix: Use $this->cast() in EntityTest
1 parent 9ac23b4 commit 335abe5

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

tests/system/Entity/EntityTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,21 +1121,19 @@ public function testAsArrayRestoringCastStatus(): void
11211121

11221122
// Disabled casting properties, but we will allow casting in the method.
11231123
$entity->cast(false);
1124-
$beforeCast = $this->getPrivateProperty($entity, '_cast');
1124+
$beforeCast = $entity->cast();
11251125
$result = $entity->toArray(true, true);
1126-
$afterCast = $this->getPrivateProperty($entity, '_cast');
11271126

11281127
$this->assertSame(2026, $result['first']);
1129-
$this->assertSame($beforeCast, $afterCast);
1128+
$this->assertSame($beforeCast, $entity->cast());
11301129

11311130
// Enabled casting properties, but we will disallow casting in the method.
11321131
$entity->cast(true);
1133-
$beforeCast = $this->getPrivateProperty($entity, '_cast');
1132+
$beforeCast = $entity->cast();
11341133
$result = $entity->toArray(true, false);
1135-
$afterCast = $this->getPrivateProperty($entity, '_cast');
11361134

11371135
$this->assertSame('2026 Year', $result['first']);
1138-
$this->assertSame($beforeCast, $afterCast);
1136+
$this->assertSame($beforeCast, $entity->cast());
11391137
}
11401138

11411139
public function testDataMappingIssetSwapped(): void

0 commit comments

Comments
 (0)