class ClassifiedBasicTest in Classified Ads 6.3
Same name and namespace in other branches
- 6.2 tests/classified_basic.test \ClassifiedBasicTest
Hierarchy
- class \DrupalTestCase
- class \DrupalWebTestCase
- class \ClassifiedAbstractTest
- class \ClassifiedBasicTest
- class \ClassifiedAbstractTest
- class \DrupalWebTestCase
Expanded class hierarchy of ClassifiedBasicTest
File
- tests/
classified_basic.test, line 117 - Basic test for known bugs in previous versions.
View source
class ClassifiedBasicTest extends ClassifiedAbstractTest {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => t('Classified'),
'description' => t('Basic tests for Classified.'),
'group' => t('Classified'),
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
$this->group = __FUNCTION__;
parent::setUp('statistics', 'classified');
}
/**
* Bug 547214: view Ads tab for users without permission.
*/
function test0547214() {
$this->group = __FUNCTION__;
$accounts = array(
'admin',
'basic',
'creator',
);
$this
->createUsers($accounts);
foreach ($accounts as $account_name) {
$account = $this->{$account_name . 'User'};
$this
->drupalLogin($account);
$this
->assertLink(t('Ads'), 0, t('User %name (@uid) sees "Ads" tab on his own account page', array(
'%name' => $account_name,
'@uid' => $this->{$account_name . 'User'}->uid,
)), 'Ads Tab');
$this
->drupalGet('user/' . $this->adminUser->uid);
if ($account_name == 'creator') {
$this
->assertLink(t('Ads'), 0, t('User %name sees "Ads" tab on other account pages', array(
'%name' => $account_name,
)), 'Ads Tab');
}
elseif ($account_name == 'basic') {
$this
->assertNoLink(t('Ads'), t('User %name does not see "Ads" tab on other account pages', array(
'%name' => $account_name,
)), 'Ads Tab');
}
// No else: admin seeing admin has already been tested.
$this
->drupalLogout();
}
}
/**
* Bug 123396: Unchecking 'Publish' checkbox doesn't prevent nodes from being
* published.
*
* Goes much further by testing the expiration dates resulting from all
* creation and updating scenarios. Already done:
* - creation, default
* - creation, default with explicit lifetime
* - creation, forced
*/
function test0123396() {
$this->group = __FUNCTION__;
// Include seconds in date comparison displays.
$format = 'Y-m-d H:i:s';
// 1. Get the Classified vocabulary id.
$vid = _classified_get('vid');
// 2a. Create a term in it, do not assign a specific lifetime.
$term = array(
'name' => $this
->randomName(8),
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// 2b. Create a node bearing that term.
$this->group = t('new, default');
$node = $this
->createNode(array(
'taxonomy' => array(
$vid => $tid,
),
));
$this
->assertTrue(isset($node->expires) && is_numeric($node->expires), t('node has an expires timestamp'), $this->group);
// 2c. Make sure it uses the default taxonomy-derived lifetime.
$lifetimes = _classified_get('lifetimes');
$lifetime = isset($lifetimes[$tid]) ? $lifetimes[$tid] : reset($lifetimes);
$expected_expires = $node->created + $lifetime * 60 * 60 * 24;
$this
->assertEqual($node->expires, $expected_expires, t('Node expire date %actual matches expected date: %expected', array(
'%actual' => format_date($node->expires, 'custom', $format),
'%expected' => format_date($expected_expires, 'custom', $format),
)), $this->group);
// 3a. Assign a specific lifetime to term.
$this->group = t('new, reset');
$lifetimes[$tid] = $random = mt_rand(0, 90);
variable_set('classified-lifetimes', $lifetimes);
$lifetimes = _classified_get('lifetimes');
$lifetime = isset($lifetimes[$tid]) ? $lifetimes[$tid] : reset($lifetimes);
$this
->assertEqual($random, $lifetime, t('Lifetime correctly set to @random = @lifetime', array(
'@random' => $random,
'@lifetime' => $lifetime,
)), $this->group);
// 3b. Create a node bearing that term, now with a specific lifetime.
$node = $this
->createNode(array(
'taxonomy' => array(
$vid => $tid,
),
'expire_mode' => 'reset',
));
$this
->assertTrue(isset($node->expires) && is_numeric($node->expires), t('node has an expires timestamp'), $this->group);
// 3c. Make sure it uses the explicit taxonomy-derived lifetime.
$expected_expires = $node->created + $lifetime * 60 * 60 * 24;
$this
->assertEqual($node->expires, $expected_expires, t('Node expire date %actual matches expected date: %expected', array(
'%actual' => format_date($node->expires, 'custom', $format),
'%expected' => format_date($expected_expires, 'custom', $format),
)), $this->group);
// 4a. Create a node bearing that term, but use force mode.
$this->group = t('new, force');
$expected_expires = time() + mt_rand(0, 90 * 24 * 60 * 60);
$this
->pass(t('Limit set to @date', array(
'@date' => format_date($expected_expires, 'custom', $format),
)), $this->group);
$node = $this
->createNode(array(
'taxonomy' => array(
$vid => $tid,
),
'expire_mode' => 'force',
'expire_date_ts' => $expected_expires,
));
$this
->assertTrue(isset($node->expires) && is_numeric($node->expires), t('node has an expires timestamp'), $this->group);
// 4b. Make sure it uses the explicit taxonomy-derived lifetime.
$limit = $node->created + $lifetime * 60 * 60 * 24;
$this
->assertEqual($node->expires, $expected_expires, t('Node expire date %actual matches expected date: %expected', array(
'%actual' => format_date($node->expires, 'custom', $format),
'%expected' => format_date($expected_expires, 'custom', $format),
)), $this->group);
}
/**
* Bug 1269828
*
* Anonymous users view "n/a" in body if they do not have permission for the
* input format.
*/
function test1269828() {
$this->group = __FUNCTION__;
$types = array_keys(classified_node_info());
$type = reset($types);
$this
->createUsers(array(
'creator',
));
$this
->drupalLogin($this->creatorUser);
$settings = array(
'type' => $type,
'format' => 2,
);
$node = $this
->createNode($settings);
$this
->drupalLogout();
$this
->drupalGet('node/' . $node->nid);
$this
->assertNoText(t('n/a'), t('Anonymous users can see contents which they could not create.'), $this->group);
}
/**
* Convert a host-relative path like /drupal/taxonomy to a drupal path.
*
* @see test1265524()
*
* @param string $href
* Some path like "/drupal/taxonomy" or "/taxonomy"
*
* @return string
* The internal still aliased path like "taxonomy", or "/" if path does not
* belong in the current site.
*/
function relativizeHref($href) {
$base = base_path();
if (strpos($href, $base) === 0) {
$ret = drupal_substr($href, drupal_strlen($base));
}
else {
$ret = '/';
}
return $ret;
}
/**
* Bug 1287674
*
* Node title and categories are doubly escaped in recent/popular blocks.
*/
function test1287674() {
$this->group = __FUNCTION__;
$this
->createUsers(array(
'admin',
));
$this
->pass(t('Enable "count content views".'), $this->group);
variable_set('statistics_count_content_views', 1);
$deltas = array(
'popular',
'recent',
);
$this
->drupalLogin($this->adminUser);
foreach ($deltas as $delta) {
$block = array();
$block['module'] = 'classified';
$block['delta'] = $delta;
// Set the created block to a specific region.
$edit = array();
$edit[$block['module'] . '_' . $block['delta'] . '[region]'] = 'left';
$this
->drupalPost('admin/build/block', $edit, t('Save blocks'));
}
$this
->pass('Classified blocks enabled', $this->group);
// Get the Classified vocabulary id.
$vid = _classified_get('vid');
// Create a term in it, do not assign a specific lifetime.
$term_name = $this
->randomName(4) . " ' " . $this
->randomName(4);
$term = array(
'name' => $term_name,
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// Create a node bearing that term.
$quoted_title = $this
->randomName(4) . " ' " . $this
->randomName(4);
$node = $this
->createNode(array(
'taxonomy' => array(
$vid => $tid,
),
'title' => $quoted_title,
));
$this
->drupalGet('node/' . $node->nid);
foreach ($deltas as $delta) {
$content = $this
->xpath("//*[@id='block-classified-{$delta}']/*[@class='content']/descendant::a[@href]");
// SimpleXMLElement.
$content = reset($content);
$this
->assertNotIdentical(FALSE, strpos($content, $quoted_title), t('Title found in @delta block', array(
'@delta' => $delta,
)), $this->group);
$this
->assertNotIdentical(FALSE, strpos($content, $term_name), t('Term found in @delta block', array(
'@delta' => $delta,
)), $this->group);
}
// $pattern = '/'. t('Recent ads') .'.*'. htmlentities($quoted_title, ENT_QUOTES) .' \('. htmlentities($term_name, ENT_QUOTES) .'\).*' . t('Popular ads') .'/ms';
// debug($pattern);
// $this->assertPattern($pattern, t('Ad correctly listed in the "Recent ads" block.'), $this->group);
}
/**
* Issue #1382234: Create new ad link missing.
*
* Root cause: improper caching.
*/
function test1382234() {
$this->group = __FUNCTION__;
$accounts = array(
'creator',
);
$this
->createUsers($accounts);
$this
->drupalLogin($this->creatorUser);
// Force caching of overview page
cache_clear_all('classified:overview', 'cache');
$this
->drupalGet('classified');
$this
->assertLink(t('Add one'), 0, t('Creator sees ad creation link.'));
// Anonymous should not get creation link from page cached for authenticated users.
$this
->drupalLogout();
$this
->drupalGet('classified');
$this
->assertNoLink(t('Add one'), t('Anonymous users do not see ad creation link.'));
cache_clear_all('classified:overview', 'cache');
$this
->drupalGet('classified');
$this
->assertNoLink(t('Add one'), t('Anonymous users do not see ad creation link.'));
// Creator user should see the Add one link on the cached page.
$this
->drupalLogin($this->creatorUser);
$this
->drupalGet('classified');
$this
->assertLink(t('Add one'), 0, t('Creator sees ad creation link.'));
}
/**
* Bug 1397422
*/
function test1397422() {
$this->group = __FUNCTION__;
$this
->createUsers(array(
'creator',
));
$this
->drupalLogin($this->creatorUser);
$types = array_keys(classified_node_info());
$type = reset($types);
// Get the Classified vocabulary id
$vid = _classified_get('vid');
// Create a term in it, do not assign a specific lifetime.
$term_name = $this
->randomName(4) . " ' " . $this
->randomName(4);
$term = array(
'name' => $term_name,
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// Create a node bearing that term.
$title = $this
->randomName(4) . ' ' . $this
->randomName(4);
module_load_include('inc', 'node', 'node.pages');
$body = $this
->randomName(4) . ' ' . $this
->randomString(40);
$format = FILTER_FORMAT_DEFAULT;
$settings = array(
'type' => $type,
'format' => $format,
'taxonomy' => array(
$vid => $tid,
),
'title' => $title,
'body' => $body,
);
$node = $this
->createNode($settings);
variable_set('classified-list-body', 'body');
$this
->assertEqual(_classified_get('list-body'), 'body', t('List display set to node body'), $this->group);
$path = classified_term_path((object) $term);
$this
->drupalGet($path);
$this
->assertLink($title, 0, t('Title link found'), $this->group);
$this
->assertRaw(check_markup($body, $format, TRUE), 0, t('Body found'), $this->group);
}
/**
* Bug 1432606: Ads can be viewed when not published.
*/
function test1432606() {
$this->group = __FUNCTION__;
$accounts = array(
'admin',
'basic',
'creator',
);
$this
->createUsers($accounts);
// 1. Get the Classified vocabulary id.
$vid = _classified_get('vid');
// 2a. Create a term in it, do not assign a specific lifetime.
$term = array(
'name' => $this
->randomName(8),
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// 2b. Create a published node bearing that term, belonging to "creator".
$this->group = t('new, default');
$node = $this
->createNode(array(
'taxonomy' => array(
$vid => $tid,
),
'uid' => $this->creatorUser->uid,
'status' => 1,
));
$path = 'node/' . $node->nid;
// 3. All four profiles should see published node.
$this
->drupalLogout();
$this
->drupalGet($path);
$this
->assertResponse(200, t('Anonymous user sees published ad.'));
$this
->drupalLogin($this->adminUser);
$this
->drupalGet($path);
$this
->assertResponse(200, t('Ads administrator sees published ad.'));
$this
->drupalLogin($this->basicUser);
$this
->drupalGet($path);
$this
->assertResponse(200, t('Non-author user sees published ad.'));
$this
->drupalLogin($this->creatorUser);
$this
->drupalGet($path);
$this
->assertResponse(200, t('Author sees his published ad.'));
// 4a. Unpublish the ad.
$node->status = 0;
node_save($node);
// 4b. The ad is unpublished: only admin and creator should be able to see it.
$this
->drupalLogout();
$this
->drupalGet($path);
$this
->assertResponse(403, t('Anonymous user does not see unpublished ad.'));
$this
->drupalLogin($this->adminUser);
$this
->drupalGet($path);
$this
->assertResponse(200, t('Ads administrator sees unpublished ad.'));
$this
->drupalLogin($this->basicUser);
$this
->drupalGet($path);
$this
->assertResponse(403, t('Non-author user does not see unpublished ad.'));
$this
->drupalLogin($this->creatorUser);
$this
->drupalGet($path);
$this
->assertResponse(200, t('Author sees his unpublished ad.'));
}
/**
* Test token generation for issue #1491880.
*/
public function test1491880() {
$this->group = __FUNCTION__;
$this
->createUsers(array(
'creator',
));
$this
->drupalLogin($this->creatorUser);
$types = array_keys(classified_node_info());
$type = reset($types);
// Get the Classified vocabulary id
$vid = _classified_get('vid');
// Create a term in it, do not assign a specific lifetime.
$term_name = $this
->randomName(4) . " ' " . $this
->randomName(4);
$term = array(
'name' => $term_name,
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// Create a node bearing that term.
$title = $this
->randomName(4) . ' ' . $this
->randomName(4);
module_load_include('inc', 'node', 'node.pages');
$body = $this
->randomName(4) . ' ' . $this
->randomString(40);
$format = FILTER_FORMAT_DEFAULT;
$settings = array(
'type' => $type,
'format' => $format,
'taxonomy' => array(
$vid => $tid,
),
'title' => $title,
'body' => $body,
'uid' => $this->creatorUser->uid,
);
$node = $this
->createNode($settings);
// Make sure tokens are visible.
$tokens = token_get_list('user');
$tokens = reset($tokens);
$token_names = array(
'ads',
'classified-ads-url',
);
foreach ($token_names as $token) {
$this
->assertNotNull($tokens[$token], t('%token token found in user tokens.', array(
'%token' => $token,
)), $this->group);
}
// Check token replacement.
$source = $this
->randomString(20);
foreach ($token_names as $token) {
$source .= " [{$token}] " . $this
->randomString(20);
}
$translation = token_replace_multiple($source, array(
'user' => $this->creatorUser,
));
$this
->assertTrue(preg_match('/' . $node->title . '/', $translation), t('Node title from token.'), $this->group);
$url = url('user/' . $node->uid . '/classified', array(
'absolute' => TRUE,
));
$this
->assertTrue(preg_match("@{$url}@", $translation), t('User ads URL found from token.'), $this->group);
}
public function test1525392() {
$this->group = __FUNCTION__;
$this
->createUsers(array(
'creator',
));
$this
->drupalLogin($this->creatorUser);
$types = array_keys(classified_node_info());
$type = reset($types);
// Get the Classified vocabulary id
$vid = _classified_get('vid');
// Create a term in it, do not assign a specific lifetime.
$term_name = $this
->randomName(4) . " ' " . $this
->randomName(4);
$term = array(
'name' => $term_name,
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// Create a term below the first one, do not assign a specific lifetime.
$child_term_name = $this
->randomName(4) . " ' " . $this
->randomName(4);
$child_term = array(
'name' => $child_term_name,
'description' => $this
->randomString(20),
'vid' => $vid,
'parent' => $tid,
);
$status = taxonomy_save_term($child_term);
$child_tid = $child_term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @child_tid created below @tid in default vocabulary.', array(
'@child_tid' => $child_tid,
'@tid' => $tid,
)), 'setup');
// Create two ads in the child category.
// Create a node bearing that term.
for ($i = 0; $i < 2; $i++) {
$title = $this
->randomName(4) . ' ' . $this
->randomName(4);
module_load_include('inc', 'node', 'node.pages');
$body = $this
->randomName(4) . ' ' . $this
->randomString(40);
$format = FILTER_FORMAT_DEFAULT;
$settings = array(
'type' => $type,
'format' => $format,
'taxonomy' => array(
$vid => $child_tid,
),
'title' => $title,
'body' => $body,
'uid' => $this->creatorUser->uid,
);
$node = $this
->createNode($settings);
}
$this
->drupalGet('classified');
$xpath = '//table[contains(@class, "classified-term-list")]/caption/text()';
$fields = $this
->xpath($xpath);
if ($fields) {
if (count($fields) > 1) {
$this
->fail(t('More than one total ads count (@count) found on page.', array(
'@count' => count($field),
)), $this->group);
}
$text = dom_import_simplexml(reset($fields))->textContent;
$sts = preg_match('/^2[\\s\\w]+\\./', $text, $matches);
$this
->assertEqual(1, $sts, t('Total ads count is 2 (@count).'), $this->group);
}
else {
$this
->fail(t('Ads total count not found on page.'), $this->group);
}
}
/**
* Add server-side body length validation.
*/
public function test1653560() {
$this->group = __FUNCTION__;
$accounts = array(
'creator',
);
$this
->createUsers($accounts);
$this
->drupalLogin($this->creatorUser);
// 1. Get the node type name.
$type = node_get_types('name', 'classified');
// 2. Get the Classified vocabulary id.
$vid = _classified_get('vid');
// 3a. Create a term in it, do not assign a specific lifetime.
$term = array(
'name' => $this
->randomName(8),
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// 3b. Limit the maximum body length.
$max_length = 20;
variable_set('classified-max-length', $max_length);
// 4a. Try to create an ad bearing that term, with a body below max length.
$count = db_result(db_query('SELECT COUNT(nid) FROM {node}'));
$this
->assertEqual(0, $count, t('No node found before creation of first ad'), $this->group);
$edit = array(
'title' => $this
->randomString(10),
"taxonomy[{$vid}]" => 1,
// Set by module
'body' => 'A short body',
);
$ret = $this
->drupalPost('node/add/classified', $edit, t('Save'));
$raw = t('@type %title has been created.', array(
'@type' => $type,
'%title' => $edit['title'],
));
$this
->assertRaw($raw, t('Ad with proper body receives creation confirmation'), $this->group);
$count = db_result(db_query('SELECT COUNT(nid) FROM {node}'));
$this
->assertEqual(1, $count, t('Ad with proper body actually created.'), $this->group);
// 4b. Try to create an ad bearing that term, with a body above max length.
$edit = array(
'title' => $this
->randomString(10),
"taxonomy[{$vid}]" => 1,
// Set by module
'body' => 'A body longer than 20 characters.',
);
$ret = $this
->drupalPost('node/add/classified', $edit, t('Save'));
$raw = t('Text is longer than maximum authorized length: @body_length characters vs @max_length authorized.', array(
'@body_length' => drupal_strlen($edit['body']),
'@max_length' => $max_length,
));
$this
->assertRaw($raw, t('Ad with extra-long body receives post error.'), $this->group);
$count = db_result(db_query('SELECT COUNT(nid) FROM {node}'));
$this
->assertEqual(1, $count, t('Ad with extra-long body actually not created.'), $this->group);
}
/**
* Bug 1733594: Infinite grace (-1) being handled like a normal duration.
*/
public function test1733594() {
$this->group = 'Infinite';
// 1. Get the Classified vocabulary id.
$vid = _classified_get('vid');
// 2a. Create a term in it, do not assign a specific lifetime.
$term = array(
'name' => $this
->randomName(8),
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// 2b. Create a node bearing that term.
$node = $this
->createNode(array(
'taxonomy' => array(
$vid => $tid,
),
));
$this
->assertTrue(isset($node->expires) && is_numeric($node->expires), t('node has an expires timestamp'), $this->group);
// 2c. Get lifetimes information.
$lifetimes = _classified_get('lifetimes');
$default_lifetime = reset($lifetimes);
// 2d. Validate lifetime.
$this
->assertTrue(isset($node->expires) && is_numeric($node->expires) && $node->expires - $node->created == $default_lifetime * 24 * 60 * 60, t('node has correct timestamp'), $this->group);
// 3. Try purge one year beyond expiration with infinite grace.
module_load_include('scheduled.inc', 'classified');
variable_set('classified-grace', -1);
$future = $node->expires + 365 * 24 * 60 * 60;
$ads = _classified_scheduled_build_purge($future);
// 4. Ensure purge did not happen.
$this
->assertTrue(empty($ads), "No ad has been reported as deleted upon purge.", $this->group);
$node2 = node_load($node->nid, NULL, TRUE);
$this
->assertTrue(isset($node2->nid) && $node2->nid == $node->nid, 'Node is still present in database after purge.', $this->group);
// 5. Try purge one week beyond expiration with normal one day grace.
$this->group = "Finite";
variable_set('classified-grace', 1);
$future = $node->expires + 7 * 24 * 60 * 60;
$ads = _classified_scheduled_build_purge($future);
// 6. Ensure purge was performed. Format: {uid: {nid: title, ...}, ...}.
$this
->assertTrue(count($ads) == 1, "Purges happened for one account.", $this->group);
$purges = reset($ads);
$this
->assertTrue(count($purges) == 1, "One node was purged", $this->group);
$this
->assertEqual(key($purges), $node->nid, "Nid of purged node is correct", $this->group);
$this
->assertEqual(current($purges), $node->title, "Title of purged node is correct", $this->group);
$node2 = node_load($node->nid, NULL, TRUE);
$this
->assertFalse($node2, "Node is no longer in database", $this->group);
}
/**
* Security issue: XSS on term name on Classified config screen.
*/
public function testSecurity146738() {
$this->group = 'XSS';
// 1. Get the Classified vocabulary id and field name.
$vid = _classified_get('vid');
// 2. Create a term in it with a XSS attempt,
$name = <<<XSS
term<script type="text/javascript">alert('XSS');</script>name
XSS;
$term = array(
'name' => $name,
'description' => $this
->randomString(20),
'vid' => $vid,
);
$status = taxonomy_save_term($term);
$tid = $term['tid'];
$this
->assertEqual($status, SAVED_NEW, t('Term @tid created in default vocabulary.', array(
'@tid' => $tid,
)), 'setup');
// 3. Create an administrator using the Classified admin panel.
$this
->createUsers(array(
'admin',
));
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/settings/classified');
$this
->assertResponse(200, t('Admin sees Classified administration.'));
$this
->assertNoRaw($name);
$this
->assertRaw(check_plain($name));
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ClassifiedAbstractTest:: |
public | property | ||
ClassifiedAbstractTest:: |
public | property | ||
ClassifiedAbstractTest:: |
public | property | ||
ClassifiedAbstractTest:: |
public | property | Test group. | |
ClassifiedAbstractTest:: |
protected | function | Build a node from settings, providing classified-specific defaults. | |
ClassifiedAbstractTest:: |
protected | function | Create a set of typical users with profiles related to Classified Ads. | |
ClassifiedBasicTest:: |
public static | function | ||
ClassifiedBasicTest:: |
function | Convert a host-relative path like /drupal/taxonomy to a drupal path. | ||
ClassifiedBasicTest:: |
public | function |
Generates a random database prefix, runs the install scripts on the
prefixed database and enable the specified modules. After installation
many caches are flushed and the internal browser is setup so that the
page requests will run on the new prefix.… Overrides DrupalWebTestCase:: |
|
ClassifiedBasicTest:: |
function | Bug 123396: Unchecking 'Publish' checkbox doesn't prevent nodes from being published. | ||
ClassifiedBasicTest:: |
function | Bug 547214: view Ads tab for users without permission. | ||
ClassifiedBasicTest:: |
function | Bug 1269828 | ||
ClassifiedBasicTest:: |
function | Bug 1287674 | ||
ClassifiedBasicTest:: |
function | Issue #1382234: Create new ad link missing. | ||
ClassifiedBasicTest:: |
function | Bug 1397422 | ||
ClassifiedBasicTest:: |
function | Bug 1432606: Ads can be viewed when not published. | ||
ClassifiedBasicTest:: |
public | function | Test token generation for issue #1491880. | |
ClassifiedBasicTest:: |
public | function | ||
ClassifiedBasicTest:: |
public | function | Add server-side body length validation. | |
ClassifiedBasicTest:: |
public | function | Bug 1733594: Infinite grace (-1) being handled like a normal duration. | |
ClassifiedBasicTest:: |
public | function | Security issue: XSS on term name on Classified config screen. | |
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:: |
protected | property | The original database prefix, before it was changed for testing purposes. | |
DrupalTestCase:: |
public | property | Current results of this test case. | |
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:: |
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. | |
DrupalTestCase:: |
public | function | Handle errors during test runs. | |
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 | 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 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 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 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 profile to install as a basis for testing. | |
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 does not exist in the current page by the given 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 | 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 | 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 | 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 | Internal helper function; Create a role with specified permissions. | |
DrupalWebTestCase:: |
protected | function | Create a user with a given set of permissions. The permissions correspond to the names given on the privileges page. | |
DrupalWebTestCase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
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 | 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 | 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 | Parse content returned from curlExec using DOM and SimpleXML. | |
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. | |
DrupalWebTestCase:: |
protected | function | Reset all data structures after having enabled new modules. | |
DrupalWebTestCase:: |
protected | function | Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix. | |
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:: |