3
3
namespace ScoutEngines \Postgres \Test ;
4
4
5
5
use Exception ;
6
- use Illuminate \Database \Connection ;
7
6
use Illuminate \Database \ConnectionResolverInterface ;
8
7
use Illuminate \Database \Eloquent \Collection ;
9
8
use Illuminate \Database \Eloquent \Model ;
10
9
use Illuminate \Database \Eloquent \SoftDeletes ;
10
+ use Illuminate \Database \PostgresConnection ;
11
11
use Laravel \Scout \Builder ;
12
12
use Mockery ;
13
13
use ScoutEngines \Postgres \PostgresEngine ;
@@ -36,7 +36,7 @@ public function update_adds_object_to_index()
36
36
$ query ->shouldReceive ('selectRaw ' )
37
37
->with (
38
38
'to_tsvector(COALESCE(?, get_current_ts_config()), ?) || setweight(to_tsvector(COALESCE(?, get_current_ts_config()), ?), ?) AS tsvector ' ,
39
- [null , 'Foo ' , null , '' , 'B ' ]
39
+ [' simple ' , 'Foo ' , ' simple ' , '' , 'B ' ]
40
40
)
41
41
->andReturnSelf ();
42
42
$ query ->shouldReceive ('value ' )
@@ -361,7 +361,7 @@ protected function getEngine($config = [])
361
361
{
362
362
$ resolver = Mockery::mock (ConnectionResolverInterface::class);
363
363
$ resolver ->shouldReceive ('connection ' )
364
- ->andReturn ($ db = Mockery::mock (Connection ::class));
364
+ ->andReturn ($ db = Mockery::mock (PostgresConnection ::class));
365
365
366
366
$ db ->shouldReceive ('getDriverName ' )->andReturn ('pgsql ' );
367
367
@@ -377,30 +377,30 @@ protected function setDbExpectations($db, $withDefaultOrderBy = true)
377
377
->andReturn ('plainto_tsquery(COALESCE(?, get_current_ts_config()), ?) AS "tsquery" ' );
378
378
379
379
$ table ->shouldReceive ('crossJoin ' )
380
- ->with ('plainto_tsquery(COALESCE(?, get_current_ts_config()), ?) AS "tsquery" ' )
381
- ->andReturnSelf ()
380
+ ->with ('plainto_tsquery(COALESCE(?, get_current_ts_config()), ?) AS "tsquery" ' )
381
+ ->andReturnSelf ()
382
382
->shouldReceive ('addBinding ' )
383
- ->with (Mockery::type ('array ' ), 'join ' )
384
- ->andReturnSelf ()
383
+ ->with (Mockery::type ('array ' ), 'join ' )
384
+ ->andReturnSelf ()
385
385
->shouldReceive ('select ' )
386
- ->with ('id ' )
387
- ->andReturnSelf ()
386
+ ->with ('id ' )
387
+ ->andReturnSelf ()
388
388
->shouldReceive ('selectRaw ' )
389
- ->with ('ts_rank(searchable,"tsquery") AS rank ' )
390
- ->andReturnSelf ()
389
+ ->with ('ts_rank(searchable,"tsquery") AS rank ' )
390
+ ->andReturnSelf ()
391
391
->shouldReceive ('selectRaw ' )
392
- ->with ('COUNT(*) OVER () AS total_count ' )
393
- ->andReturnSelf ()
392
+ ->with ('COUNT(*) OVER () AS total_count ' )
393
+ ->andReturnSelf ()
394
394
->shouldReceive ('whereRaw ' )
395
- ->andReturnSelf ();
395
+ ->andReturnSelf ();
396
396
397
397
if ($ withDefaultOrderBy ) {
398
398
$ table ->shouldReceive ('orderBy ' )
399
- ->with ('rank ' , 'desc ' )
400
- ->andReturnSelf ()
399
+ ->with ('rank ' , 'desc ' )
400
+ ->andReturnSelf ()
401
401
->shouldReceive ('orderBy ' )
402
- ->with ('id ' )
403
- ->andReturnSelf ();
402
+ ->with ('id ' )
403
+ ->andReturnSelf ();
404
404
}
405
405
406
406
$ table ->shouldReceive ('toSql ' );
0 commit comments