Skip to content

Commit 1faeb20

Browse files
committed
more tests
1 parent b11b1b6 commit 1faeb20

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tests/IndexTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Limenet\LaravelElasticaBridge\Tests;
44

5+
use Elastica\Client;
6+
use Elastica\Index;
57
use Limenet\LaravelElasticaBridge\Tests\App\Elasticsearch\CustomerIndex;
68

79
class IndexTest extends TestCase
@@ -15,11 +17,20 @@ public function setUp():void
1517
$this->customerIndex = $this->app->make(CustomerIndex::class);
1618
}
1719
/** @test */
18-
public function index_settings()
20+
public function raw_index()
21+
{
22+
$index = $this->customerIndex->getElasticaIndex();
23+
$this->assertInstanceOf(Index::class, $index);
24+
$this->assertSame($this->customerIndex->getName(),$index->getName());
25+
}
26+
27+
/** @test */
28+
public function settings()
1929
{
2030
$settings = $this->customerIndex->getCreateArguments();
21-
if ($this->customerIndex->hasMapping()) {
31+
$mappings = $this->customerIndex->getMapping();
32+
$this->assertTrue($this->customerIndex->hasMapping());
2233
$this->assertArrayHasKey('mappings', $settings);
23-
}
34+
$this->assertSame($settings['mappings'],$mappings);
2435
}
2536
}

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Database\Eloquent\Factories\Factory;
66
use Illuminate\Foundation\Testing\RefreshDatabase;
77
use Limenet\LaravelElasticaBridge\LaravelElasticaBridgeServiceProvider;
8+
use Limenet\LaravelElasticaBridge\Tests\App\Elasticsearch\CustomerIndex;
89
use Limenet\LaravelElasticaBridge\Tests\Database\Seeders\DatabaseSeeder;
910
use Orchestra\Testbench\TestCase as Orchestra;
1011
use SetupTables;

0 commit comments

Comments
 (0)