CurrencyHelperTest::convertTest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace CountryCurrencyConverter\Tests\src\Services;
4
5
use CountryCurrencyConverter\src\Services\CurrencyHelper;
6
7
class CurrencyHelperTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * @test
11
     */
12
    public function convertTest() 
13
    {        
14
        $get = file_get_contents("https://www.google.com/finance/converter?a=10&from=USD&to=INR");
15
        $get = explode("<span class=bld>",$get);
16
        $get = explode("</span>",$get[1]);  
17
        $exceptedResult = preg_replace("/[^0-9\.]/", null, $get[0]);
18
        
19
        $actualResult = CurrencyHelper::convert('USD', 'INR', 10, false);
20
        
21
        
22
        $this->assertEquals($exceptedResult, $actualResult);
23
    }
24
25
}
26