public function DomainSourceTest::testDomainSourceDefaults in Domain Access 7.3
File
- domain_source/
tests/ domain_source.test, line 90 - Simpletest for Domain Source.
Class
- DomainSourceTest
- @file Simpletest for Domain Source.
Code
public function testDomainSourceDefaults() {
$_domain = domain_get_domain();
$node = node_load(1);
// By default, this node is not assigned, so it should be set to use
// the active domain.
$source = domain_source_lookup($node->nid);
$this
->assertTrue($source === FALSE, t('Unassigned node defaults to current domain.'));
// Save the node with an assigned source. Then load and check.
$domain = domain_load(2);
$node->domain_source = $domain['domain_id'];
// Promote the node so we can check links.
$node->promote = 1;
node_save($node);
$source = domain_source_lookup($node->nid);
$this
->assertTrue($source == $domain['domain_id'], t('Assigned node set to proper domain.'));
// Get the site homepage. The node should link to the domain.
$this
->drupalGet('');
$this
->assertRaw('<a href="' . $domain['path'], t('URL rewrite returned correct domain.'));
// Save the node with DOMAIN_SOURCE_USE_ACTIVE.
$node->domain_source = DOMAIN_SOURCE_USE_ACTIVE;
node_save($node);
$source = domain_source_lookup($node->nid);
$this
->assertTrue($source == DOMAIN_SOURCE_USE_ACTIVE, t('Use current domain set correctly.'));
// Get the site homepage. The node should link to a relative path.
// @TODO: This could be a better test.
$this
->drupalGet('');
$this
->assertNoRaw('<a href="' . $domain['path'], t('URL rewrite returned correct domain.'));
// Get the site homepage on another domain. The node should link to a
// relative path.
// @TODO: This could be a better test.
$this
->drupalGet($domain['path']);
$this
->assertNoRaw('<a href="' . $domain['path'], t('URL rewrite returned correct domain.'));
}