8000 [11.x] Introduce freezing Model by cosmastech · Pull Request #53472 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[11.x] Introduce freezing Model #53472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
offsetSet
  • Loading branch information
cosmastech committed Nov 12, 2024
commit 80657872d9da95b68be4af3a99a39e366d209da1
13 changes: 13 additions & 0 deletions tests/Database/DatabaseEloquentModelTest.php
8000
Original file line number Diff line number Diff line change
Expand Up @@ -3204,6 +3204,19 @@ public function testCannotSetAttributeOnFrozenModel()
}
}

public function testCannotOffsetSetAttributeOnFrozenModel()
{
$model = new EloquentModelStub();
$model->freeze();

try {
$model['castedFloat'] = 199.2;
$this->fail("No FrozenModelException thrown");
} catch (FrozenModelException $exception) {
$this->assertEquals("Cannot set property [castedFloat] on Model [Illuminate\Tests\Database\EloquentModelStub] because it is frozen.", $exception->getMessage());
}
}

#[DataProvider('cannotLoadRelationsDataProvider')]
public function testCannotLoadRelationOnFrozenModel($relations, $relationsAsString)
{
Expand Down
Loading
0