9
9
10
10
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
11
11
*/
12
+
12
13
namespace HyperfTest \Scout \Cases ;
13
14
15
+ use Hyperf \Database \Model \Collection ;
14
16
use HyperfTest \Scout \Stub \ContainerStub ;
15
17
use HyperfTest \Scout \Stub \ModelStubForMakeAllSearchable ;
16
18
use HyperfTest \Scout \Stub \SearchableModel ;
@@ -39,7 +41,7 @@ protected function tearDown(): void
39
41
40
42
public function testSearchableUsingUpdateIsCalledOnCollection ()
41
43
{
42
- $ collection = m::mock (\ Hyperf \ Database \ Model \ Collection::class);
44
+ $ collection = m::mock (Collection::class);
43
45
$ collection ->shouldReceive ('isEmpty ' )->andReturn (false );
44
46
$ collection ->shouldReceive ('first->searchableUsing->update ' )->with ($ collection );
45
47
$ model = new SearchableModel ();
@@ -48,7 +50,7 @@ public function testSearchableUsingUpdateIsCalledOnCollection()
48
50
49
51
public function testSearchableUsingUpdateIsNotCalledOnEmptyCollection ()
50
52
{
51
- $ collection = m::mock (\ Hyperf \ Database \ Model \ Collection::class);
53
+ $ collection = m::mock (Collection::class);
52
54
$ collection ->shouldReceive ('isEmpty ' )->andReturn (true );
53
55
$ collection ->shouldNotReceive ('first->searchableUsing->update ' );
54
56
$ model = new SearchableModel ();
@@ -57,7 +59,7 @@ public function testSearchableUsingUpdateIsNotCalledOnEmptyCollection()
57
59
58
60
public function testSearchableUsingDeleteIsCalledOnCollection ()
59
61
{
60
- $ collection = m::mock (\ Hyperf \ Database \ Model \ Collection::class);
62
+ $ collection = m::mock (Collection::class);
61
63
$ collection ->shouldReceive ('isEmpty ' )->andReturn (false );
62
64
$ collection ->shouldReceive ('first->searchableUsing->delete ' )->with ($ collection );
63
65
$ model = new SearchableModel ();
@@ -66,7 +68,7 @@ public function testSearchableUsingDeleteIsCalledOnCollection()
66
68
67
69
public function testSearchableUsingDeleteIsNotCalledOnEmptyCollection ()
68
70
{
69
- $ collection = m::mock (\ Hyperf \ Database \ Model \ Collection::class);
71
+ $ collection = m::mock (Collection::class);
70
72
$ collection ->shouldReceive ('isEmpty ' )->andReturn (true );
71
73
$ collection ->shouldNotReceive ('first->searchableUsing->delete ' );
72
74
$ model = new SearchableModel ();
0 commit comments