You are here

public function HttpFetcherTest::testHttpCacheDisabled in Feeds 8.3

Tests if nothing gets cached when disabling HTTP Caching.

File

tests/src/Functional/Feeds/Fetcher/HttpFetcherTest.php, line 177

Class

HttpFetcherTest
@coversDefaultClass \Drupal\feeds\Feeds\Fetcher\HttpFetcher @group feeds

Namespace

Drupal\Tests\feeds\Functional\Feeds\Fetcher

Code

public function testHttpCacheDisabled() {

  // Disable caching.
  $fetcher = $this->feedType
    ->getFetcher();
  $config = $fetcher
    ->getConfiguration();
  $config['always_download'] = TRUE;
  $fetcher
    ->setConfiguration($config);
  $this->feedType
    ->save();

  // Import feed.
  $feed = $this
    ->createFeed($this->feedType
    ->id(), [
    'source' => $this
      ->resourcesUrl() . '/rss/googlenewstz.rss2',
  ]);
  $this
    ->batchImport($feed);
  $this
    ->assertText('Created 6');
  $this
    ->assertNodeCount(6);

  // Assert that no cache entries were created.
  $count = $this->container
    ->get('database')
    ->select('cache_feeds_download')
    ->fields('cache_feeds_download', [])
    ->countQuery()
    ->execute()
    ->fetchField();
  $this
    ->assertEquals(0, $count);
}