You are here

public function PlaceholderResolverTest::testMalformedPlaceholders in Typed Data API enhancements 8

@covers ::scan

File

tests/src/Kernel/PlaceholderResolverTest.php, line 201

Class

PlaceholderResolverTest
Tests the placeholder resolver.

Namespace

Drupal\Tests\typed_data\Kernel

Code

public function testMalformedPlaceholders() {
  $text = "text {{ node. title }} text";
  $placeholders = $this->placeholderResolver
    ->scan($text);
  $this
    ->assertEquals([], $placeholders);
  $text = "text {{ node .title }} text";
  $placeholders = $this->placeholderResolver
    ->scan($text);
  $this
    ->assertEquals([], $placeholders);
  $text = "text {{node.}} text";
  $placeholders = $this->placeholderResolver
    ->scan($text);
  $this
    ->assertEquals([], $placeholders);
  $text = "text {{ node| }} text";
  $placeholders = $this->placeholderResolver
    ->scan($text);
  $this
    ->assertEquals([], $placeholders);
  $text = "text {{ no de }} text";
  $placeholders = $this->placeholderResolver
    ->scan($text);
  $this
    ->assertEquals([], $placeholders);
}