Skip to content

Commit fab4b57

Browse files
committed
Use constants for default port and default host
1 parent 0a22982 commit fab4b57

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/lib/Elastica/Test/Base.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Elastica\Test;
44

55
use Elastica\Client;
6+
use Elastica\Connection;
67
use Elastica\Index;
78

89
class Base extends \PHPUnit_Framework_TestCase
@@ -16,7 +17,7 @@ protected function _getClient(array $params = array(), $callback = null)
1617
{
1718
$config = array(
1819
'host' => $this->_getHost(),
19-
'port' => getenv('ES_PORT') ?: 9200,
20+
'port' => $this->_getPort(),
2021
);
2122

2223
$config = array_merge($config, $params);
@@ -25,11 +26,19 @@ protected function _getClient(array $params = array(), $callback = null)
2526
}
2627

2728
/**
28-
* @return string Returns es host for tests
29+
* @return string Host to es for elastica tests
2930
*/
3031
protected function _getHost()
3132
{
32-
return getenv('ES_HOST') ?: 'localhost';
33+
return getenv('ES_HOST') ?: Connection::DEFAULT_HOST;
34+
}
35+
36+
/**
37+
* @return int Port to es for elastica tests
38+
*/
39+
protected function _getPort()
40+
{
41+
return getenv('ES_PORT') ?: Connection::DEFAULT_PORT;
3342
}
3443

3544
/**

0 commit comments

Comments
 (0)