-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elastic cloud provider connection credential implemented and config t…
…ests improved
- Loading branch information
Showing
5 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\ElasticSearch\Config; | ||
|
||
use Illuminate\Support\Facades\Config; | ||
use Matchish\ScoutElasticSearch\ElasticSearch\Config\Config as ScoutConfig; | ||
use Tests\TestCase; | ||
|
||
class ConfigTest extends TestCase | ||
{ | ||
public function test_parse_host(): void | ||
{ | ||
Config::set('elasticsearch.host', 'http://localhost:9200'); | ||
|
||
$config = new ScoutConfig(); | ||
$this->assertEquals(['http://localhost:9200'], $config::hosts()); | ||
} | ||
|
||
public function test_parse_multihost(): void | ||
{ | ||
Config::set('elasticsearch.host', 'http://localhost:9200,http://localhost:9201'); | ||
|
||
$config = new ScoutConfig(); | ||
$this->assertEquals(['http://localhost:9200', 'http://localhost:9201'], $config::hosts()); | ||
} | ||
|
||
public function test_parse_username_password(): void | ||
{ | ||
Config::set('elasticsearch.host', 'http://localhost:9200,http://localhost:9201'); | ||
Config::set('elasticsearch.user', 'elastic'); | ||
Config::set('elasticsearch.password', 'pass'); | ||
|
||
$config = new ScoutConfig(); | ||
$this->assertEquals('elastic', $config::user()); | ||
$this->assertEquals('pass', $config::password()); | ||
} | ||
|
||
public function test_parse_elastic_cloud_id(): void | ||
{ | ||
Config::set('elasticsearch.host', 'http://localhost:9200,http://localhost:9201'); | ||
Config::set('elasticsearch.cloud_id', 'cloud-id'); | ||
Config::set('elasticsearch.api_key', '123456'); | ||
|
||
$config = new ScoutConfig(); | ||
$this->assertEquals('cloud-id', $config::elasticCloudId()); | ||
$this->assertEquals('123456', $config::apiKey()); | ||
} | ||
} |