Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\AggregatorFeedViewsData.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\AggregatorItemViewsData.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\views\EntityViewsData;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Annotation\AggregatorFetcher.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Annotation\AggregatorParser.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Annotation\AggregatorProcessor.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Controller\AggregatorController.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Controller;
|
||||
|
||||
use Drupal\Component\Utility\Xss;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Entity\Feed.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Entity;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Entity\Item.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Entity;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedAccessControlHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
|
@ -21,9 +16,7 @@ class FeedForm extends ContentEntityForm {
|
|||
*/
|
||||
public function save(array $form, FormStateInterface $form_state) {
|
||||
$feed = $this->entity;
|
||||
$insert = (bool) $feed->id();
|
||||
$feed->save();
|
||||
if ($insert) {
|
||||
if ($feed->save() == SAVED_UPDATED) {
|
||||
drupal_set_message($this->t('The feed %feed has been updated.', array('%feed' => $feed->label())));
|
||||
$form_state->setRedirectUrl($feed->urlInfo('canonical'));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedHtmlRouteProvider.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedStorageInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedStorageSchema.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\FeedViewBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Form\FeedDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Form\FeedItemsDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityConfirmFormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Form\OpmlFeedAdd.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Form;
|
||||
|
||||
use Drupal\aggregator\FeedStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Form\SettingsForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Form;
|
||||
|
||||
use Drupal\aggregator\Plugin\AggregatorPluginManager;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\Query\QueryInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemStorageInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemStorageSchema.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemViewBuilder.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\Core\Entity\EntityViewBuilder;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemsImporter.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
use Drupal\aggregator\Plugin\AggregatorPluginManager;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\ItemsImporterInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\AggregatorPluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin;
|
||||
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\AggregatorPluginSettingsBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\ConfigurablePluginInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\Block\AggregatorFeedBlock.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\Block;
|
||||
|
||||
use Drupal\aggregator\FeedStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\FetcherInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin;
|
||||
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\Field\FieldFormatter\AggregatorTitleFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\Field\FieldFormatter\AggregatorXSSFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\ParserInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin;
|
||||
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\ProcessorInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin;
|
||||
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\QueueWorker\AggregatorRefresh.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\QueueWorker;
|
||||
|
||||
use Drupal\aggregator\FeedInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\Validation\Constraint\FeedTitleConstraint.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\Validation\Constraint;
|
||||
|
||||
use Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldConstraint;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\Validation\Constraint\FeedUrlConstraint.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\Validation\Constraint;
|
||||
|
||||
use Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldConstraint;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\aggregator\fetcher\DefaultFetcher.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\aggregator\fetcher;
|
||||
|
||||
use Drupal\aggregator\Plugin\FetcherInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\aggregator\parser\DefaultParser.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\aggregator\parser;
|
||||
|
||||
use Drupal\aggregator\Plugin\ParserInterface;
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\aggregator\processor\DefaultProcessor.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\aggregator\processor;
|
||||
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\aggregator\ItemStorageInterface;
|
||||
use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
|
||||
use Drupal\aggregator\Plugin\ProcessorInterface;
|
||||
|
@ -215,7 +211,7 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
|
|||
$entry = reset($entry);
|
||||
}
|
||||
else {
|
||||
$entry = entity_create('aggregator_item', array('langcode' => $feed->language()->getId()));
|
||||
$entry = Item::create(array('langcode' => $feed->language()->getId()));
|
||||
}
|
||||
if ($item['timestamp']) {
|
||||
$entry->setPostedTime($item['timestamp']);
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\migrate\source\AggregatorFeed.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\migrate\source;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
@ -37,8 +32,8 @@ class AggregatorFeed extends DrupalSqlBase {
|
|||
'url' => $this->t('URL to the feed.'),
|
||||
'refresh' => $this->t('Refresh frequency in seconds.'),
|
||||
'checked' => $this->t('Last-checked unix timestamp.'),
|
||||
'link' => $this->t('Parent website of feed.'),
|
||||
'description' => $this->t('Parent website\'s description fo the feed.'),
|
||||
'link' => $this->t('Parent website of the feed.'),
|
||||
'description' => $this->t("Parent website's description of the feed."),
|
||||
'image' => $this->t('An image representing the feed.'),
|
||||
'etag' => $this->t('Entity tag HTTP response header.'),
|
||||
'modified' => $this->t('When the feed was last modified.'),
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\migrate\source\AggregatorItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\migrate\source;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\views\argument\Fid.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\views\argument;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\views\argument\Iid.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\views\argument;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Plugin\views\row\Rss.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Plugin\views\row;
|
||||
|
||||
use Drupal\views\Plugin\views\row\RssPluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\AddFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +23,7 @@ class AddFeedTest extends AggregatorTestBase {
|
|||
$feed->refreshItems();
|
||||
|
||||
// Check feed data.
|
||||
$this->assertUrl(\Drupal::url('aggregator.feed_add', [], ['absolute' => TRUE]), [], 'Directed to correct url.');
|
||||
$this->assertUrl(\Drupal::url('aggregator.feed_add', [], ['absolute' => TRUE]), [], 'Directed to correct URL.');
|
||||
$this->assertTrue($this->uniqueFeed($feed->label(), $feed->getUrl()), 'The feed is unique.');
|
||||
|
||||
// Check feed source.
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\AggregatorAdminTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\AggregatorCronTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\AggregatorRenderingTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\AggregatorTestBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
|
@ -137,7 +132,7 @@ abstract class AggregatorTestBase extends WebTestBase {
|
|||
'url' => $feed_url,
|
||||
'refresh' => '900',
|
||||
);
|
||||
return entity_create('aggregator_feed', $values);
|
||||
return Feed::create($values);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\AggregatorTitleTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
|
||||
/**
|
||||
* Tests the aggregator_title formatter.
|
||||
*
|
||||
* @group field
|
||||
*/
|
||||
class AggregatorTitleTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['file', 'field', 'options', 'aggregator'];
|
||||
|
||||
/**
|
||||
* The field name that is tested.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $fieldName;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installConfig(['field']);
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
|
||||
$this->fieldName = 'title';
|
||||
}
|
||||
|
||||
/*
|
||||
* Tests the formatter output.
|
||||
*/
|
||||
public function testStringFormatter() {
|
||||
// Create an aggregator feed.
|
||||
$aggregator_feed = Feed::create([
|
||||
'title' => 'testing title',
|
||||
'url' => 'http://www.example.com',
|
||||
]);
|
||||
$aggregator_feed->save();
|
||||
|
||||
// Create an aggregator feed item.
|
||||
$aggregator_item = Item::create([
|
||||
'title' => 'test title',
|
||||
'fid' => $aggregator_feed->id(),
|
||||
'link' => 'http://www.example.com',
|
||||
]);
|
||||
$aggregator_item->save();
|
||||
|
||||
// Verify aggregator feed title with and without links.
|
||||
$build = $aggregator_feed->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => TRUE]]);
|
||||
$result = $this->render($build);
|
||||
|
||||
$this->assertTrue(strpos($result, 'testing title'));
|
||||
$this->assertTrue(strpos($result, 'href="' . $aggregator_feed->getUrl()) . '"');
|
||||
|
||||
$build = $aggregator_feed->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => FALSE]]);
|
||||
$result = $this->render($build);
|
||||
$this->assertTrue(strpos($result, 'testing title') === 0);
|
||||
$this->assertTrue(strpos($result, $aggregator_feed->getUrl()) === FALSE);
|
||||
|
||||
// Verify aggregator item title with and without links.
|
||||
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' =>TRUE]]);
|
||||
$result = $this->render($build);
|
||||
|
||||
$this->assertTrue(strpos($result, 'test title'));
|
||||
$this->assertTrue(strpos($result, 'href="' . $aggregator_item->getLink()) . '"');
|
||||
|
||||
$build = $aggregator_item->{$this->fieldName}->view(['type' => 'aggregator_title', 'settings' => ['display_as_link' => FALSE]]);
|
||||
$result = $this->render($build);
|
||||
$this->assertTrue(strpos($result, 'test title') === 0);
|
||||
$this->assertTrue(strpos($result, $aggregator_item->getLink()) === FALSE);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\DeleteFeedItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\DeleteFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedAdminDisplayTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedCacheTagsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedFetcherPluginTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedLanguageTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\language\Entity\ConfigurableLanguage;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedParserTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
|
||||
/**
|
||||
* Tests the built-in feed parser with valid feed samples.
|
||||
|
@ -89,7 +85,7 @@ class FeedParserTest extends AggregatorTestBase {
|
|||
*/
|
||||
public function testRedirectFeed() {
|
||||
$redirect_url = Url::fromRoute('aggregator_test.redirect')->setAbsolute()->toString();
|
||||
$feed = entity_create('aggregator_feed', array('url' => $redirect_url, 'title' => $this->randomMachineName()));
|
||||
$feed = Feed::create(array('url' => $redirect_url, 'title' => $this->randomMachineName()));
|
||||
$feed->save();
|
||||
$feed->refreshItems();
|
||||
|
||||
|
@ -103,7 +99,7 @@ class FeedParserTest extends AggregatorTestBase {
|
|||
public function testInvalidFeed() {
|
||||
// Simulate a typo in the URL to force a curl exception.
|
||||
$invalid_url = 'http:/www.drupal.org';
|
||||
$feed = entity_create('aggregator_feed', array('url' => $invalid_url, 'title' => $this->randomMachineName()));
|
||||
$feed = Feed::create(array('url' => $invalid_url, 'title' => $this->randomMachineName()));
|
||||
$feed->save();
|
||||
|
||||
// Update the feed. Use the UI to be able to check the message easily.
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedProcessorPluginTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\FeedValidationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
|
||||
/**
|
||||
* Tests feed validation constraints.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class FeedValidationTest extends EntityUnitTestBase {
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('aggregator', 'options');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the feed validation constraints.
|
||||
*/
|
||||
public function testValidation() {
|
||||
// Add feed.
|
||||
$feed = Feed::create([
|
||||
'title' => 'Feed 1',
|
||||
'url' => 'https://www.drupal.org/planet/rss.xml',
|
||||
'refresh' => 900,
|
||||
]);
|
||||
|
||||
$violations = $feed->validate();
|
||||
$this->assertEqual(count($violations), 0);
|
||||
|
||||
$feed->save();
|
||||
|
||||
// Add another feed.
|
||||
/* @var \Drupal\aggregator\FeedInterface $feed */
|
||||
$feed = Feed::create([
|
||||
'title' => 'Feed 1',
|
||||
'url' => 'https://www.drupal.org/planet/rss.xml',
|
||||
'refresh' => 900,
|
||||
]);
|
||||
|
||||
$violations = $feed->validate();
|
||||
|
||||
$this->assertEqual(count($violations), 2);
|
||||
$this->assertEqual($violations[0]->getPropertyPath(), 'title');
|
||||
$this->assertEqual($violations[0]->getMessage(), t('A feed named %value already exists. Enter a unique title.', [
|
||||
'%value' => $feed->label(),
|
||||
]));
|
||||
$this->assertEqual($violations[1]->getPropertyPath(), 'url');
|
||||
$this->assertEqual($violations[1]->getMessage(), t('A feed with this URL %value already exists. Enter a unique URL.', [
|
||||
'%value' => $feed->getUrl(),
|
||||
]));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\ImportOpmlTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\ItemCacheTagsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\ItemWithoutFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests clean handling of an item with a missing feed ID.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class ItemWithoutFeedTest extends KernelTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator', 'options'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests attempting to create a feed item without a feed.
|
||||
*/
|
||||
public function testEntityCreation() {
|
||||
$entity = Item::create([
|
||||
'title' => t('Llama 2'),
|
||||
'path' => 'https://groups.drupal.org/',
|
||||
]);
|
||||
$violations = $entity->validate();
|
||||
$this->assertCount(1, $violations);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\MigrateAggregatorStubTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate;
|
||||
|
||||
use Drupal\migrate\MigrateException;
|
||||
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
|
||||
use Drupal\migrate_drupal\Tests\StubTestTrait;
|
||||
|
||||
/**
|
||||
* Test stub creation for aggregator feeds and items.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class MigrateAggregatorStubTest extends MigrateDrupalTestBase {
|
||||
|
||||
use StubTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creation of aggregator feed stubs.
|
||||
*/
|
||||
public function testFeedStub() {
|
||||
$this->performStubTest('aggregator_feed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creation of aggregator feed items.
|
||||
*/
|
||||
public function testItemStub() {
|
||||
try {
|
||||
// We expect an exception, because there's no feed to reference.
|
||||
$this->performStubTest('aggregator_item');
|
||||
$this->fail('Expected exception has not been thrown.');
|
||||
}
|
||||
catch (MigrateException $e) {
|
||||
$this->assertIdentical($e->getMessage(),
|
||||
'Stubbing failed, unable to generate value for field fid');
|
||||
}
|
||||
|
||||
// The stub should pass when there's a feed to point to.
|
||||
$this->createStub('aggregator_feed');
|
||||
$this->performStubTest('aggregator_item');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\d6\MigrateAggregatorConfigsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Upgrade variables to aggregator.settings.yml.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateAggregatorConfigsTest extends MigrateDrupal6TestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->executeMigration('d6_aggregator_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator variables to aggregator.settings.yml.
|
||||
*/
|
||||
public function testAggregatorSettings() {
|
||||
$config = $this->config('aggregator.settings');
|
||||
$this->assertIdentical('aggregator', $config->get('fetcher'));
|
||||
$this->assertIdentical('aggregator', $config->get('parser'));
|
||||
$this->assertIdentical(array('aggregator'), $config->get('processors'));
|
||||
$this->assertIdentical(600, $config->get('items.teaser_length'));
|
||||
$this->assertIdentical('<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>', $config->get('items.allowed_html'));
|
||||
$this->assertIdentical(9676800, $config->get('items.expire'));
|
||||
$this->assertIdentical(3, $config->get('source.list_max'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'aggregator.settings', $config->get());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\d6\MigrateAggregatorFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator feeds.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateAggregatorFeedTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->executeMigration('d6_aggregator_feed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator feeds.
|
||||
*/
|
||||
public function testAggregatorFeedImport() {
|
||||
/** @var \Drupal\aggregator\Entity\Feed $feed */
|
||||
$feed = Feed::load(5);
|
||||
$this->assertIdentical('Know Your Meme', $feed->title->value);
|
||||
$this->assertIdentical('en', $feed->language()->getId());
|
||||
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->url->value);
|
||||
$this->assertIdentical('900', $feed->refresh->value);
|
||||
$this->assertIdentical('1387659487', $feed->checked->value);
|
||||
$this->assertIdentical('0', $feed->queued->value);
|
||||
$this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
|
||||
$this->assertIdentical('New items added to the News Feed', $feed->description->value);
|
||||
$this->assertIdentical('http://b.thumbs.redditmedia.com/harEHsUUZVajabtC.png', $feed->image->value);
|
||||
$this->assertIdentical('"213cc1365b96c310e92053c5551f0504"', $feed->etag->value);
|
||||
$this->assertIdentical('0', $feed->modified->value);
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\d6\MigrateAggregatorItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator items.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateAggregatorItemTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
$this->executeMigrations(['d6_aggregator_feed', 'd6_aggregator_item']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Drupal 6 aggregator item migration to Drupal 8.
|
||||
*/
|
||||
public function testAggregatorItem() {
|
||||
/** @var \Drupal\aggregator\Entity\Item $item */
|
||||
$item = Item::load(1);
|
||||
$this->assertIdentical('1', $item->id());
|
||||
$this->assertIdentical('5', $item->getFeedId());
|
||||
$this->assertIdentical('This (three) weeks in Drupal Core - January 10th 2014', $item->label());
|
||||
$this->assertIdentical('larowlan', $item->getAuthor());
|
||||
$this->assertIdentical("<h2 id='new'>What's new with Drupal 8?</h2>", $item->getDescription());
|
||||
$this->assertIdentical('https://groups.drupal.org/node/395218', $item->getLink());
|
||||
$this->assertIdentical('1389297196', $item->getPostedTime());
|
||||
$this->assertIdentical('en', $item->language()->getId());
|
||||
$this->assertIdentical('395218 at https://groups.drupal.org', $item->getGuid());
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\d7\MigrateAggregatorFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Test migration to aggregator_feed entities.
|
||||
*
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateAggregatorFeedTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->executeMigration('d7_aggregator_feed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator feeds.
|
||||
*/
|
||||
public function testAggregatorFeedImport() {
|
||||
/** @var \Drupal\aggregator\FeedInterface $feed */
|
||||
$feed = Feed::load(1);
|
||||
$this->assertIdentical('Know Your Meme', $feed->label());
|
||||
$this->assertIdentical('en', $feed->language()->getId());
|
||||
$this->assertIdentical('http://knowyourmeme.com/newsfeed.rss', $feed->getUrl());
|
||||
$this->assertIdentical('900', $feed->getRefreshRate());
|
||||
// The feed's last checked time can change as the fixture is updated, so
|
||||
// assert that its format is correct.
|
||||
$checked_time = $feed->getLastCheckedTime();
|
||||
$this->assertTrue(is_numeric($checked_time));
|
||||
$this->assertTrue($checked_time > 1000000000);
|
||||
$this->assertIdentical('0', $feed->getQueuedTime());
|
||||
$this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
|
||||
$this->assertIdentical('New items added to the News Feed', $feed->getDescription());
|
||||
$this->assertNull($feed->getImage());
|
||||
// As with getLastCheckedTime(), the etag can change as the fixture is
|
||||
// updated normally, so assert that its format is correct.
|
||||
$this->assertTrue(preg_match('/^"[a-z0-9]{32}"$/', $feed->getEtag()));
|
||||
$this->assertIdentical('0', $feed->getLastModified());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\d7\MigrateAggregatorItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of aggregator items.
|
||||
*
|
||||
* @group migrate_drupal_7
|
||||
*/
|
||||
class MigrateAggregatorItemTest extends MigrateDrupal7TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
$this->executeMigration('d7_aggregator_feed');
|
||||
$this->executeMigration('d7_aggregator_item');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Drupal 7 aggregator item migration to Drupal 8.
|
||||
*/
|
||||
public function testAggregatorItem() {
|
||||
// Since the feed items can change as the fixture is updated normally,
|
||||
// assert all migrated feed items against the values in the fixture.
|
||||
$items = $this->sourceDatabase
|
||||
->select('aggregator_item', 'ai')
|
||||
->fields('ai')
|
||||
->execute();
|
||||
|
||||
foreach ($items as $original) {
|
||||
/** @var \Drupal\aggregator\ItemInterface $item */
|
||||
$item = Item::load($original->iid);
|
||||
$this->assertIdentical($original->fid, $item->getFeedId());
|
||||
$this->assertIdentical($original->title, $item->label());
|
||||
// If $original->author is an empty string, getAuthor() returns NULL so
|
||||
// we need to use assertEqual() here.
|
||||
$this->assertEqual($original->author, $item->getAuthor());
|
||||
$this->assertIdentical($original->description, $item->getDescription());
|
||||
$this->assertIdentical($original->link, $item->getLink());
|
||||
$this->assertIdentical($original->timestamp, $item->getPostedTime());
|
||||
$this->assertIdentical('en', $item->language()->getId());
|
||||
$this->assertIdentical($original->guid, $item->getGuid());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Migrate\d7\MigrateAggregatorSettingsTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Tests migration of Aggregator's variables to configuration.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class MigrateAggregatorSettingsTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = ['aggregator'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installConfig(static::$modules);
|
||||
$this->executeMigration('d7_aggregator_settings');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of Aggregator variables to configuration.
|
||||
*/
|
||||
public function testMigration() {
|
||||
$config = \Drupal::config('aggregator.settings')->get();
|
||||
$this->assertIdentical('aggregator', $config['fetcher']);
|
||||
$this->assertIdentical('aggregator', $config['parser']);
|
||||
$this->assertIdentical(['aggregator'], $config['processors']);
|
||||
$this->assertIdentical('<p> <div> <a>', $config['items']['allowed_html']);
|
||||
$this->assertIdentical(500, $config['items']['teaser_length']);
|
||||
$this->assertIdentical(86400, $config['items']['expire']);
|
||||
$this->assertIdentical(6, $config['source']['list_max']);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\UpdateFeedItemTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\UpdateFeedTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Views\AggregatorFeedViewsFieldAccessTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Views;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
|
||||
|
||||
/**
|
||||
* Tests base field access in Views for the aggregator_feed entity.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class AggregatorFeedViewsFieldAccessTest extends FieldFieldAccessTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator', 'entity_test', 'options'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks access for aggregator_feed fields.
|
||||
*/
|
||||
public function testAggregatorFeedFields() {
|
||||
$feed = Feed::create([
|
||||
'title' => 'Drupal org',
|
||||
'url' => 'https://www.drupal.org/rss.xml',
|
||||
'link' => 'https://www.drupal.org/rss.xml',
|
||||
]);
|
||||
$feed->save();
|
||||
|
||||
// @todo Expand the test coverage in https://www.drupal.org/node/2464635
|
||||
|
||||
// $this->assertFieldAccess('aggregator_feed', 'title', $feed->label());
|
||||
$this->assertFieldAccess('aggregator_feed', 'langcode', $feed->language()->getName());
|
||||
$this->assertFieldAccess('aggregator_feed', 'url', $feed->getUrl());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Views\AggregatorItemViewsFieldAccessTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Views;
|
||||
|
||||
use Drupal\aggregator\Entity\Feed;
|
||||
use Drupal\aggregator\Entity\Item;
|
||||
use Drupal\views\Tests\Handler\FieldFieldAccessTestBase;
|
||||
|
||||
/**
|
||||
* Tests base field access in Views for the aggregator_item entity.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class AggregatorItemViewsFieldAccessTest extends FieldFieldAccessTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['aggregator', 'entity_test', 'options'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks access for aggregator_item fields.
|
||||
*/
|
||||
public function testAggregatorItemFields() {
|
||||
$feed = Feed::create([
|
||||
'title' => 'Drupal org',
|
||||
'url' => 'https://www.drupal.org/rss.xml',
|
||||
]);
|
||||
$feed->save();
|
||||
$item = Item::create([
|
||||
'title' => 'Test title',
|
||||
'fid' => $feed->id(),
|
||||
'description' => 'Test description',
|
||||
]);
|
||||
|
||||
$item->save();
|
||||
|
||||
// @todo Expand the test coverage in https://www.drupal.org/node/2464635
|
||||
|
||||
$this->assertFieldAccess('aggregator_item', 'title', $item->getTitle());
|
||||
$this->assertFieldAccess('aggregator_item', 'langcode', $item->language()->getName());
|
||||
$this->assertFieldAccess('aggregator_item', 'description', $item->getDescription());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\aggregator\Tests\Views\IntegrationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\aggregator\Tests\Views;
|
||||
|
||||
use Drupal\Component\Utility\Xss;
|
||||
use Drupal\Core\Render\RenderContext;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\views\Views;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
use Drupal\views\Tests\ViewKernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests basic integration of views data from the aggregator module.
|
||||
*
|
||||
* @group aggregator
|
||||
*/
|
||||
class IntegrationTest extends ViewKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('aggregator', 'aggregator_test_views', 'system', 'field', 'options', 'user');
|
||||
|
||||
/**
|
||||
* Views used by this test.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_aggregator_items');
|
||||
|
||||
/**
|
||||
* The entity storage for aggregator items.
|
||||
*
|
||||
* @var \Drupal\aggregator\ItemStorage
|
||||
*/
|
||||
protected $itemStorage;
|
||||
|
||||
/**
|
||||
* The entity storage for aggregator feeds.
|
||||
*
|
||||
* @var \Drupal\aggregator\FeedStorage
|
||||
*/
|
||||
protected $feedStorage;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('aggregator_item');
|
||||
$this->installEntitySchema('aggregator_feed');
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), array('aggregator_test_views'));
|
||||
|
||||
$this->itemStorage = $this->container->get('entity.manager')->getStorage('aggregator_item');
|
||||
$this->feedStorage = $this->container->get('entity.manager')->getStorage('aggregator_feed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests basic aggregator_item view.
|
||||
*/
|
||||
public function testAggregatorItemView() {
|
||||
/** @var \Drupal\Core\Render\RendererInterface $renderer */
|
||||
$renderer = \Drupal::service('renderer');
|
||||
|
||||
$feed = $this->feedStorage->create(array(
|
||||
'title' => $this->randomMachineName(),
|
||||
'url' => 'https://www.drupal.org/',
|
||||
'refresh' => 900,
|
||||
'checked' => 123543535,
|
||||
'description' => $this->randomMachineName(),
|
||||
));
|
||||
$feed->save();
|
||||
|
||||
$items = array();
|
||||
$expected = array();
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$values = array();
|
||||
$values['fid'] = $feed->id();
|
||||
$values['timestamp'] = mt_rand(REQUEST_TIME - 10, REQUEST_TIME + 10);
|
||||
$values['title'] = $this->randomMachineName();
|
||||
$values['description'] = $this->randomMachineName();
|
||||
// Add a image to ensure that the sanitizing can be tested below.
|
||||
$values['author'] = $this->randomMachineName() . '<img src="http://example.com/example.png" \>"';
|
||||
$values['link'] = 'https://www.drupal.org/node/' . mt_rand(1000, 10000);
|
||||
$values['guid'] = $this->randomString();
|
||||
|
||||
$aggregator_item = $this->itemStorage->create($values);
|
||||
$aggregator_item->save();
|
||||
$items[$aggregator_item->id()] = $aggregator_item;
|
||||
|
||||
$values['iid'] = $aggregator_item->id();
|
||||
$expected[] = $values;
|
||||
}
|
||||
|
||||
$view = Views::getView('test_aggregator_items');
|
||||
$this->executeView($view);
|
||||
|
||||
$column_map = array(
|
||||
'iid' => 'iid',
|
||||
'title' => 'title',
|
||||
'aggregator_item_timestamp' => 'timestamp',
|
||||
'description' => 'description',
|
||||
'aggregator_item_author' => 'author',
|
||||
);
|
||||
$this->assertIdenticalResultset($view, $expected, $column_map);
|
||||
|
||||
// Ensure that the rendering of the linked title works as expected.
|
||||
foreach ($view->result as $row) {
|
||||
$iid = $view->field['iid']->getValue($row);
|
||||
$expected_link = \Drupal::l($items[$iid]->getTitle(), Url::fromUri($items[$iid]->getLink(), ['absolute' => TRUE]));
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($view, $row) {
|
||||
return $view->field['title']->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $expected_link, 'Ensure the right link is generated');
|
||||
|
||||
$expected_author = Xss::filter($items[$iid]->getAuthor(), _aggregator_allowed_tags());
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($view, $row) {
|
||||
return $view->field['author']->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $expected_author, 'Ensure the author got filtered');
|
||||
|
||||
$expected_description = Xss::filter($items[$iid]->getDescription(), _aggregator_allowed_tags());
|
||||
$output = $renderer->executeInRenderContext(new RenderContext(), function () use ($view, $row) {
|
||||
return $view->field['description']->advancedRender($row);
|
||||
});
|
||||
$this->assertEqual($output, $expected_description, 'Ensure the author got filtered');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue