Commit c3aadd5f authored by Ken Mortimer's avatar Ken Mortimer Committed by Damien McKenna
Browse files

Issue #3186770 by mortim07: System status report page indicates Metatag's...

Issue #3186770 by mortim07: System status report page indicates Metatag's token types do not have any tokens defined.
parent 55736558
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ Metatag 8.x-1.x-dev, xxxx-xx-xx
#3182548 by DamienMcKenna: Fix tests on 8.x-1.x branch for D9.1.
#3158186 by siddhant.bhosale, rahulrasgon, rokzabukovec, sabina.h,
  DamienMcKenna: Replace usages of assertions that are deprecated.
#3186770 by mortim07: System status report page indicates Metatag's token types
  do not have any tokens defined.


Metatag 8.x-1.15, 2020-12-05
+6 −0
Original line number Diff line number Diff line
@@ -54,6 +54,12 @@ function metatag_token_info() {
      'nested' => TRUE,
    ];

    $info['tokens'][$metatag_token_name]['value'] = [
      'name' => Html::escape($label),
      'module' => 'metatag',
      'description' => $description,
    ];

    // Tag list token type.
    if ($multiple) {
      $info['types']["list<$metatag_token_name>"] = [
+52 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\metatag\Functional;

use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;

/**
 * Test the token status for metatag.
 *
 * @group metatag
 */
class MetatagTokenStatus extends BrowserTestBase
{

  /**
   * {@inheritdoc}
   */
  public static $modules = ['metatag'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Test the status report does not contain warnings about types.
   *
   * @see token_get_token_problems
   */
  function testStatusReportTypesWarning()
  {
    $this->drupalLogin($this->rootUser);
    $this->drupalGet(Url::fromRoute('system.status'));

    $this->assertSession()->pageTextNotContains('$info[\'types\'][\'metatag');
  }

  /**
   * Test the status report does not contain warnings about tokens.
   *
   * @see token_get_token_problems
   */
  function testStatusReportTokensWarning()
  {
    $this->drupalLogin($this->rootUser);
    $this->drupalGet(Url::fromRoute('system.status'));

    $this->assertSession()->pageTextNotContains('$info[\'tokens\'][\'metatag');
  }

}