You are here

function DomainCreateTest::testDomainCreate in Domain Access 7.3

File

tests/domain.test, line 214
Simpletest for Domain Access.

Class

DomainCreateTest

Code

function testDomainCreate() {
  $setup = $this
    ->domainCreateDomains();
  $result = db_query("SELECT sitename, subdomain FROM {domain} WHERE is_default = 0 ORDER BY weight");
  $domains = array();
  foreach ($result as $record) {
    $domains[$record->sitename] = array(
      'sitename' => $record->sitename,
      'subdomain' => $record->subdomain,
    );
  }
  foreach ($domains as $sitename => $domain) {
    $this
      ->assertTrue($domains[$sitename]['sitename'] == $setup[$sitename]['sitename'], t('Domain %subdomain created successfully', array(
      '%subdomain' => $domain['subdomain'],
    )));
  }

  // Delete one of the domains.
  domain_delete($setup['three']);
  $deleted_domain = domain_lookup($setup['three']['domain_id'], NULL, TRUE);
  $this
    ->assertTrue($deleted_domain == -1, t('Domain %domain deleted successfully.', array(
    '%domain' => $setup['three']['subdomain'],
  )));
}