-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read host and port information from solr instance, not Pantheon env variables #411
Changes from 7 commits
df91f41
11845b2
e1d020c
917a58f
6b971a4
5fb59ca
539d07d
51e868b
4c7b53e
cffa748
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
class SolrPowerAPITest extends SolrTestBase { | ||
|
||
function setUp() { | ||
parent::setUp(); | ||
} | ||
|
||
function tearDown() { | ||
parent::tearDown(); | ||
} | ||
|
||
|
||
function test_server_info_uses_actual_config() { | ||
$env_host = array_key_exists('PANTHEON_INDEX_HOST', $_ENV) ? $_ENV['PANTHEON_INDEX_HOST'] : ''; | ||
$env_port = array_key_exists('PANTHEON_INDEX_PORT', $_ENV) ? $_ENV['PANTHEON_INDEX_PORT'] : ''; | ||
$override_host = $env_host . 'OVERRIDE'; | ||
$override_port = $env_host . 'OVERRIDE'; | ||
|
||
$override_connection = function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pavellishin I don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, dangit. I forget how modern PHP works wrt scoping. |
||
return array( | ||
'endpoint' => array( | ||
'localhost' => array( | ||
'host' => $override_host, | ||
'port' => $override_port, | ||
'path' => '', | ||
) | ||
), | ||
); | ||
}; | ||
add_filter( 's4wp_connection_options', $override_connection ); | ||
|
||
$server_info = SolrPower_Api::get_instance()->get_server_info(); | ||
|
||
$this->assertEquals( $override_host, $server_info['ip_address'] ); | ||
$this->assertEquals( $override_port, $server_info['port'] ); | ||
|
||
remove_filter( 's4wp_connection_options', $override_connection ); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavellishin try using
getenv
instead of the$_ENV
globalThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, duh, I thought the previous code accessed it directly :P