TestAttribute example

return [
      ['{{ entity.delete }}'],
      ['{{ entity.save }}'],
      ['{{ entity.create }}'],
    ];
  }

  /** * Tests that white listed classes can be extended. */
  public function testExtendedClass() {
    $this->assertEquals(' class="kitten"', $this->twig->render('{{ attribute.addClass("kitten") }}', ['attribute' => new TestAttribute()]));
  }

  /** * Tests that prefixed methods can be called from within Twig templates. * * Currently "get", "has", and "is" are the only allowed prefixes. */
  public function testEntitySafePrefixes() {
    $entity = $this->createMock('Drupal\Core\Entity\EntityInterface');
    $entity->expects($this->atLeastOnce())
      ->method('hasLinkTemplate')
      
Home | Imprint | This part of the site doesn't use cookies.