public function testFallbackByCountry()
 {
     // With 'FallbackCurrencyByCountry', we need to return a single supported currency
     TestingGenericAdapter::$acceptedCurrencies = array('USD');
     TestingGenericAdapter::$fakeGlobals = array('FallbackCurrency' => false, 'FallbackCurrencyByCountry' => true);
     $this->setUpAdapter();
     $this->adapter->addRequestData(array('country' => 'US'));
     $this->page->validateForm();
     $this->assertEquals(100, $this->adapter->getData_Unstaged_Escaped('amount'));
     $this->assertEquals('USD', $this->adapter->getData_Unstaged_Escaped('currency_code'));
 }
 /**
  * @covers DataValidator::validate_gateway
  */
 public function testBadGatewayError()
 {
     $badGateway = uniqid();
     // The gateway is calculated from adapter class, so this validation
     // doesn't happen in practice and we can't fake a bad gateway using
     // GatewayAdapter::addRequestData().
     TestingGenericAdapter::$fakeIdentifier = $badGateway;
     $this->adapter = new TestingGenericAdapter();
     $this->page->adapter = $this->adapter;
     $this->page->validateForm();
     $this->assertFalse($this->adapter->validatedOK());
     $errors = $this->adapter->getValidationErrors();
     $this->assertArrayHasKey('general', $errors);
 }