Commit 8d99d832 authored by Dave Reid's avatar Dave Reid Committed by Dave Reid
Browse files

Issue #2495523 by Dave Reid, mikeker: Converted test classes from getInfo() to...

Issue #2495523 by Dave Reid, mikeker: Converted test classes from getInfo() to annotations, and changed setUp() from public to protected.
parent 572a214b
......@@ -9,28 +9,20 @@ namespace Drupal\xmlsitemap\Tests;
/**
* Tests the generation of a random content entity links.
*
* @group xmlsitemap
*/
class XmlSitemapEntityFunctionalTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('system', 'xmlsitemap', 'entity_test');
public static function getInfo() {
return array(
'name' => 'XML sitemap random entity',
'description' => 'Functional tests for the XML sitemap random entity links.',
'group' => 'XML sitemap',
);
}
public static $modules = ['system', 'entity_test'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('administer entity_test content', 'administer xmlsitemap'));
......
......@@ -9,28 +9,20 @@ namespace Drupal\xmlsitemap\Tests;
/**
* Tests the generation of sitemaps.
*
* @group xmlsitemap
*/
class XmlSitemapFunctionalTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('xmlsitemap', 'path', 'node', 'system', 'user', 'help');
public static function getInfo() {
return array(
'name' => 'XML sitemap interface tests',
'description' => 'Functional tests for the XML sitemap module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['path', 'node', 'system', 'user', 'help'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('access content', 'administer site configuration', 'administer xmlsitemap', 'access administration pages', 'access site reports', 'administer permissions', 'view the administration theme'));
......
......@@ -11,28 +11,20 @@ use Drupal\Core\Language\Language;
/**
* Tests the sitemaps list builder.
*
* @group xmlsitemap
*/
class XmlSitemapListBuilderTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('language', 'xmlsitemap', 'node', 'locale', 'content_translation', 'system');
public static function getInfo() {
return array(
'name' => 'XML sitemap list builder tests',
'description' => 'List builder tests for the XML sitemap module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['language', 'node', 'locale', 'content_translation', 'system'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'administer site configuration', 'administer xmlsitemap', 'access content'));
......
......@@ -12,28 +12,20 @@ use Drupal\Component\Utility\Unicode;
/**
* Tests the generation of menu links.
*
* @group xmlsitemap
*/
class XmlSitemapMenuFunctionalTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('node', 'xmlsitemap', 'menu_link_content', 'menu_ui', 'system');
public static function getInfo() {
return array(
'name' => 'XML sitemap menu',
'description' => 'Functional tests for the XML sitemap menu module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['node', 'menu_link_content', 'menu_ui', 'system'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
if ($this->profile != 'standard') {
......
......@@ -9,28 +9,20 @@ namespace Drupal\xmlsitemap\Tests;
/**
* Tests the generation of multilingual nodes.
*
* @group xmlsitemap
*/
class XmlSitemapMultilingualNodeTest extends XmlSitemapMultilingualTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('xmlsitemap', 'language', 'content_translation', 'node', 'locale', 'config_translation', 'system');
public static function getInfo() {
return array(
'name' => 'XML sitemap i18n node tests',
'description' => 'Functional and integration tests for the XML sitemap node and internationalization modules.',
'group' => 'XML sitemap',
);
}
public static $modules = ['language', 'content_translation', 'node', 'locale', 'config_translation', 'system'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
if ($this->profile != 'standard') {
......
......@@ -11,28 +11,20 @@ use Drupal\Core\Language\LanguageInterface;
/**
* Tests the generation of multilingual sitemaps.
*
* @group xmlsitemap
*/
class XmlSitemapMultilingualTest extends XmlSitemapMultilingualTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('language', 'xmlsitemap', 'node', 'locale', 'content_translation', 'system');
public static function getInfo() {
return array(
'name' => 'XML sitemap i18n tests',
'description' => 'Functional and integration tests for the XML sitemap and internationalization modules.',
'group' => 'XML sitemap',
);
}
public static $modules = ['language', 'node', 'locale', 'content_translation', 'system'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->drupalLogin($this->admin_user);
......
......@@ -11,20 +11,20 @@ use Drupal\Core\Language\Language;
/**
* Common base test class for XML sitemap internationalization tests.
*
* @group xmlsitemap
*/
abstract class XmlSitemapMultilingualTestBase extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('language', 'xmlsitemap', 'node', 'locale', 'content_translation', 'system');
public static $modules = ['language', 'node', 'locale', 'content_translation', 'system'];
/**
* Set up an administrative user account and testing keys.
*/
public function setUp() {
protected function setUp() {
// Call parent::setUp() allowing test cases to pass further modules.
parent::setUp();
......
......@@ -10,16 +10,16 @@ namespace Drupal\xmlsitemap\Tests;
use Drupal\Core\Language\LanguageInterface;
/**
* Tests the generation of user links.
* Tests the generation of node links.
*
* @group xmlsitemap
*/
class XmlSitemapNodeFunctionalTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('node', 'xmlsitemap', 'taxonomy');
public static $modules = ['node', 'taxonomy'];
/**
* Nodes created during the test for testCron() method.
......@@ -28,18 +28,10 @@ class XmlSitemapNodeFunctionalTest extends XmlSitemapTestBase {
*/
protected $nodes = array();
public static function getInfo() {
return array(
'name' => 'XML sitemap node',
'description' => 'Functional tests for the XML sitemap module node entity.',
'group' => 'XML sitemap',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
if ($this->profile != 'standard') {
......
......@@ -9,28 +9,20 @@ namespace Drupal\xmlsitemap\Tests;
/**
* Tests the rebuild process of sitemaps.
*
* @group xmlsitemap
*/
class XmlSitemapRebuildTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('xmlsitemap', 'path', 'node', 'system', 'user', 'help', 'block');
public static function getInfo() {
return array(
'name' => 'XML sitemap rebuild tests',
'description' => 'Rebuild tests for the XML sitemap module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['path', 'node', 'system', 'user', 'help', 'block'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('administer xmlsitemap', 'access administration pages', 'access site reports', 'administer users', 'administer permissions'));
......
......@@ -11,31 +11,16 @@ use Drupal\Core\Url;
/**
* Tests the robots.txt file existance.
*
* @group xmlsitemap
* @dependencies robotstxt
*/
class XmlSitemapRobotsTxtIntegrationTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('xmlsitemap', 'robotstxt');
public static function getInfo() {
return array(
'name' => 'XML sitemap robots.txt',
'description' => 'Integration tests for the XML sitemap and robots.txt module.',
'group' => 'XML sitemap',
'dependencies' => array('robotstxt'),
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
}
public static $modules = ['robotstxt'];
/**
* Test if sitemap link is included in robots.txt file.
......
......@@ -11,28 +11,20 @@ use Drupal\Component\Utility\Unicode;
/**
* Tests the generation of taxonomy links.
*
* @group xmlsitemap
*/
class XmlSitemapTaxonomyFunctionalTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('taxonomy', 'xmlsitemap');
public static function getInfo() {
return array(
'name' => 'XML sitemap taxonomy',
'description' => 'Functional tests for the XML sitemap module taxonomy entity.',
'group' => 'XML sitemap',
);
}
public static $modules = ['taxonomy'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
xmlsitemap_link_bundle_enable('taxonomy_vocabulary', 'taxonomy_vocabulary');
......
......@@ -20,7 +20,7 @@ abstract class XmlSitemapTestBase extends WebTestBase {
*
* @var array
*/
public static $modules = array('xmlsitemap');
public static $modules = ['xmlsitemap'];
/**
* The admin user account.
......@@ -81,8 +81,7 @@ abstract class XmlSitemapTestBase extends WebTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
array_unshift(self::$modules, 'xmlsitemap');
protected function setUp() {
parent::setUp();
$this->state = \Drupal::state();
$this->config = \Drupal::configFactory()->get('xmlsitemap.settings');
......
......@@ -8,29 +8,21 @@
namespace Drupal\xmlsitemap\Tests;
/**
* Unit testing class for xmlsitemap.
* Unit tests for the XML sitemap module.
*
* @group xmlsitemap
*/
class XmlSitemapUnitTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('xmlsitemap', 'node', 'system');
public static function getInfo() {
return array(
'name' => 'XML sitemap unit tests',
'description' => 'Unit tests for the XML sitemap module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['node', 'system'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('access content', 'administer site configuration', 'administer xmlsitemap'));
......
......@@ -9,30 +9,22 @@ namespace Drupal\xmlsitemap\Tests;
/**
* Tests the generation of user links.
*
* @group xmlsitemap
*/
class XmlSitemapUserFunctionalTest extends XmlSitemapTestBase {
protected $accounts = array();
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('xmlsitemap', 'user', 'node', 'system');
public static function getInfo() {
return array(
'name' => 'XML sitemap user',
'description' => 'Functional tests for the XML sitemap user module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['user', 'node', 'system'];
/**
* {@inheritdoc}
*/
public function setUp($modules = array()) {
protected function setUp() {
parent::setUp();
// allow anonymous user to view user profiles
......
......@@ -11,15 +11,15 @@ use Drupal\xmlsitemap\Tests\XmlSitemapTestBase;
/**
* Tests the functionality of xmlsitemap_custom module.
*
* @group xmlsitemap
*/
class XmlSitemapCustomFunctionalTest extends XmlSitemapTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = array('xmlsitemap_custom', 'path', 'node');
public static $modules = ['xmlsitemap_custom', 'path', 'node'];
/**
* The alias storage handler.
......@@ -35,18 +35,10 @@ class XmlSitemapCustomFunctionalTest extends XmlSitemapTestBase {
*/
protected $linkStorage;
public static function getInfo() {
return array(
'name' => 'XML sitemap custom interface tests',
'description' => 'Functional tests for the XML sitemap custom module.',
'group' => 'XML sitemap',
);
}
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->aliasStorage = \Drupal::service('path.alias_storage');
......
......@@ -12,6 +12,8 @@ use Drupal\Core\Url;
/**
* Test xmlsitemap_engines functionality.
*
* @group xmlsitemap
*/
class XmlSitemapEnginesFunctionalTest extends XmlSitemapTestBase {
......@@ -22,28 +24,15 @@ class XmlSitemapEnginesFunctionalTest extends XmlSitemapTestBase {
*/
protected $submit_url;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('system', 'path', 'node', 'dblog', 'xmlsitemap', 'xmlsitemap_engines', 'xmlsitemap_engines_test');
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'XML sitemap engines functional tests',
'description' => 'Functional tests for the XML sitemap engines module.',
'group' => 'XML sitemap',
);
}
public static $modules = ['system', 'path', 'node', 'dblog', 'xmlsitemap_engines', 'xmlsitemap_engines_test'];
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->admin_user = $this->drupalCreateUser(array('access content', 'administer xmlsitemap'));
$this->drupalLogin($this->admin_user);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment