Skip to content

Commit

Permalink
Fixed unit test on ClientBuilderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Mar 1, 2021
1 parent b697a7b commit d5ef466
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/Elasticsearch/Tests/ClientBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,22 @@
use Elasticsearch\Client;
use Elasticsearch\ClientBuilder;
use Elasticsearch\Common\Exceptions\ElasticsearchException;
use Elasticsearch\Common\Exceptions\InvalidArgumentException;
use Elasticsearch\Tests\ClientBuilder\DummyLogger;
use PHPUnit\Framework\TestCase;

class ClientBuilderTest extends TestCase
{

public function testClientBuilderThrowsExceptionForIncorrectLoggerClass()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('$logger must implement \Psr\Log\LoggerInterface!');

ClientBuilder::create()->setLogger(new \Elasticsearch\Tests\ClientBuilder\DummyLogger());
$this->expectException(\TypeError::class);
ClientBuilder::create()->setLogger(new DummyLogger);
}

public function testClientBuilderThrowsExceptionForIncorrectTracerClass()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('$tracer must implement \Psr\Log\LoggerInterface!');

ClientBuilder::create()->setTracer(new \Elasticsearch\Tests\ClientBuilder\DummyLogger());
$this->expectException(\TypeError::class);
ClientBuilder::create()->setTracer(new DummyLogger);
}

public function testElasticClientMetaHeaderIsSentByDefault()
Expand Down

0 comments on commit d5ef466

Please sign in to comment.