Exemplo n.º 1
0
 /**
  * Constructor populates allowed codes with defaults and optionally filters those passed as an argument
  * @param  array|NULL $allow An array of currency codes to allow
  * @param  array|NULL $deny  An array of currency codes to remove from the allowed list, or remove from the defaults if no allow is set
  * @return void
  */
 public function __construct($allow = NULL, $deny = NULL)
 {
     $this->defaults = Currency::getAvailableCurrencies();
     if (NULL !== $allow) {
         $this->setAllow($allow);
     }
     if (NULL !== $deny) {
         $this->remove($deny);
     }
 }
Exemplo n.º 2
0
 /**
  * covers \NetglueMoney\Money\Currency::getAvailableCurrencies
  */
 public function testGetAvailableCurencies()
 {
     $array = Currency::getAvailableCurrencies();
     $this->assertInternalType('array', $array);
     $this->assertContainsOnly('string', $array);
     foreach ($array as $code) {
         $this->assertRegExp('/^[A-Z]{3}$/', $code);
     }
 }