Exemplo n.º 1
0
 public function testCurrency()
 {
     // Loop and test
     for ($i = 0; $i < $this->tests; $i++) {
         // Build value
         $value = rand($this->start, $this->end) / 100;
         // Setup
         $currency = new Currency($this->exchange, new RuntimeFormat());
         // Assert it
         $this->assertEquals('&pound;' . number_format($value, 2), $currency->convert($value)->from('GBP')->to('GBP')->format());
     }
 }
Exemplo n.º 2
0
 public function testGBPtoUSDCurrency()
 {
     // Variables
     $rate = $this->exchange->get('USD');
     // Loop and test
     for ($i = 0; $i < $this->tests; $i++) {
         // Build value
         $value = rand($this->start, $this->end) / 100;
         // Setup
         $currency = new Currency($this->exchange, new RuntimeFormat());
         // Assert it
         $this->assertEquals('$' . number_format($value * $rate, 2), $currency->convert($value)->from('GBP')->to('USD')->format());
     }
 }