Commit 0de8bea7 authored by catch's avatar catch

Issue #2067007 by andypost: Replace \Drupal:: with ->container->get() in test...

Issue #2067007 by andypost: Replace \Drupal:: with ->container->get() in test classes of aggregator module.
parent 523fb855
...@@ -24,8 +24,6 @@ public static function getInfo() { ...@@ -24,8 +24,6 @@ public static function getInfo() {
*/ */
public function testCron() { public function testCron() {
// Create feed and test basic updating on cron. // Create feed and test basic updating on cron.
global $base_url;
$key = \Drupal::state()->get('system.cron_key');
$this->createSampleNodes(); $this->createSampleNodes();
$feed = $this->createFeed(); $feed = $this->createFeed();
$this->cronRun(); $this->cronRun();
......
...@@ -137,7 +137,7 @@ function getFeedEditObject($feed_url = NULL, array $values = array()) { ...@@ -137,7 +137,7 @@ function getFeedEditObject($feed_url = NULL, array $values = array()) {
*/ */
function getDefaultFeedItemCount() { function getDefaultFeedItemCount() {
// Our tests are based off of rss.xml, so let's find out how many elements should be related. // Our tests are based off of rss.xml, so let's find out how many elements should be related.
$feed_count = db_query_range('SELECT COUNT(DISTINCT nid) FROM {node_field_data} n WHERE n.promote = 1 AND n.status = 1', 0, \Drupal::config('system.rss')->get('items.limit'))->fetchField(); $feed_count = db_query_range('SELECT COUNT(DISTINCT nid) FROM {node_field_data} n WHERE n.promote = 1 AND n.status = 1', 0, $this->container->get('config.factory')->get('system.rss')->get('items.limit'))->fetchField();
return $feed_count > 10 ? 10 : $feed_count; return $feed_count > 10 ? 10 : $feed_count;
} }
...@@ -370,7 +370,7 @@ function createSampleNodes($count = 5) { ...@@ -370,7 +370,7 @@ function createSampleNodes($count = 5) {
* Enable the plugins coming with aggregator_test module. * Enable the plugins coming with aggregator_test module.
*/ */
function enableTestPlugins() { function enableTestPlugins() {
\Drupal::config('aggregator.settings') $this->container->get('config.factory')->get('aggregator.settings')
->set('fetcher', 'aggregator_test_fetcher') ->set('fetcher', 'aggregator_test_fetcher')
->set('parser', 'aggregator_test_parser') ->set('parser', 'aggregator_test_parser')
->set('processors', array( ->set('processors', array(
......
...@@ -26,7 +26,7 @@ function setUp() { ...@@ -26,7 +26,7 @@ function setUp() {
// Do not remove old aggregator items during these tests, since our sample // Do not remove old aggregator items during these tests, since our sample
// feeds have hardcoded dates in them (which may be expired when this test // feeds have hardcoded dates in them (which may be expired when this test
// is run). // is run).
\Drupal::config('aggregator.settings')->set('items.expire', AGGREGATOR_CLEAR_NEVER)->save(); $this->container->get('config.factory')->get('aggregator.settings')->set('items.expire', AGGREGATOR_CLEAR_NEVER)->save();
// Reset any reader cache between tests. // Reset any reader cache between tests.
Reader::reset(); Reader::reset();
// Set our bridge extension manager to Zend Feed. // Set our bridge extension manager to Zend Feed.
......
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