CurrencyConverterTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A convertCurrencyTest() 0 13 1
1
<?php
2
3
namespace CountryCurrencyConverter\Tests;
4
5
use CountryCurrencyConverter\CurrencyConverter;
6
7
class CurrencyConverterTest extends \PHPUnit_Framework_TestCase {
8
    
9
    /**
10
     * @test
11
     */
12
    public function convertCurrencyTest()
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
        $currencyConverter = new CurrencyConverter();
20
        
21
        $actualResult = $currencyConverter->convertCurrency('USD', 'INR', 10);
22
        
23
        $this->assertEquals($exceptedResult." ₹", $actualResult);
24
    }
25
}
26