3 namespace Drupal\Tests\webprofiler\Kernel;
5 use Drupal\KernelTests\KernelTestBase;
12 class DecoratorTest extends KernelTestBase {
17 public static $modules = ['system', 'views'];
20 * Tests the Entity Type Manager service decoration.
22 * @param string $service
24 * @param string $original
26 * @param string $decorated
27 * The decorated class.
29 * @dataProvider decorators
31 public function testEntityTypeDecorator($service, $original, $decorated) {
32 $entityTypeManagerOriginal = $this->container->get($service);
34 $this->assertInstanceOf($original, $entityTypeManagerOriginal);
36 $this->container->get('module_installer')->install(['webprofiler']);
38 $entityTypeManagerDecorated = $this->container->get($service);
40 $this->assertInstanceOf($decorated, $entityTypeManagerDecorated);
44 * DataProvider for testEntityTypeDecorator.
47 * The array of values to run tests on.
49 public function decorators() {
51 array('entity_type.manager', 'Drupal\Core\Entity\EntityTypeManager', 'Drupal\webprofiler\Entity\EntityManagerWrapper'),
52 array('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory', 'Drupal\webprofiler\Cache\CacheFactoryWrapper'),
53 array('asset.css.collection_renderer', 'Drupal\Core\Asset\CssCollectionRenderer', 'Drupal\webprofiler\Asset\CssCollectionRendererWrapper'),
54 array('asset.js.collection_renderer', 'Drupal\Core\Asset\JsCollectionRenderer', 'Drupal\webprofiler\Asset\JsCollectionRendererWrapper'),
55 array('state', 'Drupal\Core\State\State', 'Drupal\webprofiler\State\StateWrapper'),
56 array('views.executable', 'Drupal\views\ViewExecutableFactory', 'Drupal\webprofiler\Views\ViewExecutableFactoryWrapper'),
57 array('form_builder', 'Drupal\Core\Form\FormBuilder', 'Drupal\webprofiler\Form\FormBuilderWrapper'),
58 array('access_manager', 'Drupal\Core\Access\AccessManager', 'Drupal\webprofiler\Access\AccessManagerWrapper'),
59 array('theme.negotiator', 'Drupal\Core\Theme\ThemeNegotiator', 'Drupal\webprofiler\Theme\ThemeNegotiatorWrapper'),
60 array('config.factory', 'Drupal\Core\Config\ConfigFactory', 'Drupal\webprofiler\Config\ConfigFactoryWrapper'),
61 array('string_translation', 'Drupal\Core\StringTranslation\TranslationManager', 'Drupal\webprofiler\StringTranslation\TranslationManagerWrapper'),