File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public static function bootHasControl()
2121 *
2222 * @return Control|null The newly created control instance, or null if creation was unsuccessful.
2323 */
24- protected function newControl (): ?Control
24+ public function newControl (): ?Control
2525 {
2626 return Access::controlForModel (static ::class);
2727 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Lomkit \Access \Tests \Support \Models \Model ;
4+
5+ class ControlsScopeTest extends \Lomkit \Access \Tests \Feature \TestCase
6+ {
7+ public function test_control_controlled_scope (): void
8+ {
9+ Model::factory ()
10+ ->count (50 )
11+ ->create ();
12+
13+ $ query = Model::controlled ()->get ();
14+
15+ $ this ->assertEquals (0 , $ query ->count ());
16+ }
17+
18+ public function test_control_uncontrolled_scope (): void
19+ {
20+ Model::factory ()
21+ ->count (50 )
22+ ->create ();
23+
24+ $ query = Model::uncontrolled ();
25+
26+ $ this ->assertContains (\Lomkit \Access \Controls \HasControlScope::class, $ query ->removedScopes ());
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments