Skip to content

Commit 9619366

Browse files
committed
Fix test
1 parent 7fac766 commit 9619366

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/Unit/Models/ModelScopeTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace LdapRecord\Tests\Unit\Models;
44

5+
use Closure;
56
use LdapRecord\Connection;
67
use LdapRecord\Container;
78
use LdapRecord\Models\Model;
@@ -19,14 +20,23 @@ protected function setUp(): void
1920

2021
Container::addConnection(new Connection);
2122

23+
DirectoryFake::setup();
24+
2225
ModelWithGlobalScopeTestStub::clearBootedModels();
2326
}
2427

28+
protected function tearDown(): void
29+
{
30+
DirectoryFake::tearDown();
31+
32+
parent::tearDown();
33+
}
34+
2535
public function test_scopes_can_be_added_to_models()
2636
{
2737
$model = new ModelWithGlobalScopeTestStub;
2838

29-
$this->assertInstanceOf(\Closure::class, $model->getGlobalScopes()['foo']);
39+
$this->assertInstanceOf(Closure::class, $model->getGlobalScopes()['foo']);
3040
$this->assertInstanceOf(ScopeTestStub::class, $model->getGlobalScopes()[ScopeTestStub::class]);
3141
}
3242

@@ -56,6 +66,12 @@ public function test_scopes_are_applied_to_query()
5666
public function test_scopes_are_applied_to_pagination_request()
5767
{
5868
$query = (new ModelWithGlobalScopeTestStub)->newQuery();
69+
70+
$query->getConnection()
71+
->getLdapConnection()
72+
->shouldAllowAnyBind()
73+
->expect(['search' => []]);
74+
5975
$this->assertEmpty($query->paginate());
6076

6177
$this->assertEquals([

0 commit comments

Comments
 (0)