-
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
Closed
pavellishin
wants to merge
10
commits into
pantheon-systems:master
from
pavellishin:issue-408-server-info
Closed
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
df91f41
#408: Read host and port information from solr instance, not Pantheon…
pavellishin 11845b2
#408: hm, at least one test (test_wp_query_failed_ping) seems to rely…
pavellishin e1d020c
#408: formatting fixes
pavellishin 917a58f
#408: Adding test
pavellishin 6b971a4
#408: Whoops, $_ENV not $ENV
pavellishin 5fb59ca
#408: Check for env
pavellishin 539d07d
#408: Check for env with array_key_exists (why _doesn't_ it exist?)
pavellishin 51e868b
#408: use getenv
pavellishin 4c7b53e
#408: making variables available in the override function
pavellishin cffa748
#408: hm, is this empty string evaluating as falsy?
pavellishin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 = getenv('PANTHEON_INDEX_HOST'); | ||
$env_port = getenv('PANTHEON_INDEX_PORT'); | ||
$override_host = $env_host . 'OVERRIDE'; | ||
$override_port = $env_host . 'OVERRIDE'; | ||
|
||
$override_connection = function() { | ||
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 ); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 I don't think
$override_host
is defined in the context of this function. Maybe pass it in as a parameter?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.
oh, dangit. I forget how modern PHP works wrt scoping.