Skip to content

Commit

Permalink
Add user agent to maxmind test to pass download
Browse files Browse the repository at this point in the history
  • Loading branch information
bajb committed Oct 30, 2014
1 parent 41632a4 commit 9320840
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/Cubex/Http/Visitor/MaxmindVisitorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ protected function setUp()

if(!file_exists($this->_geoipdb))
{
file_put_contents($filename, file_get_contents($dbgz));
$opts = [
'http' => [
'method' => "GET",
'header' => "Accept-language: en\r\n"
. "User-Agent: CURL (Cubex Framework; en-us)\r\n"
]
];

$context = stream_context_create($opts);

file_put_contents($filename, file_get_contents($dbgz, false, $context));

$file = gzopen($filename, 'rb');
$out = fopen($this->_geoipdb, 'wb');
Expand Down Expand Up @@ -49,8 +59,8 @@ public function testVisitor(

$cubex = $this->newCubexInstace();
$request = new \Cubex\Http\Request();
$server = array('REMOTE_ADDR' => $remoteAddr);
$request->initialize(array(), array(), array(), array(), array(), $server);
$server = ['REMOTE_ADDR' => $remoteAddr];
$request->initialize([], [], [], [], [], $server);
$cubex->instance('request', $request);

if($config === null)
Expand Down

0 comments on commit 9320840

Please sign in to comment.