Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Entity/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/strat/web/core/tests/Drupal/KernelTests/Core/Entity/EntityDeriverTest.php

<?php

declare(strict_types=1);

namespace Drupal\KernelTests\Core\Entity;

use Drupal\comment\Entity\CommentType;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
use Drupal\KernelTests\KernelTestBase;
use Drupal\node\Entity\NodeType;

/**
 * Tests EntityDeriver functionality.
 *
 * @coversDefaultClass \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver
 *
 * @group Entity
 */
class EntityDeriverTest extends KernelTestBase {

  /**
   * The typed data manager to use.
   *
   * @var \Drupal\Core\TypedData\TypedDataManagerInterface
   */
  protected $typedDataManager;

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
    'field',
    'user',
    'node',
    'comment',
    'entity_test',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('comment');
    NodeType::create(['type' => 'article', 'name' => 'Article'])->save();
    CommentType::create([
      'id' => 'comment',
      'label' => 'Default comment',
      'target_entity_type_id' => 'node',
    ])->save();
    entity_test_create_bundle('foo', NULL, 'entity_test_no_bundle');
    entity_test_create_bundle('entity_test_no_bundle', NULL, 'entity_test_no_bundle');
    $this->typedDataManager = $this->container->get('typed_data_manager');
  }

  /**
   * Tests that types are derived for entity types with and without bundles.
   *
   * @dataProvider derivativesProvider
   */
  public function testDerivatives($data_type, $expect_exception): void {
    if ($expect_exception) {
      $this->expectException(PluginNotFoundException::class);
    }
    $this->typedDataManager->createDataDefinition($data_type);
  }

  /**
   * Provides test data for ::testDerivatives().
   */
  public static function derivativesProvider() {
    return [
      'un-bundleable entity type with no bundle type' => ['entity:user', FALSE],
      'un-bundleable entity type with bundle type' => ['entity:user:user', TRUE],
      'bundleable entity type with no bundle type' => ['entity:node', FALSE],
      'bundleable entity type with bundle type' => [
        'entity:node:article',
        FALSE,
      ],
      'bundleable entity type with bundle type with matching name' => [
        'entity:comment:comment',
        FALSE,
      ],
      'un-bundleable entity type with entity_test_entity_bundle_info()-generated bundle type' => [
        'entity:entity_test_no_bundle:foo',
        FALSE,
      ],
      'un-bundleable entity type with entity_test_entity_bundle_info()-generated bundle type with matching name' => [
        'entity:entity_test_no_bundle:entity_test_no_bundle',
        FALSE,
      ],
    ];
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net