class UpdateFeedTest
Same name and namespace in other branches
- 8.9.x core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php \Drupal\Tests\aggregator\Functional\UpdateFeedTest
Update feed test.
@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 extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\aggregator\Functional\UpdateFeedTest extends \Drupal\Tests\aggregator\Functional\AggregatorTestBase
- class \Drupal\Tests\aggregator\Functional\AggregatorTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of UpdateFeedTest
File
-
core/
modules/ aggregator/ tests/ src/ Functional/ UpdateFeedTest.php, line 11
Namespace
Drupal\Tests\aggregator\FunctionalView source
class UpdateFeedTest extends AggregatorTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Creates a feed and attempts to update it.
*/
public function testUpdateFeed() {
$remaining_fields = [
'title[0][value]',
'url[0][value]',
'',
];
foreach ($remaining_fields as $same_field) {
$feed = $this->createFeed();
// Get new feed data array and modify newly created feed.
$edit = $this->getFeedEditArray();
// Change refresh value.
$edit['refresh'] = 1800;
if (isset($feed->{$same_field}->value)) {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this->drupalGet('aggregator/sources/' . $feed->id() . '/configure');
$this->submitForm($edit, 'Save');
$this->assertSession()
->pageTextContains('The feed ' . $edit['title[0][value]'] . ' has been updated.');
// Verify that the creation message contains a link to a feed.
$this->assertSession()
->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]');
// Check feed data.
$this->assertSession()
->addressEquals($feed->toUrl('canonical'));
$this->assertTrue($this->uniqueFeed($edit['title[0][value]'], $edit['url[0][value]']), 'The feed is unique.');
// Check feed source, the title should be on the page.
$this->drupalGet('aggregator/sources/' . $feed->id());
$this->assertSession()
->statusCodeEquals(200);
$this->assertSession()
->pageTextContains($edit['title[0][value]']);
// Set correct title so deleteFeed() will work.
$feed->title = $edit['title[0][value]'];
// Delete feed.
$this->deleteFeed($feed);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.