Skip to content

Commit

Permalink
Tests fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Jan 18, 2016
1 parent 413c25f commit 666113d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Payment/LuckyMoney/API.php
Expand Up @@ -129,7 +129,7 @@ public function send(array $params, $type = self::TYPE_NORMAL)
public function sendNormal($params)
{
$params['total_num'] = 1;
$params['client_ip'] = $params['client_ip'] ?: $_SERVER['HTTP_CLIENT_IP'];
$params['client_ip'] = !empty($params['client_ip']) ? $params['client_ip'] : $_SERVER['HTTP_CLIENT_IP'];

return $this->send($params, self::TYPE_NORMAL);
}
Expand All @@ -144,7 +144,7 @@ public function sendNormal($params)
public function sendGroup($params)
{
$params['amt_type'] = 'ALL_RAND';
$params['client_ip'] = $params['client_ip'] ?: $_SERVER['HTTP_CLIENT_IP'];
$params['client_ip'] = !empty($params['client_ip']) ? $params['client_ip'] : $_SERVER['HTTP_CLIENT_IP'];

return $this->send($params, self::TYPE_GROUP);
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Payment/PaymentLuckyMoneyAPITest.php
Expand Up @@ -16,6 +16,11 @@

class PaymentLuckyMoneyAPITest extends PHPUnit_Framework_TestCase
{
public static function setUpBeforeClass()
{
$_SERVER['HTTP_CLIENT_IP'] = '127.0.0.1';
}

/**
* Build API instance.
*
Expand Down

0 comments on commit 666113d

Please sign in to comment.