class CommerceTaxUIAdminTest in Commerce Core 7
Functional tests for the commerce tax UI module.
Hierarchy
- class \DrupalTestCase
- class \DrupalWebTestCase
- class \CommerceBaseTestCase
- class \CommerceTaxUIAdminTest
- class \CommerceBaseTestCase
- class \DrupalWebTestCase
Expanded class hierarchy of CommerceTaxUIAdminTest
File
- modules/
tax/ tests/ commerce_tax_ui.test, line 11 - Functional tests for the commerce tax UI module.
View source
class CommerceTaxUIAdminTest extends CommerceBaseTestCase {
/**
* Normal user (without admin or store permissions) for testing.
*/
protected $normal_user;
/**
* Tax type.
*/
protected $tax_type;
/**
* Implementation of getInfo().
*/
public static function getInfo() {
return array(
'name' => 'Tax administration',
'description' => 'Test creating, editing and deleting tax rates and tax types using the tax administration user interface.',
'group' => 'Drupal Commerce',
);
}
/**
* Implementation of setUp().
*/
function setUp() {
$modules = parent::setUpHelper('all');
parent::setUp($modules);
// User creation for different operations.
$this->store_admin = $this
->createStoreAdmin();
$this->normal_user = $this
->drupalCreateUser(array(
'access checkout',
'view own commerce_order entities',
));
// Create a dummy tax type for testing.
$this->tax_type = $this
->createDummyTaxType();
}
/**
* Go through the checkout process.
*/
protected function commerceTaxHelperCompleteCheckout() {
// Get the checkout url and navigate to it.
$links = commerce_line_item_summary_links();
$this->checkout_url = $links['checkout']['href'];
$this
->drupalGet($this->checkout_url);
// The rule that sends a mail after checkout completion should be disabled
// as it returns an error caused by how mail messages are stored.
$rules_config = rules_config_load('commerce_checkout_order_email');
$rules_config->active = FALSE;
$rules_config
->save();
// Complete the order process.
$billing_pane = $this
->xpath("//select[starts-with(@name, 'customer_profile_billing[commerce_customer_address]')]");
$this
->drupalPostAJAX(NULL, array(
(string) $billing_pane[0]['name'] => 'US',
), (string) $billing_pane[0]['name']);
$info = array(
'customer_profile_billing[commerce_customer_address][und][0][name_line]' => $this
->randomName(),
'customer_profile_billing[commerce_customer_address][und][0][thoroughfare]' => $this
->randomName(),
'customer_profile_billing[commerce_customer_address][und][0][locality]' => $this
->randomName(),
'customer_profile_billing[commerce_customer_address][und][0][administrative_area]' => 'KY',
'customer_profile_billing[commerce_customer_address][und][0][postal_code]' => rand(00, 99999),
);
$this
->drupalPost(NULL, $info, t('Continue to next step'));
$this
->drupalPost(NULL, array(), t('Continue to next step'));
}
/**
* Test access to tax rates listing.
*/
public function testCommerceTaxUIAccessTaxRates() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the Tax rates listing.
$this
->drupalGet('admin/commerce/config/taxes');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax rates listing page'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the Tax rates listing.
$this
->drupalGet('admin/commerce/config/taxes');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax rates listing page'));
// Check if the add link is there.
$this
->assertText(t('Add a tax rate'), t('%link link is present in the tax rates listing page', array(
'%link' => t('Add a tax rate'),
)));
// There shouldn't be any tax rate yet.
$this
->assertRaw(t('There are no tax rates yet. <a href="@link">Add a tax rate</a>.', array(
'@link' => url('admin/commerce/config/taxes/rates/add'),
)), t('Empty tax rate listing message is displayed'));
}
/**
* Test the creation of a tax rate.
*/
public function testCommerceTaxUICreateTaxRate() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the creation page for tax rates.
$this
->drupalGet('admin/commerce/config/taxes/rates/add');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the creation page for tax rates'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the creation page for tax rates.
$this
->drupalGet('admin/commerce/config/taxes/rates/add');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the creation page for tax rates'));
// Check the integrity of the tax rate form.
$this
->pass(t('Test the integrity of the tax rate add form:'));
$this
->assertFieldByXPath('//input[@id="edit-tax-rate-title" and contains(@class, "required")]', NULL, t('Tax rate title field is present and is required'));
$this
->assertFieldById('edit-tax-rate-display-title', NULL, t('Tax rate display title field is present'));
$this
->assertFieldById('edit-tax-rate-description', NULL, t('Tax rate description is present'));
$this
->assertFieldByXPath('//input[@id="edit-tax-rate-rate" and contains(@class, "required")]', 0, t('Tax rate rate field is present, has 0 as default value and is required'));
$this
->assertFieldByXPath('//select[@id="edit-tax-rate-type" and contains(@class, "required")]', NULL, t('Tax rate type field is present and is required'));
$tax_select_types = $this
->xpath('//select[@id="edit-tax-rate-type"]//option');
foreach (commerce_tax_types() as $tax_type) {
$this
->assertTrue(in_array($tax_type['display_title'], (array) $tax_select_types), t('Tax rate type %type is available for the rate', array(
'%type' => $tax_type['display_title'],
)));
}
$this
->assertFieldById('edit-submit', t('Save tax rate'), t('\'Save tax rate\' button is present'));
$this
->assertRaw(l(t('Cancel'), 'admin/commerce/config/taxes'), t('Cancel link is present'));
// Fill the tax rate information and save tax rate.
$edit = array(
'tax_rate[title]' => 'Example tax rate',
'tax_rate[name]' => 'example_tax_rate',
'tax_rate[display_title]' => 'Example tax rate',
'tax_rate[description]' => 'Example tax rate for testing',
'tax_rate[rate]' => rand(1, 100) / 1000,
'tax_rate[type]' => 'example_tax_type',
);
$this
->drupalPost(NULL, $edit, t('Save tax rate'));
// Check the url after creation and if the values have been saved.
$this
->assertTrue($this->url == url('admin/commerce/config/taxes', array(
'absolute' => TRUE,
)), t('After saving a tax rate we are in the list of tax rates'));
$this
->assertText($edit['tax_rate[title]'], t('Title of the tax rate is present in the tax rates listing'));
$this
->assertText($edit['tax_rate[name]'], t('Machine name of the tax rate is present in the tax rates listing'));
$this
->assertText($edit['tax_rate[description]'], t('Description of the tax rate is present in the tax rates listing'));
$this
->assertText(trim($edit['tax_rate[rate]']), t('Rate value of the tax rate is present in the tax rates listing'));
// Check in database if the tax rate has been created.
commerce_tax_rates_reset();
$tax_rate = commerce_tax_rate_load($edit['tax_rate[name]']);
$this
->assertFalse(empty($tax_rate), t('Tax is stored in database'));
}
/**
* Test editing a tax rate.
*/
public function testCommerceTaxUIEditTaxRate() {
// Create a tax rate.
$tax_rate = $this
->createDummyTaxRate();
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the edit page for tax rates.
$this
->drupalGet('admin/commerce/config/taxes/rates/' . strtr($tax_rate['name'], '_', '-') . '/edit');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax rate edit page'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the edit page for tax rates.
$this
->drupalGet('admin/commerce/config/taxes/rates/' . strtr($tax_rate['name'], '_', '-') . '/edit');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax rate edit page'));
// Check if the data loaded in the edit form matches with the tax rate.
$this
->pass(t('Test if the rate is correctly loaded in the edit form:'));
$this
->assertFieldById('edit-tax-rate-title', $tax_rate['title'], t('Title field corresponds with tax rate'));
$this
->assertText($tax_rate['name'], t('Machine name field corresponds with tax rate'));
$this
->assertFieldById('edit-tax-rate-display-title', $tax_rate['display_title'], t('Display title field corresponds with tax rate'));
$this
->assertFieldById('edit-tax-rate-rate', $tax_rate['rate'], t('Rate field corresponds with tax rate'));
$this
->assertOptionSelected('edit-tax-rate-type', $tax_rate['type'], t('Type select value corresponds with tax rate'));
$this
->assertFieldById('edit-submit', t('Save tax rate'), t('\'Save tax rate\' button is present'));
$this
->assertFieldById('edit-delete', t('Delete tax rate'), t('Delete button is present'));
$this
->assertRaw(l(t('Cancel'), 'admin/commerce/config/taxes'), t('Cancel link is present'));
// Modify tax rate information and save the form.
$edit = array(
'tax_rate[title]' => 'Altered tax rate',
'tax_rate[display_title]' => 'Altered tax rate',
'tax_rate[description]' => 'Altered tax rate for testing',
'tax_rate[rate]' => $tax_rate['rate'] + rand(1, 100) / 1000,
'tax_rate[type]' => 'vat',
);
$this
->drupalPost(NULL, $edit, t('Save tax rate'));
// Check the url after edit and if the values have been loaded.
$this
->assertTrue($this->url == url('admin/commerce/config/taxes', array(
'absolute' => TRUE,
)), t('After saving a tax rate we are in the list of tax rates'));
$this
->assertText($edit['tax_rate[title]'], t('Title of the tax rate is present in the tax rates listing'));
$this
->assertText($edit['tax_rate[description]'], t('Description of the tax rate is present in the tax rates listing'));
$this
->assertText(trim($edit['tax_rate[rate]']), t('Rate value of the tax rate is present in the tax rates listing'));
$this
->assertText(t('Tax rate saved.'), t('\'Tax rate saved\' message is displayed'));
// Check in database if the tax rate has been correctly modified.
commerce_tax_rates_reset();
$tax_rate = commerce_tax_rate_load($tax_rate['name']);
$this
->assertFalse(empty($tax_rate), t('Tax is present in database'));
$this
->assertTrue($tax_rate['title'] = $edit['tax_rate[title]'], t('Tax title is correctly saved in database'));
$this
->assertTrue($tax_rate['display_title'] = $edit['tax_rate[display_title]'], t('Tax display title is correctly saved in database'));
$this
->assertTrue($tax_rate['description'] = $edit['tax_rate[description]'], t('Tax description is correctly saved in database'));
$this
->assertTrue($tax_rate['rate'] = $edit['tax_rate[rate]'], t('Tax rate is correctly saved in database'));
$this
->assertTrue($tax_rate['type'] = $edit['tax_rate[type]'], t('Tax type is correctly saved in database'));
}
/**
* Test deleting a tax rate.
*/
public function testCommerceTaxUIDeleteTaxRate() {
// Create a tax rate.
$tax_rate = $this
->createDummyTaxRate();
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the deletion page for tax rates.
$this
->drupalGet('admin/commerce/config/taxes/rates/' . strtr($tax_rate['name'], '_', '-') . '/delete');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the delete form of a tax rate'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the deletion page for tax rates.
$this
->drupalGet('admin/commerce/config/taxes/rates/' . strtr($tax_rate['name'], '_', '-') . '/delete');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the delete form of a tax rate'));
// Check the integrity of the tax rate delete confirmation form.
$this
->pass('Test the tax rate delete confirmation form:');
$this
->assertTitle(t('Are you sure you want to delete the !title tax rate?', array(
'!title' => $tax_rate['title'],
)) . ' | Drupal', t('The confirmation message is displayed'));
$this
->assertText(t('This action cannot be undone'), t('A warning notifying the user about the action can\'t be undone is displayed.'));
$this
->assertFieldById('edit-submit', t('Delete'), t('Delete button is present'));
$this
->assertText(t('Cancel'), t('Cancel is present'));
// Confirm delete.
$this
->drupalPost(NULL, array(), t('Delete'));
// Check the url after deleting and if the tax rate has been deleted in
// database.
$this
->assertTrue($this->url == url('admin/commerce/config/taxes', array(
'absolute' => TRUE,
)), t('Landing page after deleting a tax rate is the tax rates listing page'));
$this
->assertRaw(t('The tax rate %title has been deleted.', array(
'%title' => $tax_rate['title'],
)), t('\'Tax rate has been deleted\' message is displayed'));
$this
->assertRaw(t('There are no tax rates yet. <a href="@link">Add a tax rate</a>.', array(
'@link' => url('admin/commerce/config/taxes/rates/add'),
)), t('Empty tax rate listing message is displayed'));
commerce_tax_rates_reset();
$tax_rate = commerce_tax_rate_load($tax_rate['name']);
$this
->assertTrue(empty($tax_rate), t('Tax is correctly deleted from database'));
}
/**
* Test configuring a tax rate.
*/
public function testCommerceTaxUIConfigureTaxRate() {
// Create a tax rate.
$tax_rate = $this
->createDummyTaxRate();
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the configure component page for tax rates.
$this
->drupalGet('admin/config/workflow/rules/components/manage/' . $tax_rate['rules_component']);
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the component configure page for a tax rate'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the configure component page for tax rates.
$this
->drupalGet('admin/config/workflow/rules/components/manage/' . $tax_rate['rules_component']);
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the component configure page for a tax rate'));
// Add a condition
$this
->assertLink(t('Add condition'), 0, t('Add condition link is present'));
$this
->clickLink(t('Add condition'));
// Select a basic condition as at this step we're only testing if the
// saving process is working.
$this
->drupalPost(NULL, array(
'element_name' => 'entity_is_of_type',
), t('Continue'));
$this
->drupalPost(NULL, array(
'parameter[entity][settings][entity:select]' => 'commerce-line-item',
'parameter[type][settings][type]' => 'commerce_line_item',
), t('Save'));
// Check that after saving the url is correct and the condition has been
// added.
$this
->assertTrue($this->url == url('admin/config/workflow/rules/components/manage/' . $tax_rate['rules_component'], array(
'absolute' => TRUE,
)), t('After adding a new condition component the landing page is the edit components one'));
$this
->assertText(t('Entity is of type'), t('Condition was added correctly'));
}
/**
* Test access to tax types listing.
*/
public function testCommerceTaxUIAccessTaxTypes() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the tax rate types listing.
$this
->drupalGet('admin/commerce/config/taxes/types');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax types listing'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate types listing.
$this
->drupalGet('admin/commerce/config/taxes/types');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax types listing'));
// Load the tax rate types and check that all of them are in the page.
$tax_types = commerce_tax_types();
foreach ($tax_types as $tax_type) {
$this
->assertText($tax_type['display_title'], t('Tax type !name is present in the tax types listing page', array(
'!name' => $tax_type['display_title'],
)));
}
// Look for the Add tax type link.
$this
->assertText(t('Add a tax type'), t('%link link is present in the tax rates listing page', array(
'%link' => t('Add a tax type'),
)));
}
/**
* Test the creation of a tax type.
*/
public function testCommerceTaxUICreateTaxType() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the tax rate types create page.
$this
->drupalGet('admin/commerce/config/taxes/types/add');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax type creation'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate types create page.
$this
->drupalGet('admin/commerce/config/taxes/types/add');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax type creation'));
// Check the integrity of the creation form.
$this
->pass(t('Test the integrity of the tax type add form:'));
$this
->assertFieldByXPath('//input[@id="edit-tax-type-title" and contains(@class, "required")]', NULL, t('Tax type title field is present and is required'));
$this
->assertFieldById('edit-tax-type-display-title', NULL, t('Tax type display title is present'));
$this
->assertFieldById('edit-tax-type-description', NULL, t('Tax type description is present'));
$this
->assertFieldById('edit-tax-type-display-inclusive', NULL, t('Tax type checkbox for configure inclusive taxes is present'));
$this
->assertFieldById('edit-submit', t('Save tax type'), t('\'Save tax type\' button is present'));
$this
->assertRaw(l(t('Cancel'), 'admin/commerce/config/taxes/types'), t('Cancel link is present'));
// Save the tax type.
$edit = array(
'tax_type[title]' => 'Additional tax type',
'tax_type[name]' => 'additional_tax_rate',
'tax_type[display_title]' => 'Additional tax rate',
'tax_type[description]' => 'Additional tax rate for testing',
'tax_type[display_inclusive]' => 1,
);
$this
->drupalPost(NULL, $edit, t('Save tax type'));
// Check the url after saving and if the tax type loads in the form.
$this
->assertTrue($this->url == url('admin/commerce/config/taxes/types', array(
'absolute' => TRUE,
)), t('After saving a tax type we are in the list of tax types'));
$this
->assertText($edit['tax_type[title]'], t('Title of the tax type is present in the tax rates listing'));
$this
->assertText($edit['tax_type[name]'], t('Machine name of the tax type is present in the tax rates listing'));
$this
->assertText($edit['tax_type[description]'], t('Description of the tax type is present in the tax rates listing'));
// Check in database if the tax rate has been created.
commerce_tax_types_reset();
$tax_type = commerce_tax_type_load($edit['tax_type[name]']);
$this
->assertFalse(empty($tax_type), t('Tax type is stored in database'));
// Create a tax rate and check that the new tax type is there.
$this
->drupalGet('admin/commerce/config/taxes/rates/add');
$tax_select_types = $this
->xpath('//select[@id="edit-tax-rate-type"]//option');
$this
->assertTrue(in_array($this->tax_type['display_title'], $tax_select_types), t('Tax type is available in the tax rate creation form'));
}
/**
* Test editing a tax type.
*/
public function testCommerceTaxUIEditTaxType() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the tax rate type edit page.
$this
->drupalGet('admin/commerce/config/taxes/types/' . strtr($this->tax_type['name'], '_', '-') . '/edit');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax type edit page'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate type edit page.
$this
->drupalGet('admin/commerce/config/taxes/types/' . strtr($this->tax_type['name'], '_', '-') . '/edit');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax type edit page'));
// Check if the data loaded in the edit form matches with the tax type.
$this
->pass(t('Test if the type is correctly loaded in the edit form:'));
$this
->assertFieldById('edit-tax-type-title', $this->tax_type['title'], t('Title field corresponds with tax type'));
$this
->assertText($this->tax_type['name'], t('Machine name field corresponds with tax type'));
$this
->assertFieldById('edit-tax-type-display-title', $this->tax_type['display_title'], t('Display title field corresponds with tax type'));
$this
->assertFieldById('edit-submit', t('Save tax type'), t('\'Save tax rate\' button is present'));
$this
->assertFieldById('edit-delete', t('Delete tax type'), t('Delete button is present'));
$this
->assertRaw(l(t('Cancel'), 'admin/commerce/config/taxes/types'), t('Cancel link is present'));
// Modify the tax type and save it.
$edit = array(
'tax_type[title]' => 'Additional tax type',
'tax_type[display_title]' => 'Additional tax rate',
'tax_type[description]' => 'Additional tax rate for testing',
'tax_type[display_inclusive]' => 1,
);
$this
->drupalPost(NULL, $edit, t('Save tax type'));
// Check the url after edit and if the values have been loaded.
$this
->assertTrue($this->url == url('admin/commerce/config/taxes/types', array(
'absolute' => TRUE,
)), t('After saving a tax type we are in the list of tax types'));
$this
->assertText($edit['tax_type[title]'], t('Title of the tax type is present in the tax types listing'));
$this
->assertText($edit['tax_type[description]'], t('Description of the tax type is present in the tax types listing'));
$this
->assertText(t('Tax type saved.'), t('\'Tax type saved\' message is displayed'));
// Check in database if the tax rate has been correctly modified.
commerce_tax_types_reset();
$tax_type = commerce_tax_type_load($this->tax_type['name']);
$this
->assertTrue($tax_type['title'] == $edit['tax_type[title]'], t('Title of the tax type has been correctly modified in the database'));
$this
->assertTrue($tax_type['display_title'] == $edit['tax_type[display_title]'], t('Display title of the tax type has been correctly modified in the database'));
$this
->assertTrue($tax_type['description'] == $edit['tax_type[description]'], t('Description of the tax type has been correctly modified in the database'));
$this
->assertTrue($tax_type['display_inclusive'] == $edit['tax_type[display_inclusive]'], t('Display inclusive option of the tax type has been correctly modified in the database'));
}
/**
* Test adding a condition to a tax type.
*/
public function testCommerceTaxUIConfigureTaxType() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the tax rate type configure rule page.
$this
->drupalGet('admin/config/workflow/rules/reaction/manage/commerce_tax_type_' . $this->tax_type['name']);
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate type configure rule page.
$this
->drupalGet('admin/config/workflow/rules/reaction/manage/commerce_tax_type_' . $this->tax_type['name']);
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the'));
// Add a condition
$this
->assertLink(t('Add condition'), 0, t('Add condition link is present'));
$this
->clickLink(t('Add condition'));
// Select a basic condition as at this step we're only testing if the
// saving process is working.
$this
->drupalPost(NULL, array(
'element_name' => 'entity_is_of_type',
), t('Continue'));
$this
->drupalPost(NULL, array(
'parameter[entity][settings][entity:select]' => 'commerce-line-item',
'parameter[type][settings][type]' => 'commerce_line_item',
), t('Save'));
// Check that after saving the url is correct and the condition has been
// added.
$this
->assertTrue($this->url == url('admin/config/workflow/rules/reaction/manage/commerce_tax_type_' . $this->tax_type['name'], array(
'absolute' => TRUE,
)), t('After adding a new condition component the landing page is the edit components one'));
$this
->assertText(t('Entity is of type'), t('Condition was added correctly'));
}
/**
* Test deleting a tax type.
*/
public function testCommerceTaxUIDeleteTaxType() {
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Access the tax rate type delete page.
$this
->drupalGet('admin/commerce/config/taxes/types/' . strtr($this->tax_type['name'], '_', '-') . '/delete');
// It should return a 403.
$this
->assertResponse(403, t('Normal user is not able to access the tax type delete page'));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate type delete page.
$this
->drupalGet('admin/commerce/config/taxes/types/' . strtr($this->tax_type['name'], '_', '-') . '/delete');
// It should return a 200.
$this
->assertResponse(200, t('Store admin user can access the tax type delete page'));
// Check the integrity of the tax type delete confirmation form.
$this
->pass('Test the tax type delete confirmation form:');
$this
->assertTitle(t('Are you sure you want to delete the !title tax type?', array(
'!title' => $this->tax_type['title'],
)) . ' | Drupal', t('The confirmation message for deleting a tax type is displayed'));
$this
->assertText(t('This action cannot be undone'), t('A warning notifying the user about the action can\'t be undone is displayed.'));
$this
->assertFieldById('edit-submit', t('Delete'), t('Delete button is present'));
$this
->assertText(t('Cancel'), t('Cancel is present'));
// Delete the tax type.
$this
->drupalPost(NULL, array(), t('Delete'));
// Check the url after deleting and if the tax type has been deleted in
// database.
$this
->assertTrue($this->url == url('admin/commerce/config/taxes/types', array(
'absolute' => TRUE,
)), t('Landing page after deleting a tax type is the tax types listing page'));
$this
->assertRaw(t('The tax type %title has been deleted.', array(
'%title' => $this->tax_type['title'],
)), t('\'Tax type has been deleted\' message is displayed'));
commerce_tax_types_reset();
$tax_type = commerce_tax_rate_load($this->tax_type['name']);
$this
->assertTrue(empty($tax_type), t('Tax type is correctly deleted from database'));
}
/**
* Text the deletion of a tax type that already has rates.
*/
public function testCommerceTaxUIDeleteTaxTypeWithRates() {
// Create a tax rate associated with the type.
$tax_rate = $this
->createDummyTaxRate();
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the tax rate type delete page.
$this
->drupalGet('admin/commerce/config/taxes/types/' . strtr($this->tax_type['name'], '_', '-') . '/delete');
// Check that the tax can't be deleted as it has a rate associated to it.
$this
->assertTitle(t('Cannot delete the !title tax type', array(
'!title' => $this->tax_type['title'],
)) . ' | Drupal', t('Page title for tax type deletion with rates associated to it is correct'));
$this
->assertText(t('There is a tax rate of this type. It cannot be deleted.'), t('A message that prevents user from deleting a tax type with rates associated to it is displayed'));
}
/**
* Check if a 'Salex tax' rate is correctly applied in a given order.
*/
public function testCommerceTaxUIApplySalesTax() {
// Create a tax rate of Salex Type.
$tax_rate = $this
->createDummyTaxRate(array(
'type' => 'sales_tax',
));
// Create a dummy order in cart status.
$order = $this
->createDummyOrder($this->normal_user->uid);
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Get the checkout url and navigate to it.
$links = commerce_line_item_summary_links();
$this->checkout_url = $links['checkout']['href'];
$this
->drupalGet($this->checkout_url);
// Check in database if the tax is applied.
$order = commerce_order_load_multiple(array(
$order->order_id,
), array(), TRUE);
$order_wrapper = entity_metadata_wrapper('commerce_order', reset($order));
$order_data = $order_wrapper->commerce_order_total
->value();
$components = commerce_price_component_load($order_data, $tax_rate['price_component']);
$tax_component = reset($components);
$this
->assertFalse(empty($tax_component), t('Tax is applied in the order'));
// Tax should be applied in Checkout Review with the correct quantity.
$this
->assertText($tax_rate['display_title'], t('Tax appears in the order summary'));
$this
->assertText(trim(commerce_currency_format($order_data['amount'], $order_data['currency_code'])), t('Tax amount applied appears in the order summary'));
}
/**
* Check if a 'VAT' tax type is correctly applied in a given product.
*/
public function testCommerceTaxUIApplyVAT() {
// Create a tax rate VAT Type.
$tax_rate = $this
->createDummyTaxRate(array(
'type' => 'vat',
));
// Create a new product and product display.
$this
->createDummyProductDisplayContentType();
$product = $this
->createDummyProduct();
$product_wrapper = entity_metadata_wrapper('commerce_product', $product);
$product_node = $this
->createDummyProductNode(array(
$product->product_id,
));
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Go to the product display and check if the tax is applied.
$this
->drupalGet('node/' . $product_node->nid);
// Check the tax applied in database and product display.
$products = commerce_product_load_multiple(array(
$product->product_id,
), array(), TRUE);
$product = reset($products);
$price_component = commerce_product_calculate_sell_price($product);
$this
->assertText(trim(commerce_currency_format($price_component['amount'], $price_component['currency_code'])), t('Amount with taxes corresponds with the amount displayed in the product display page'));
$components = commerce_price_component_load($price_component, $tax_rate['price_component']);
$tax_component = reset($components);
$this
->assertFalse(empty($tax_component), t('Tax component is set in the product.'));
}
/**
* Check if a 'VAT' tax type is correctly applied in a given product.
*/
public function testCommerceTaxUIApplyVATInclusive() {
// Create a tax rate VAT Type.
$tax_rate = $this
->createDummyTaxRate(array(
'type' => 'vat',
));
// Create a new product and product display.
$this
->createDummyProductDisplayContentType();
$product = $this
->createDummyProduct();
$product_node = $this
->createDummyProductNode(array(
$product->product_id,
));
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Edit the product to be VAT tax inclusive.
$this
->drupalGet('admin/commerce/products/' . $product->product_id . '/edit');
$this
->drupalPost(NULL, array(
'commerce_price[und][0][include_tax]' => $tax_rate['name'],
), t('Save product'));
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Go to the product display and check if the tax is applied.
$this
->drupalGet('node/' . $product_node->nid);
// Check the tax applied in database and in the product display.
$products = commerce_product_load_multiple(array(
$product->product_id,
), array(), TRUE);
$product = reset($products);
$price_component = commerce_product_calculate_sell_price($product);
$this
->assertText(trim(commerce_currency_format($price_component['amount'], $price_component['currency_code'])), t('Amount with taxes included corresponds with the amount displayed in the product display page'));
$components = commerce_price_component_load($price_component, $tax_rate['price_component']);
$tax_component = reset($components);
$this
->assertFalse(empty($tax_component), t('Tax component is set in the product.'));
$this
->assertTrue($tax_component['included'], t('Tax component is configured to be included in the price'));
}
/**
* A tax rate with no matching condition doesn't get applied.
*/
public function testCommerceTaxUITaxNoMatchingCondition() {
// Create a tax rate of Salex Type.
$tax_rate = $this
->createDummyTaxRate(array(
'type' => 'sales_tax',
));
// Create a dummy order in cart status.
$order = $this
->createDummyOrder($this->normal_user->uid);
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Modify the tax rate to no match condition.
$this
->drupalGet('admin/config/workflow/rules/components/manage/' . $tax_rate['rules_component']);
$this
->clickLink(t('Add condition'));
$this
->drupalPost(NULL, array(
'element_name' => 'data_is',
), t('Continue'));
$this
->drupalPost(NULL, array(
'parameter[data][settings][data:select]' => 'commerce-line-item:commerce-total:amount',
), t('Continue'));
$this
->drupalPost(NULL, array(
'parameter[op][settings][op]' => '<',
'parameter[value][settings][value]' => '0',
), t('Save'));
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Get the checkout url and navigate to it.
$links = commerce_line_item_summary_links();
$this->checkout_url = $links['checkout']['href'];
$this
->drupalGet($this->checkout_url);
// As the condition is impossible to match, tax rate shouldn't be applied.
$this
->assertNoText($tax_rate['display_title'], t('Tax rate doesn\'t match the conditions and is not present in the cart review pane.'));
// Also check it at database level.
$orders = commerce_order_load_multiple(array(
$order->order_id,
), array(), TRUE);
$order = reset($orders);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$components = commerce_price_component_load($order_wrapper->commerce_order_total
->value(), $tax_rate['price_component']);
$tax_component = reset($components);
$this
->assertTrue(empty($tax_component), t('Tax component is not set in the order.'));
}
/**
* Check the taxes applied in the order that a normal user can view.
*/
public function testCommerceTaxUIUserOrderView() {
// Create a tax rate.
$tax_rate = $this
->createDummyTaxRate(array(
'type' => 'sales_tax',
));
// Create new order and products associated to it.
$order = $this
->createDummyOrder($this->normal_user->uid);
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Go through the complete order process.
$this
->commerceTaxHelperCompleteCheckout();
// Access the View orders page and view the order just created.
$this
->drupalGet('user/' . $this->normal_user->uid . '/orders/' . $order->order_id);
// Reload the order directly from db.
$orders = commerce_order_load_multiple(array(
$order->order_id,
), array(), TRUE);
$order = reset($orders);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$components = commerce_price_component_load($order_wrapper->commerce_order_total
->value(), $tax_rate['price_component']);
$tax_component = reset($components);
// Check the taxes applied.
$this
->assertText($tax_rate['display_title'], t('Tax display title is displayed in the user view of an order.'));
$this
->assertText(trim(commerce_currency_format($tax_component['price']['amount'], $tax_component['price']['currency_code'])), t('Tax amount is displayed in the user view of an order.'));
}
/**
* Check the taxes applied in the order admin view.
*/
public function testCommerceTaxUIAdminOrder() {
// Create a tax rate.
$tax_rate = $this
->createDummyTaxRate(array(
'type' => 'sales_tax',
));
// Create new order and products associated to it.
$order = $this
->createDummyOrder($this->normal_user->uid);
// Login with normal user.
$this
->drupalLogin($this->normal_user);
// Go through the complete order process.
$this
->commerceTaxHelperCompleteCheckout();
// Login with store admin user.
$this
->drupalLogin($this->store_admin);
// Access the admin order edit page.
$this
->drupalGet('admin/commerce/orders/' . $order->order_id);
// Reload the order directly from db.
$orders = commerce_order_load_multiple(array(
$order->order_id,
), array(), TRUE);
$order = reset($orders);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$components = commerce_price_component_load($order_wrapper->commerce_order_total
->value(), $tax_rate['price_component']);
$tax_component = reset($components);
// Check the taxes applied.
$this
->assertText($tax_rate['display_title'], t('Tax display title is displayed in the admin view of an order.'));
$this
->assertText(trim(commerce_currency_format($tax_component['price']['amount'], $tax_component['price']['currency_code'])), t('Tax amount is displayed in the admin view of an order.'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommerceBaseTestCase:: |
protected | property |
The profile to install as a basis for testing. Overrides DrupalWebTestCase:: |
|
CommerceBaseTestCase:: |
public | function | Asserts that a product has been added to the cart. | |
CommerceBaseTestCase:: |
public | function | Asserts that a product has been created. | |
CommerceBaseTestCase:: |
public | function | Attach a product reference field to a given content type. Creates the field if the given name doesn't already exist. Automatically sets the display formatters to be the "add to cart form" for the teaser and full modes. | |
CommerceBaseTestCase:: |
public | function | Create a customer profile. | |
CommerceBaseTestCase:: |
public | function | Create a dummy order in a given status. | |
CommerceBaseTestCase:: |
public | function | Creates a dummy product for use with other tests. | |
CommerceBaseTestCase:: |
public | function | Create a dummy product display content type. | |
CommerceBaseTestCase:: |
public | function | Creates a product display node with an associated product. | |
CommerceBaseTestCase:: |
public | function | Create a full product node without worrying about the earlier steps in the process. | |
CommerceBaseTestCase:: |
public | function | Creates a dummy product type for use with other tests. | |
CommerceBaseTestCase:: |
public | function | * Create a dummy tax rate. * * | |
CommerceBaseTestCase:: |
public | function | * Create a dummy tax type. * * | |
CommerceBaseTestCase:: |
protected | function | Returns a site administrator user. Only has permissions for administering modules in Drupal core. | |
CommerceBaseTestCase:: |
protected | function | Returns a store administrator user. Only has permissions for administering Commerce modules. | |
CommerceBaseTestCase:: |
protected | function | Returns a store customer. It's a regular user with some Commerce permissions as access to checkout. | |
CommerceBaseTestCase:: |
protected | function | Wrapper to easily create users from arrays returned by permissionBuilder(). | |
CommerceBaseTestCase:: |
public | function | Enable extra currencies in the store. | |
CommerceBaseTestCase:: |
protected | function | Generate random valid information for Address information. | |
CommerceBaseTestCase:: |
protected | function | Generate a random valid email | |
CommerceBaseTestCase:: |
protected | function | Return one of the Commerce configured urls. | |
CommerceBaseTestCase:: |
protected | function | Checks if a group of modules is enabled. | |
CommerceBaseTestCase:: |
protected | function | Helper function to get different combinations of permission sets. | |
CommerceBaseTestCase:: |
protected | function | Helper function to determine which modules should be enabled. Should be used in place of standard parent::setUp('moduleA', 'moduleB') call. | 1 |
CommerceTaxUIAdminTest:: |
protected | property | Normal user (without admin or store permissions) for testing. | |
CommerceTaxUIAdminTest:: |
protected | property | Tax type. | |
CommerceTaxUIAdminTest:: |
protected | function | Go through the checkout process. | |
CommerceTaxUIAdminTest:: |
public static | function | Implementation of getInfo(). | |
CommerceTaxUIAdminTest:: |
function |
Implementation of setUp(). Overrides DrupalWebTestCase:: |
||
CommerceTaxUIAdminTest:: |
public | function | Test access to tax rates listing. | |
CommerceTaxUIAdminTest:: |
public | function | Test access to tax types listing. | |
CommerceTaxUIAdminTest:: |
public | function | Check the taxes applied in the order admin view. | |
CommerceTaxUIAdminTest:: |
public | function | Check if a 'Salex tax' rate is correctly applied in a given order. | |
CommerceTaxUIAdminTest:: |
public | function | Check if a 'VAT' tax type is correctly applied in a given product. | |
CommerceTaxUIAdminTest:: |
public | function | Check if a 'VAT' tax type is correctly applied in a given product. | |
CommerceTaxUIAdminTest:: |
public | function | Test configuring a tax rate. | |
CommerceTaxUIAdminTest:: |
public | function | Test adding a condition to a tax type. | |
CommerceTaxUIAdminTest:: |
public | function | Test the creation of a tax rate. | |
CommerceTaxUIAdminTest:: |
public | function | Test the creation of a tax type. | |
CommerceTaxUIAdminTest:: |
public | function | Test deleting a tax rate. | |
CommerceTaxUIAdminTest:: |
public | function | Test deleting a tax type. | |
CommerceTaxUIAdminTest:: |
public | function | Text the deletion of a tax type that already has rates. | |
CommerceTaxUIAdminTest:: |
public | function | Test editing a tax rate. | |
CommerceTaxUIAdminTest:: |
public | function | Test editing a tax type. | |
CommerceTaxUIAdminTest:: |
public | function | A tax rate with no matching condition doesn't get applied. | |
CommerceTaxUIAdminTest:: |
public | function | Check the taxes applied in the order that a normal user can view. | |
DrupalTestCase:: |
protected | property | Assertions thrown in that test case. | |
DrupalTestCase:: |
protected | property | The database prefix of this test run. | |
DrupalTestCase:: |
protected | property | The original file directory, before it was changed for testing purposes. | |
DrupalTestCase:: |
public | property | Current results of this test case. | |
DrupalTestCase:: |
protected | property | Flag to indicate whether the test has been set up. | |
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | This class is skipped when looking for the source of an assertion. | |
DrupalTestCase:: |
protected | property | The test run ID. | |
DrupalTestCase:: |
protected | property | Time limit for the test. | |
DrupalTestCase:: |
public | property | Whether to cache the installation part of the setUp() method. | |
DrupalTestCase:: |
public | property | Whether to cache the modules installation part of the setUp() method. | |
DrupalTestCase:: |
protected | property | URL to the verbose output file directory. | |
DrupalTestCase:: |
protected | function | Internal helper: stores the assert. | |
DrupalTestCase:: |
protected | function | Check to see if two values are equal. | |
DrupalTestCase:: |
protected | function | Check to see if a value is false (an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
protected | function | Check to see if two values are identical. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not equal. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not identical. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not false (not an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
public static | function | Delete an assertion record by message ID. | |
DrupalTestCase:: |
protected | function | Fire an error assertion. | 1 |
DrupalTestCase:: |
public | function | Handle errors during test runs. | 1 |
DrupalTestCase:: |
protected | function | Handle exceptions. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always negative. | |
DrupalTestCase:: |
public static | function | Converts a list of possible parameters into a stack of permutations. | |
DrupalTestCase:: |
protected | function | Cycles through backtrace until the first non-assertion method is found. | |
DrupalTestCase:: |
public static | function | Returns the database connection to the site running Simpletest. | |
DrupalTestCase:: |
public static | function | Store an assertion from outside the testing context. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always positive. | |
DrupalTestCase:: |
public static | function | Generates a random string containing letters and numbers. | |
DrupalTestCase:: |
public static | function | Generates a random string of ASCII characters of codes 32 to 126. | |
DrupalTestCase:: |
public | function | Run all tests in this class. | |
DrupalTestCase:: |
protected | function | Logs a verbose message in a text file. | |
DrupalWebTestCase:: |
protected | property | Additional cURL options. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The current cookie file used by cURL. | |
DrupalWebTestCase:: |
protected | property | The cookies of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The handle of the current cURL connection. | |
DrupalWebTestCase:: |
protected | property | The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The parsed version of the page. | |
DrupalWebTestCase:: |
protected | property | Whether the files were copied to the test files directory. | |
DrupalWebTestCase:: |
protected | property | The headers of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | HTTP authentication credentials (<username>:<password>). | |
DrupalWebTestCase:: |
protected | property | HTTP authentication method | |
DrupalWebTestCase:: |
protected | property | The current user logged in using the internal browser. | |
DrupalWebTestCase:: |
protected | property | The original shutdown handlers array, before it was cleaned for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The original user, before it was changed to a clean uid = 1 for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser (plain text version). | |
DrupalWebTestCase:: |
protected | property | The number of redirects followed during the handling of a request. | |
DrupalWebTestCase:: |
protected | property | The current session ID, if available. | |
DrupalWebTestCase:: |
protected | property | The current session name, if available. | |
DrupalWebTestCase:: |
protected | property | The URL currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists with the given name or ID. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given ID and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is found, and optional with the specified index. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is found. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the given value. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the pattern in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the string in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field doesn't exist or its value doesn't match, by XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is not found. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is not found. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the perl regex pattern is not present in raw content. | |
DrupalWebTestCase:: |
protected | function | Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
DrupalWebTestCase:: |
protected | function | Asserts the page did not return the specified response code. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is NOT found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is not the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found MORE THAN ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the Perl regex pattern is found in the raw content. | |
DrupalWebTestCase:: |
protected | function | Pass if the raw text IS found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
DrupalWebTestCase:: |
protected | function | Asserts the page responds with the specified response code. | |
DrupalWebTestCase:: |
protected | function | Pass if the text IS found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
DrupalWebTestCase:: |
protected | function | Helper for assertText and assertNoText. | |
DrupalWebTestCase:: |
protected | function | Asserts themed output. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found ONLY ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
DrupalWebTestCase:: |
protected | function | Pass if the internal browser's URL matches the given path. | |
DrupalWebTestCase:: |
protected | function | Builds an XPath query. | |
DrupalWebTestCase:: |
protected | function | Changes the database connection to the prefixed one. | |
DrupalWebTestCase:: |
protected | function | Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive. | |
DrupalWebTestCase:: |
protected | function | Check to make sure that the array of permissions are valid. | |
DrupalWebTestCase:: |
protected | function | Follows a link by name. | |
DrupalWebTestCase:: |
protected | function | Helper function: construct an XPath for the given set of attributes and value. | |
DrupalWebTestCase:: |
protected | function | Copy the setup cache from/to another table and files directory. | |
DrupalWebTestCase:: |
protected | function | Runs cron in the Drupal installed by Simpletest. | |
DrupalWebTestCase:: |
protected | function | Close the cURL handler and unset the handler. | |
DrupalWebTestCase:: |
protected | function | Initializes and executes a cURL request. | |
DrupalWebTestCase:: |
protected | function | Reads headers and registers errors received from the tested site. | |
DrupalWebTestCase:: |
protected | function | Initializes the cURL connection. | |
DrupalWebTestCase:: |
protected | function | Compare two files based on size and file name. | |
DrupalWebTestCase:: |
protected | function | Creates a custom content type based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a node based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a role with specified permissions. | |
DrupalWebTestCase:: |
protected | function | Create a user with a given set of permissions. | |
DrupalWebTestCase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Retrieve a Drupal path or an absolute path and JSON decode the result. | |
DrupalWebTestCase:: |
protected | function | Gets the current raw HTML of requested page. | |
DrupalWebTestCase:: |
protected | function | Gets the value of an HTTP response header. If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed… | |
DrupalWebTestCase:: |
protected | function | Gets the HTTP response headers of the requested page. Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the… | |
DrupalWebTestCase:: |
protected | function | Gets an array containing all e-mails sent during this test case. | |
DrupalWebTestCase:: |
function | Get a node from the database based on its title. | ||
DrupalWebTestCase:: |
protected | function | Gets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Get a list files that can be used in tests. | |
DrupalWebTestCase:: |
protected | function | Generate a token for the currently logged in user. | |
DrupalWebTestCase:: |
protected | function | Retrieves only the headers for a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Log in a user with the internal browser. | |
DrupalWebTestCase:: |
protected | function | ||
DrupalWebTestCase:: |
protected | function | Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser. | |
DrupalWebTestCase:: |
protected | function | Execute an Ajax submission. | |
DrupalWebTestCase:: |
protected | function | Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page. | |
DrupalWebTestCase:: |
protected | function | Sets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Takes a path and returns an absolute path. | |
DrupalWebTestCase:: |
protected | function | Get all option elements, including nested options, in a select. | |
DrupalWebTestCase:: |
protected | function | Get the selected value from a select field. | |
DrupalWebTestCase:: |
protected | function | Returns the cache key used for the setup caching. | |
DrupalWebTestCase:: |
protected | function | Get the current URL from the cURL handler. | |
DrupalWebTestCase:: |
protected | function | Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type. | |
DrupalWebTestCase:: |
protected | function | Copies the cached tables and files for a cached installation setup. | |
DrupalWebTestCase:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
DrupalWebTestCase:: |
protected | function | Preload the registry from the testing site. | |
DrupalWebTestCase:: |
protected | function | Generates a database prefix for running tests. | |
DrupalWebTestCase:: |
protected | function | Prepares the current environment for running the test. | |
DrupalWebTestCase:: |
protected | function | Recursively copy one directory to another. | |
DrupalWebTestCase:: |
protected | function | Refresh the in-memory set of variables. Useful after a page request is made that changes a variable in a different thread. | 1 |
DrupalWebTestCase:: |
protected | function | Reset all data structures after having enabled new modules. | |
DrupalWebTestCase:: |
protected | function | Store the installation setup to a cache. | |
DrupalWebTestCase:: |
protected | function | Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix. | 6 |
DrupalWebTestCase:: |
protected | function | Outputs to verbose the most recent $count emails sent. | |
DrupalWebTestCase:: |
protected | function | Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page. | |
DrupalWebTestCase:: |
function |
Constructor for DrupalWebTestCase. Overrides DrupalTestCase:: |
1 |