Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions tests/Integration/Database/EloquentModelScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Illuminate\Tests\Integration\Database;

use Illuminate\Contracts\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Attributes\Scope as NamedScope;
use Illuminate\Database\Eloquent\Attributes\Scope;
use Illuminate\Database\Eloquent\Model;

class EloquentModelScopeTest extends DatabaseTestCase
Expand Down Expand Up @@ -37,7 +37,7 @@ public function scopeExists(Builder $builder)
return $builder;
}

#[NamedScope]
#[Scope]
protected function existsAsWell(Builder $builder)
{
return $builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ protected function setUp(): void
);
}

#[DataProvider('namedScopeDataProvider')]
#[DataProvider('scopeDataProvider')]
public function test_it_can_query_named_scoped_from_the_query_builder(string $methodName)
{
$query = Fixtures\NamedScopeUser::query()->{$methodName}(true);

$this->assertSame($this->query, $query->toRawSql());
}

#[DataProvider('namedScopeDataProvider')]
#[DataProvider('scopeDataProvider')]
public function test_it_can_query_named_scoped_from_static_query(string $methodName)
{
$query = Fixtures\NamedScopeUser::{$methodName}(true);

$this->assertSame($this->query, $query->toRawSql());
}

public static function namedScopeDataProvider(): array
public static function scopeDataProvider(): array
{
return [
'scope with return' => ['verified'],
Expand Down
6 changes: 3 additions & 3 deletions tests/Integration/Database/Fixtures/NamedScopeUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Illuminate\Tests\Integration\Database\Fixtures;

use Illuminate\Database\Eloquent\Attributes\Scope as NamedScope;
use Illuminate\Database\Eloquent\Attributes\Scope;
use Illuminate\Database\Eloquent\Builder;

class NamedScopeUser extends User
Expand All @@ -17,7 +17,7 @@ protected function casts(): array
];
}

#[NamedScope]
#[Scope]
protected function verified(Builder $builder, bool $email = true)
{
return $builder->when(
Expand All @@ -27,7 +27,7 @@ protected function verified(Builder $builder, bool $email = true)
);
}

#[NamedScope]
#[Scope]
protected function verifiedWithoutReturn(Builder $builder, bool $email = true)
{
$this->verified($builder, $email);
Expand Down