File tree Expand file tree Collapse file tree 4 files changed +56
-7
lines changed Expand file tree Collapse file tree 4 files changed +56
-7
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ class FeatureTest extends TestCase
8
8
{
9
9
10
10
/** @test */
11
- public function index_repository ()
11
+ public function status ()
12
12
{
13
- $ this ->assertCount (2 , $ this ->indexRepository ->all ());
14
- $ this ->assertInstanceOf (CustomerIndex::class, $ this ->indexRepository ->get ($ this ->customerIndex ::class));
13
+ $ this ->assertSame (0 , $ this ->artisan ('elastica-bridge:status ' )->run ());
15
14
}
16
15
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Limenet \LaravelElasticaBridge \Tests \Feature ;
4
4
5
+ use Limenet \LaravelElasticaBridge \Client \ElasticaClient ;
5
6
use Limenet \LaravelElasticaBridge \Repository \IndexRepository ;
6
7
use Limenet \LaravelElasticaBridge \Tests \App \Elasticsearch \CustomerIndex ;
7
8
use Limenet \LaravelElasticaBridge \Tests \App \Elasticsearch \ProductIndex ;
@@ -18,9 +19,6 @@ public function setUp(): void
18
19
19
20
$ this ->customerIndex = $ this ->app ->make (CustomerIndex::class);
20
21
$ this ->productIndex = $ this ->app ->make (ProductIndex::class);
21
- $ this ->indexRepository = new IndexRepository ([
22
- $ this ->customerIndex ::class => $ this ->customerIndex ,
23
- $ this ->productIndex ::class => $ this ->productIndex ,
24
- ]);
22
+ $ this ->indexRepository =$ this ->app ->make (IndexRepository::class);
25
23
}
26
24
}
Original file line number Diff line number Diff line change 4
4
5
5
use Illuminate \Database \Eloquent \Factories \Factory ;
6
6
use Limenet \LaravelElasticaBridge \LaravelElasticaBridgeServiceProvider ;
7
+ use Limenet \LaravelElasticaBridge \Tests \App \Elasticsearch \CustomerIndex ;
8
+ use Limenet \LaravelElasticaBridge \Tests \App \Elasticsearch \ProductIndex ;
7
9
use Limenet \LaravelElasticaBridge \Tests \Database \Seeders \DatabaseSeeder ;
8
10
use Orchestra \Testbench \TestCase as Orchestra ;
9
11
use SetupTables ;
@@ -18,6 +20,11 @@ public function setUp(): void
18
20
fn (string $ modelName ) => 'Limenet \\LaravelElasticaBridge \\Tests \\Database \\Factories \\' .class_basename ($ modelName ).'Factory '
19
21
);
20
22
}
23
+ protected function resolveApplicationConfiguration ($ app ){
24
+ parent ::resolveApplicationConfiguration ($ app );
25
+
26
+ $ app ['config ' ]->set ('elastica-bridge.indices ' , [CustomerIndex::class,ProductIndex::class]);
27
+ }
21
28
22
29
protected function getPackageProviders ($ app )
23
30
{
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Limenet \LaravelElasticaBridge \Tests \Unit ;
4
+
5
+ use Elastica \Index ;
6
+ use Elastica \Query ;
7
+ use Elastica \Response ;
8
+ use Elastica \ResultSet ;
9
+ use Limenet \LaravelElasticaBridge \Exception \Index \BlueGreenIndicesIncorrectlySetupException ;
10
+ use Limenet \LaravelElasticaBridge \Index \IndexInterface ;
11
+ use Limenet \LaravelElasticaBridge \Repository \IndexRepository ;
12
+ use Limenet \LaravelElasticaBridge \Tests \App \Elasticsearch \CustomerIndex ;
13
+ use Limenet \LaravelElasticaBridge \Tests \App \Elasticsearch \ProductIndex ;
14
+ use Limenet \LaravelElasticaBridge \Tests \App \Models \Customer ;
15
+ use RuntimeException ;
16
+
17
+ class RepositoryTest extends TestCase
18
+ {
19
+ protected CustomerIndex $ customerIndex ;
20
+ protected ProductIndex $ productIndex ;
21
+ protected IndexRepository $ indexRepository ;
22
+
23
+ public function setUp ():void
24
+ {
25
+ parent ::setUp ();
26
+
27
+ $ this ->customerIndex = $ this ->app ->make (CustomerIndex::class);
28
+ $ this ->productIndex = $ this ->app ->make (ProductIndex::class);
29
+ $ this ->indexRepository =$ this ->app ->make (IndexRepository::class);
30
+ }
31
+ /** @test */
32
+ public function all ()
33
+ {
34
+ $ this ->assertCount (2 , $ this ->indexRepository ->all ());
35
+ foreach ($ this ->indexRepository ->all () as $ index ){
36
+ $ this ->assertInstanceOf (IndexInterface::class, $ index );
37
+ }
38
+ }
39
+ /** @test */
40
+ public function single ()
41
+ {
42
+ $ this ->assertInstanceOf (CustomerIndex::class, $ this ->indexRepository ->get ($ this ->customerIndex ::class));
43
+ $ this ->assertInstanceOf (ProductIndex::class, $ this ->indexRepository ->get ($ this ->productIndex ::class));
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments