Skip to content

Commit

Permalink
Merge pull request #92 from nadsrosun/hotfix-google-finance-provider
Browse files Browse the repository at this point in the history
Update to latest google finance endpoint
  • Loading branch information
florianv authored Nov 9, 2017
2 parents 15802bc + 36ac0de commit 68bffd1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Provider/CentralBankOfRepublicTurkeyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Central Bank of Republic of Turkey (CBRT) provider.
*
* @link http://tcmb.gov.tr
* @see http://tcmb.gov.tr
*
* @author Uğur Erkan <[email protected]>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/GoogleFinanceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class GoogleFinanceProvider extends AbstractProvider
{
const URL = 'http://www.google.com/finance/converter?a=1&from=%s&to=%s';
const URL = 'https://finance.google.com/finance/converter?a=1&from=%s&to=%s';

/**
* {@inheritdoc}
Expand Down
1 change: 1 addition & 0 deletions src/Util/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static function jsonToArray($string)

if (JSON_ERROR_NONE !== json_last_error()) {
$last = json_last_error();

throw new \RuntimeException(
'Unable to parse JSON data: '
.(isset($jsonErrors[$last]) ? $jsonErrors[$last] : 'Unknown error')
Expand Down
1 change: 1 addition & 0 deletions tests/Tests/Provider/CurrencyLayerProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Swap\Tests\Provider;

use Swap\Model\CurrencyPair;
Expand Down
6 changes: 3 additions & 3 deletions tests/Tests/Provider/GoogleFinanceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GoogleFinanceProviderTest extends AbstractProviderTestCase
*/
public function it_throws_an_exception_when_rate_not_supported()
{
$uri = 'http://www.google.com/finance/converter?a=1&from=EUR&to=XXL';
$uri = 'https://finance.google.com/finance/converter?a=1&from=EUR&to=XXL';
$content = file_get_contents(__DIR__.'/../../Fixtures/Provider/GoogleFinance/unsupported.html');

$provider = new GoogleFinanceProvider($this->getHttpAdapterMock($uri, $content));
Expand All @@ -34,7 +34,7 @@ public function it_throws_an_exception_when_rate_not_supported()
*/
public function it_fetches_a_rate()
{
$url = 'http://www.google.com/finance/converter?a=1&from=EUR&to=USD';
$url = 'https://finance.google.com/finance/converter?a=1&from=EUR&to=USD';
$content = file_get_contents(__DIR__.'/../../Fixtures/Provider/GoogleFinance/success.html');

$provider = new GoogleFinanceProvider($this->getHttpAdapterMock($url, $content));
Expand All @@ -49,7 +49,7 @@ public function it_fetches_a_rate()
*/
public function it_has_no_php_errors()
{
$url = 'http://www.google.com/finance/converter?a=1&from=EUR&to=USD';
$url = 'https://finance.google.com/finance/converter?a=1&from=EUR&to=USD';
$content = file_get_contents(__DIR__.'/../../Fixtures/Provider/GoogleFinance/success.html');

$provider = new GoogleFinanceProvider($this->getHttpAdapterMock($url, $content));
Expand Down

0 comments on commit 68bffd1

Please sign in to comment.