Commit ab0ec7c0 authored by catch's avatar catch
Browse files

Issue #2979588 by longwave, alexpott, Erik Frèrejean, catch, daffie: Deprecate...

Issue #2979588 by longwave, alexpott, Erik Frèrejean, catch, daffie: Deprecate Laminas\Feed reader and writer services

(cherry picked from commit fc90d0c8)
parent 1201aa82
......@@ -1453,67 +1453,88 @@ services:
feed.reader.dublincoreentry:
class: Laminas\Feed\Reader\Extension\DublinCore\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('DublinCore\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.dublincorefeed:
class: Laminas\Feed\Reader\Extension\DublinCore\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('DublinCore\Feed') instead. See https://www.drupal.org/node/2979042
feed.reader.contententry:
class: Laminas\Feed\Reader\Extension\Content\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Content\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.atomentry:
class: Laminas\Feed\Reader\Extension\Atom\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Atom\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.atomfeed:
class: Laminas\Feed\Reader\Extension\Atom\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Atom\Feed') instead. See https://www.drupal.org/node/2979042
feed.reader.slashentry:
class: Laminas\Feed\Reader\Extension\Slash\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Slash\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.wellformedwebentry:
class: Laminas\Feed\Reader\Extension\WellFormedWeb\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('WellFormedWeb\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.threadentry:
class: Laminas\Feed\Reader\Extension\Thread\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Thread\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.podcastentry:
class: Laminas\Feed\Reader\Extension\Podcast\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Podcast\Entry') instead. See https://www.drupal.org/node/2979042
feed.reader.podcastfeed:
class: Laminas\Feed\Reader\Extension\Podcast\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Podcast\Feed') instead. See https://www.drupal.org/node/2979042
# Laminas Feed writer plugins. Plugins should be set as prototype scope.
feed.writer.atomrendererfeed:
class: Laminas\Feed\Writer\Extension\Atom\Renderer\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Atom\Renderer\Feed') instead. See https://www.drupal.org/node/2979042
feed.writer.contentrendererentry:
class: Laminas\Feed\Writer\Extension\Content\Renderer\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Content\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
feed.writer.dublincorerendererentry:
class: Laminas\Feed\Writer\Extension\DublinCore\Renderer\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('DublinCore\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
feed.writer.dublincorerendererfeed:
class: Laminas\Feed\Writer\Extension\DublinCore\Renderer\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('DublinCore\Renderer\Feed') instead. See https://www.drupal.org/node/2979042
feed.writer.itunesentry:
class: Laminas\Feed\Writer\Extension\ITunes\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Entry') instead. See https://www.drupal.org/node/2979042
feed.writer.itunesfeed:
class: Laminas\Feed\Writer\Extension\ITunes\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Feed') instead. See https://www.drupal.org/node/2979042
feed.writer.itunesrendererentry:
class: Laminas\Feed\Writer\Extension\ITunes\Renderer\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
feed.writer.itunesrendererfeed:
class: Laminas\Feed\Writer\Extension\ITunes\Renderer\Feed
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Renderer\Feed') instead. See https://www.drupal.org/node/2979042
feed.writer.slashrendererentry:
class: Laminas\Feed\Writer\Extension\Slash\Renderer\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Slash\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
feed.writer.threadingrendererentry:
class: Laminas\Feed\Writer\Extension\Threading\Renderer\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Threading\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
feed.writer.wellformedwebrendererentry:
class: Laminas\Feed\Writer\Extension\WellFormedWeb\Renderer\Entry
shared: false
deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('WellFormedWeb\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
theme.manager:
class: Drupal\Core\Theme\ThemeManager
arguments: ['%app.root%', '@theme.negotiator', '@theme.initialization', '@module_handler']
......
......@@ -4,7 +4,6 @@
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Laminas\Feed\Reader\ExtensionManagerInterface as ReaderManagerInterface;
use Laminas\Feed\Writer\ExtensionManagerInterface as WriterManagerInterface;
......@@ -69,25 +68,20 @@ public function __construct($prefix = '') {
* {@inheritdoc}
*/
public function get($extension) {
try {
return $this->container->get($this->prefix . $this->canonicalizeName($extension));
}
catch (ServiceNotFoundException $e) {
if ($this->standalone && $this->standalone->has($extension)) {
return $this->standalone->get($extension);
}
throw $e;
if ($this->standalone && $this->standalone->has($extension)) {
return $this->standalone->get($extension);
}
return $this->container->get($this->prefix . $this->canonicalizeName($extension));
}
/**
* {@inheritdoc}
*/
public function has($extension) {
if ($this->container->has($this->prefix . $this->canonicalizeName($extension))) {
if ($this->standalone && $this->standalone->has($extension)) {
return TRUE;
}
return $this->standalone && $this->standalone->has($extension);
return $this->container->has($this->prefix . $this->canonicalizeName($extension));
}
/**
......
......@@ -30,4 +30,41 @@ public function testAppRoot() {
$this->assertSame($this->container->get('app.root'), (string) $this->container->getParameter('app.root'));
}
/**
* Tests the deprecated Laminas Feed services.
*
* @dataProvider providerLaminasFeedServices
*/
public function testLaminasFeedServices($type, $service, $class) {
$service = "feed.$type.$service";
$this->expectDeprecation("The \"$service\" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \\Drupal::service('feed.bridge.$type')->get('$class') instead. See https://www.drupal.org/node/2979042");
$this->assertIsObject($this->container->get($service));
}
public function providerLaminasFeedServices() {
return [
['reader', 'dublincoreentry', 'DublinCore\Entry'],
['reader', 'dublincorefeed', 'DublinCore\Feed'],
['reader', 'contententry', 'Content\Entry'],
['reader', 'atomentry', 'Atom\Entry'],
['reader', 'atomfeed', 'Atom\Feed'],
['reader', 'slashentry', 'Slash\Entry'],
['reader', 'wellformedwebentry', 'WellFormedWeb\Entry'],
['reader', 'threadentry', 'Thread\Entry'],
['reader', 'podcastentry', 'Podcast\Entry'],
['reader', 'podcastfeed', 'Podcast\Feed'],
['writer', 'atomrendererfeed', 'Atom\Renderer\Feed'],
['writer', 'contentrendererentry', 'Content\Renderer\Entry'],
['writer', 'dublincorerendererentry', 'DublinCore\Renderer\Entry'],
['writer', 'dublincorerendererfeed', 'DublinCore\Renderer\Feed'],
['writer', 'itunesentry', 'ITunes\Entry'],
['writer', 'itunesfeed', 'ITunes\Feed'],
['writer', 'itunesrendererentry', 'ITunes\Renderer\Entry'],
['writer', 'itunesrendererfeed', 'ITunes\Renderer\Feed'],
['writer', 'slashrendererentry', 'Slash\Renderer\Entry'],
['writer', 'threadingrendererentry', 'Threading\Renderer\Entry'],
['writer', 'wellformedwebrendererentry', 'WellFormedWeb\Renderer\Entry'],
];
}
}
......@@ -30,9 +30,9 @@ public function testGet() {
$this->assertEquals($service, $bridge->get('foo'));
$bridge->setStandalone(StandaloneExtensionManager::class);
$this->assertInstanceOf(Entry::class, $bridge->get('Atom\Entry'));
// Ensure that the container is checked first.
// Ensure that the standalone service is checked before the container.
$container->set('atomentry', $service);
$this->assertEquals($service, $bridge->get('Atom\Entry'));
$this->assertInstanceOf(Entry::class, $bridge->get('Atom\Entry'));
}
/**
......
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