CurrencyConverterFixedRatesUIWebTestCase.test in Currency 7.2
Contains class CurrencyExchangerFixedRatesUIWebTestCase.
File
currency/tests/CurrencyConverterFixedRatesUIWebTestCase.testView source
<?php
/**
* @file
* Contains class CurrencyExchangerFixedRatesUIWebTestCase.
*/
/**
* Tests the UI for CurrencyExchangerFixedRates.
*/
class CurrencyExchangerFixedRatesUIWebTestCase extends DrupalWebTestCase {
/**
* Implements DrupalTestCase::getInfo().
*/
static function getInfo() {
return array(
'description' => '',
'name' => 'CurrencyExchangerFixedRates UI',
'group' => 'Currency',
);
}
/**
* Overrides parent::setUp().
*/
function setUp(array $modules = array()) {
$this->profile = 'testing';
parent::setUp($modules + array(
'currency',
));
}
/**
* Test CurrencyExchanger's UI.
*/
function testCurrencyExchangerFixedRatesUI() {
$user = $this
->drupalCreateUser(array(
'currency.currency_exchanger.administer',
));
$this
->drupalLogin($user);
$path = 'admin/config/regional/currency-exchange/fixed';
// Test the overview.
$this
->drupalGet($path);
$this
->assertText(t('Add an exchange rate'));
$currency_code_from = 'EUR';
$currency_code_to = 'NLG';
// Test adding a exchange rate.
$rate = '3';
$values = array(
'currency_code_from' => $currency_code_from,
'currency_code_to' => $currency_code_to,
'rate[amount]' => $rate,
);
$this
->drupalPost($path . '/add', $values, t('Save'));
$this
->assertIdentical(CurrencyExchangerFixedRates::load($currency_code_from, $currency_code_to), $rate);
// Test editing a exchange rate.
$rate = '6';
$values = array(
'rate[amount]' => $rate,
);
$this
->drupalPost($path . '/' . $currency_code_from . '/' . $currency_code_to, $values, t('Save'));
drupal_static_reset('CurrencyExchangerFixedRates');
$this
->assertIdentical(CurrencyExchangerFixedRates::load($currency_code_from, $currency_code_to), $rate);
// Test deleting a exchange rate.
$this
->drupalPost($path . '/' . $currency_code_from . '/' . $currency_code_to, $values, t('Delete'));
drupal_static_reset('CurrencyExchangerFixedRates');
$this
->assertFalse(CurrencyExchangerFixedRates::load($currency_code_from, $currency_code_to));
}
}
Classes
Name | Description |
---|---|
CurrencyExchangerFixedRatesUIWebTestCase | Tests the UI for CurrencyExchangerFixedRates. |