Skip to content
Snippets Groups Projects
Commit 4fb024fe authored by Adam Fasoldt's avatar Adam Fasoldt Committed by Goran Nikolovski
Browse files

Issue #3290165 by Project Update Bot, loopy1492, gnikolovski: Automated Drupal...

Issue #3290165 by Project Update Bot, loopy1492, gnikolovski: Automated Drupal 10 compatibility fixes
parent 4615a3af
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,6 @@
"license": "GPL-2.0+",
"minimum-stability": "dev",
"require": {
"drupal/core": "^8 || ^9"
"drupal/core": "^9 || ^10"
}
}
......@@ -5,11 +5,13 @@ namespace Drupal\twig_render_this\TwigExtension;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\FieldItemListInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
/**
* Twig Render This filter.
*/
class RenderThis extends \Twig_Extension {
class RenderThis extends AbstractExtension {
/**
* {@inheritdoc}
......@@ -23,7 +25,7 @@ class RenderThis extends \Twig_Extension {
*/
public function getFilters() {
return [
new \Twig_SimpleFilter('renderThis', [$this, 'renderThisFilter']),
new TwigFilter('renderThis', [$this, 'renderThisFilter']),
];
}
......
......@@ -14,7 +14,7 @@ class TwigRenderThisTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
protected static $modules = [
'menu_ui',
'node',
'user',
......@@ -31,7 +31,7 @@ class TwigRenderThisTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
public function setUp(): void {
parent::setUp();
$types = ['article', 'page', 'product'];
......@@ -65,13 +65,13 @@ class TwigRenderThisTest extends BrowserTestBase {
*/
public function testEntities() {
$this->drupalGet('news');
$this->assertText('Using Twig Render This to render entities');
$this->assertText('Start Trek TNG');
$this->assertText('Star Trek: The Next Generation (TNG) is an American science fiction television series created by Gene Roddenberry.');
$this->assertText('Start Trek DS9');
$this->assertNoText('Star Trek: Deep Space Nine (DS9) is an American science fiction television series created by Rick Berman and Michael Piller.');
$this->assertText('Start Trek Voyager');
$this->assertNoText('Star Trek: Voyager is an American science fiction television series created by Rick Berman, Michael Piller, and Jeri Taylor.');
$this->assertSession()->pageTextContains('Using Twig Render This to render entities');
$this->assertSession()->pageTextContains('Start Trek TNG');
$this->assertSession()->pageTextContains('Star Trek: The Next Generation (TNG) is an American science fiction television series created by Gene Roddenberry.');
$this->assertSession()->pageTextContains('Start Trek DS9');
$this->assertSession()->pageTextNotContains('Star Trek: Deep Space Nine (DS9) is an American science fiction television series created by Rick Berman and Michael Piller.');
$this->assertSession()->pageTextContains('Start Trek Voyager');
$this->assertSession()->pageTextNotContains('Star Trek: Voyager is an American science fiction television series created by Rick Berman, Michael Piller, and Jeri Taylor.');
}
/**
......@@ -79,8 +79,8 @@ class TwigRenderThisTest extends BrowserTestBase {
*/
public function testFieldWithFilter() {
$this->drupalGet('node/1');
$this->assertText('Hello world!');
$this->assertText('This is Twig Render This');
$this->assertSession()->pageTextContains('Hello world!');
$this->assertSession()->pageTextContains('This is Twig Render This');
}
/**
......@@ -88,7 +88,7 @@ class TwigRenderThisTest extends BrowserTestBase {
*/
public function testFieldWithoutFilter() {
$this->drupalGet('node/2');
$this->assertText('Object of type Drupal\Core\Field\FieldItemList cannot be printed');
$this->assertSession()->pageTextContains('Object of type Drupal\Core\Field\FieldItemList cannot be printed');
}
/**
......@@ -96,7 +96,7 @@ class TwigRenderThisTest extends BrowserTestBase {
*/
public function testUnsupportedContent() {
$this->drupalGet('node/3');
$this->assertText('Twig Render This: Unsupported content.');
$this->assertSession()->pageTextContains('Twig Render This: Unsupported content.');
}
}
......@@ -2,8 +2,6 @@ name: Twig Render This Test
type: module
description: 'Support module for Twig Render This testing.'
package: Testing
core: 8.x
core_version_requirement: ^8 || ^9
dependencies:
- drupal:node
- twig_render_this:twig_render_this
name: Twig Render This
description: 'This module allows you to render fields and entities in your Twig templates.'
type: module
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9 || ^10
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment