Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

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

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/Plugin/ContextDefinitionTest.php

<?php

declare(strict_types=1);

namespace Drupal\KernelTests\Core\Plugin;

use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\Core\Plugin\Context\EntityContext;
use Drupal\Core\Plugin\Context\EntityContextDefinition;
use Drupal\entity_test\Entity\EntityTest;
use Drupal\KernelTests\KernelTestBase;

/**
 * @coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition
 * @group Plugin
 */
class ContextDefinitionTest extends KernelTestBase {

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

  /**
   * @covers ::isSatisfiedBy
   */
  public function testIsSatisfiedBy(): void {
    $this->installEntitySchema('user');

    $value = EntityTest::create([]);
    // Assert that the entity has at least one violation.
    $this->assertNotEmpty($value->validate());
    // Assert that these violations do not prevent it from satisfying the
    // requirements of another object.
    $requirement = new ContextDefinition('any');
    $context = EntityContext::fromEntity($value);
    $this->assertTrue($requirement->isSatisfiedBy($context));

    // Test with multiple values.
    $definition = EntityContextDefinition::create('entity_test');
    $definition->setMultiple();
    $entities = [
      EntityTest::create([]),
      EntityTest::create([]),
    ];
    $context = new Context($definition, $entities);
    $this->assertTrue($definition->isSatisfiedBy($context));
  }

  /**
   * @covers ::__construct
   */
  public function testEntityContextDefinitionAssert(): void {
    $this->expectException(\AssertionError::class);
    $this->expectExceptionMessage('assert(!str_starts_with($data_type, \'entity:\') || $this instanceof EntityContextDefinition)');
    new ContextDefinition('entity:entity_test');
  }

  /**
   * @covers ::create
   */
  public function testCreateWithEntityDataType(): void {
    $this->assertInstanceOf(EntityContextDefinition::class, ContextDefinition::create('entity:user'));
  }

}

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