| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 29 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 31 | public function testReturnRates()  | 
            ||
| 32 |     { | 
            ||
| 33 | $from = 'FOO';  | 
            ||
| 34 | $to = 'BAR';  | 
            ||
| 35 | $expected = 100;  | 
            ||
| 36 | |||
| 37 | $this->apiCaller = $this  | 
            ||
| 38 |             ->getMockBuilder('CurrencyConverter\ApiCaller') | 
            ||
| 39 | ->disableOriginalConstructor()  | 
            ||
| 40 | ->getMock();  | 
            ||
| 41 | |||
| 42 | $this->rates = new Rates($this->apiCaller);  | 
            ||
| 43 | |||
| 44 | $this->apiCaller->expects($this->once())  | 
            ||
| 45 |             ->method('convert') | 
            ||
| 46 |             ->with('FOO', 'BAR'); | 
            ||
| 47 | |||
| 48 | $this->apiCaller->expects($this->once())  | 
            ||
| 49 |             ->method('isLastCallEmpty') | 
            ||
| 50 | ->willReturn(false);  | 
            ||
| 51 | |||
| 52 | $this->apiCaller->expects($this->once())  | 
            ||
| 53 |              ->method('getLastResponse') | 
            ||
| 54 | ->willReturn(json_encode([$from . '_' . $to => $expected]));  | 
            ||
| 55 | |||
| 56 | $result = $this->rates->getRates($from, $to);  | 
            ||
| 57 | |||
| 58 | $this->assertEquals($expected, $result);  | 
            ||
| 59 | }  | 
            ||
| 60 | }  | 
            ||
| 61 | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: