class AggregatorCronTest
Update feeds on cron.
@group aggregator @group legacy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase implements \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\aggregator\Functional\AggregatorCronTest uses \Drupal\Tests\Traits\Core\CronRunTrait implements \Drupal\Tests\aggregator\Functional\AggregatorTestBase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of AggregatorCronTest
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ AggregatorCronTest.php, line 13
Namespace
Drupal\Tests\aggregator\FunctionalView source
class AggregatorCronTest extends AggregatorTestBase {
use CronRunTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Adds feeds and updates them via cron process.
*/
public function testCron() {
// Create feed and test basic updating on cron.
$this->createSampleNodes();
$feed = $this->createFeed();
$count_query = \Drupal::entityQuery('aggregator_item')->accessCheck(FALSE)
->condition('fid', $feed->id())
->count();
$this->cronRun();
$this->assertEquals(5, $count_query->execute());
$this->deleteFeedItems($feed);
$this->assertEquals(0, $count_query->execute());
$this->cronRun();
$this->assertEquals(5, $count_query->execute());
// Test feed locking when queued for update.
$this->deleteFeedItems($feed);
$feed->setQueuedTime(REQUEST_TIME)
->save();
$this->cronRun();
$this->assertEquals(0, $count_query->execute());
$feed->setQueuedTime(0)
->save();
$this->cronRun();
$this->assertEquals(5, $count_query->execute());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.