/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Integration/Database/EloquentModelScopeTest.php
58 строк
1 KB
Jack Bayliss
[12.x] Fix infinite recursion when defining model scope with attribute as private (#59958) (#59979)
04 май 2026, 15:35
Не верифицирован
04 май 2026, 15:35
26f92f2
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Integration\Database; use Illuminate\Contracts\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Attributes\Scope; use Illuminate\Database\Eloquent\Model; class EloquentModelScopeTest extends DatabaseTestCase { public function testModelHasScope() { $model = new TestScopeModel1; $this->assertTrue($model->hasNamedScope('exists')); } public function testModelDoesNotHaveScope() { $model = new TestScopeModel1; $this->assertFalse($model->hasNamedScope('doesNotExist')); } public function testModelHasAttributedScope() { $model = new TestScopeModel1; $this->assertTrue($model->hasNamedScope('existsAsWell')); } public function testModelDoesNotHaveScopeWhenPrivateVisibility() { $model = new TestScopeModel1; $this->assertFalse($model->hasNamedScope('existsAsPrivate')); } } class TestScopeModel1 extends Model { public function scopeExists(Builder $builder) { return $builder; } #[Scope] protected function existsAsWell(Builder $builder) { return $builder; } #[Scope] private function existsAsPrivate(Builder $builder) { return $builder; } }