Browse Source

Fix code style issues

merge-requests/4/head 8.x-2.5
Chi 5 years ago
parent
commit
8748966d52
  1. 32
      composer.json
  2. 2
      src/TwigExtension.php
  3. 8
      tests/src/Functional/TwigTweakTest.php
  4. 7
      tests/src/Kernel/AccessTest.php

32
composer.json

@ -1,18 +1,18 @@
{ {
"name": "drupal/twig_tweak", "name": "drupal/twig_tweak",
"type": "drupal-module", "type": "drupal-module",
"description": "A Twig extension with some useful functions and filters for Drupal development.", "description": "A Twig extension with some useful functions and filters for Drupal development.",
"keywords": ["Drupal", "Twig"], "keywords": ["Drupal", "Twig"],
"license": "GPL-2.0+", "license": "GPL-2.0+",
"homepage": "https://www.drupal.org/project/twig_tweak", "homepage": "https://www.drupal.org/project/twig_tweak",
"support": { "support": {
"issues": "https://www.drupal.org/project/issues/twig_tweak", "issues": "https://www.drupal.org/project/issues/twig_tweak",
"source": "https://git.drupalcode.org/project/twig_tweak" "source": "https://git.drupalcode.org/project/twig_tweak"
}, },
"require": { "require": {
"drupal/core": "^8.7 || ^9.0" "drupal/core": "^8.7 || ^9.0"
}, },
"suggest": { "suggest": {
"symfony/var-dumper": "Better dump() function for debugging Twig variables" "symfony/var-dumper": "Better dump() function for debugging Twig variables"
} }
} }

2
src/TwigExtension.php

@ -283,7 +283,7 @@ class TwigExtension extends \Twig_Extension {
// //
// @code // @code
// {{ 'Привет!'|transliterate }} // {{ 'Привет!'|transliterate }}
// @endcod // @endcode
new \Twig_SimpleFilter('transliterate', [$this, 'transliterate']), new \Twig_SimpleFilter('transliterate', [$this, 'transliterate']),
// - Check Markup - // - Check Markup -

8
tests/src/Functional/TwigTweakTest.php

@ -181,7 +181,9 @@ class TwigTweakTest extends BrowserTestBase {
// Grant require permissions and test the forms again. // Grant require permissions and test the forms again.
$permissions = ['create page content', 'edit any page content']; $permissions = ['create page content', 'edit any page content'];
$this->grantPermissions(Role::load(Role::ANONYMOUS_ID), $permissions); /** @var \Drupal\user\RoleInterface $role */
$role = Role::load(Role::ANONYMOUS_ID);
$this->grantPermissions($role, $permissions);
$this->drupalGet('/node/2'); $this->drupalGet('/node/2');
// -- Test entity add form. // -- Test entity add form.
@ -295,7 +297,9 @@ class TwigTweakTest extends BrowserTestBase {
$xpath = '//div[@class="tt-contextual-links" and not(div[@data-contextual-id])]'; $xpath = '//div[@class="tt-contextual-links" and not(div[@data-contextual-id])]';
$this->assertByXpath($xpath); $this->assertByXpath($xpath);
$this->grantPermissions(Role::load(Role::ANONYMOUS_ID), ['access contextual links']); /** @var \Drupal\user\RoleInterface $role */
$role = Role::load(Role::ANONYMOUS_ID);
$this->grantPermissions($role, ['access contextual links']);
$this->drupalGet($this->getUrl()); $this->drupalGet($this->getUrl());
$xpath = '//div[@class="tt-contextual-links" and div[@data-contextual-id]]'; $xpath = '//div[@class="tt-contextual-links" and div[@data-contextual-id]]';
$this->assertByXpath($xpath); $this->assertByXpath($xpath);

7
tests/src/Kernel/AccessTest.php

@ -478,13 +478,6 @@ class AccessTest extends KernelTestBase {
// -- Private image with access check. // -- Private image with access check.
$build = $this->twigExtension->drupalImage('private://sea.jpg'); $build = $this->twigExtension->drupalImage('private://sea.jpg');
$expected_build = [
'#cache' => [
'contexts' => ['user'],
'tags' => ['tag_for_private://sea.jpg'],
'max-age' => 123,
],
];
self::assertNull($build); self::assertNull($build);
// -- Private image without access check. // -- Private image without access check.

Loading…
Cancel
Save