From 8ad48683d521494e22ea240b6fbdacd88329638e Mon Sep 17 00:00:00 2001
From: Brian Canini <canini.16@osu.edu>
Date: Thu, 1 Apr 2021 12:01:22 -0400
Subject: [PATCH] Updating drupal/mathjax (2.7.0 => 3.0.0-beta1)

---
 composer.json                                 |  2 +-
 composer.lock                                 | 31 +++----
 vendor/composer/installed.json                | 31 +++----
 web/modules/mathjax/README.txt                |  0
 .../config/install/mathjax.settings.yml       |  1 +
 .../mathjax/config/schema/mathjax.schema.yml  |  5 +-
 web/modules/mathjax/mathjax.info.yml          |  9 +-
 web/modules/mathjax/mathjax.install           | 34 ++++---
 web/modules/mathjax/mathjax.module            |  6 ++
 .../mathjax/src/Form/MathjaxSettingsForm.php  | 89 ++++++++++---------
 .../src/Plugin/Filter/MathjaxFilter.php       |  7 +-
 .../src/Functional}/MathjaxWebTest.php        | 50 ++++++-----
 12 files changed, 152 insertions(+), 113 deletions(-)
 mode change 100644 => 100755 web/modules/mathjax/README.txt
 rename web/modules/mathjax/{src/Tests => tests/src/Functional}/MathjaxWebTest.php (77%)

diff --git a/composer.json b/composer.json
index 6cbab83069..b178dbf476 100644
--- a/composer.json
+++ b/composer.json
@@ -136,7 +136,7 @@
         "drupal/link_attributes": "1.11",
         "drupal/linkit": "5.0-beta12",
         "drupal/magnific_popup": "1.3",
-        "drupal/mathjax": "2.7",
+        "drupal/mathjax": "3.0.0-beta1",
         "drupal/media_entity_browser": "2.0-alpha3",
         "drupal/media_entity_twitter": "2.7",
         "drupal/menu_block": "1.6",
diff --git a/composer.lock b/composer.lock
index dbbccb9f01..71cf1f9345 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "3e92f2c0ff2c82016b011d0962b739ff",
+    "content-hash": "9d9ec39f107ba6da397020c95d9edd52",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -5715,32 +5715,29 @@
         },
         {
             "name": "drupal/mathjax",
-            "version": "2.7.0",
+            "version": "3.0.0-beta1",
             "source": {
                 "type": "git",
                 "url": "https://git.drupalcode.org/project/mathjax.git",
-                "reference": "8.x-2.7"
+                "reference": "3.0.0-beta1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://ftp.drupal.org/files/projects/mathjax-8.x-2.7.zip",
-                "reference": "8.x-2.7",
-                "shasum": "87f3772aab6a21d79168d00d48c4e41010522fec"
+                "url": "https://ftp.drupal.org/files/projects/mathjax-3.0.0-beta1.zip",
+                "reference": "3.0.0-beta1",
+                "shasum": "c81c33e19170f81a84c99d499e8ebadb7dacd6b9"
             },
             "require": {
-                "drupal/core": "~8.0"
+                "drupal/core": "^8 || ^9"
             },
             "type": "drupal-module",
             "extra": {
-                "branch-alias": {
-                    "dev-2.x": "2.x-dev"
-                },
                 "drupal": {
-                    "version": "8.x-2.7",
-                    "datestamp": "1492196642",
+                    "version": "3.0.0-beta1",
+                    "datestamp": "1606331550",
                     "security-coverage": {
-                        "status": "covered",
-                        "message": "Covered by Drupal's security advisory policy"
+                        "status": "not-covered",
+                        "message": "Beta releases are not covered by Drupal security advisories."
                     }
                 }
             },
@@ -5753,6 +5750,10 @@
                     "name": "cilefen",
                     "homepage": "https://www.drupal.org/user/1850070"
                 },
+                {
+                    "name": "joelpittet",
+                    "homepage": "https://www.drupal.org/user/160302"
+                },
                 {
                     "name": "julou",
                     "homepage": "https://www.drupal.org/user/273952"
@@ -5761,7 +5762,7 @@
             "description": "Javascript-based LaTeX rendering solution for your Drupal website.",
             "homepage": "https://www.drupal.org/project/mathjax",
             "support": {
-                "source": "http://cgit.drupalcode.org/mathjax"
+                "source": "https://git.drupalcode.org/project/mathjax"
             }
         },
         {
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index ebcc3b32e9..6e5f987538 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -5887,33 +5887,30 @@
     },
     {
         "name": "drupal/mathjax",
-        "version": "2.7.0",
-        "version_normalized": "2.7.0.0",
+        "version": "3.0.0-beta1",
+        "version_normalized": "3.0.0.0-beta1",
         "source": {
             "type": "git",
             "url": "https://git.drupalcode.org/project/mathjax.git",
-            "reference": "8.x-2.7"
+            "reference": "3.0.0-beta1"
         },
         "dist": {
             "type": "zip",
-            "url": "https://ftp.drupal.org/files/projects/mathjax-8.x-2.7.zip",
-            "reference": "8.x-2.7",
-            "shasum": "87f3772aab6a21d79168d00d48c4e41010522fec"
+            "url": "https://ftp.drupal.org/files/projects/mathjax-3.0.0-beta1.zip",
+            "reference": "3.0.0-beta1",
+            "shasum": "c81c33e19170f81a84c99d499e8ebadb7dacd6b9"
         },
         "require": {
-            "drupal/core": "~8.0"
+            "drupal/core": "^8 || ^9"
         },
         "type": "drupal-module",
         "extra": {
-            "branch-alias": {
-                "dev-2.x": "2.x-dev"
-            },
             "drupal": {
-                "version": "8.x-2.7",
-                "datestamp": "1492196642",
+                "version": "3.0.0-beta1",
+                "datestamp": "1606331550",
                 "security-coverage": {
-                    "status": "covered",
-                    "message": "Covered by Drupal's security advisory policy"
+                    "status": "not-covered",
+                    "message": "Beta releases are not covered by Drupal security advisories."
                 }
             }
         },
@@ -5927,6 +5924,10 @@
                 "name": "cilefen",
                 "homepage": "https://www.drupal.org/user/1850070"
             },
+            {
+                "name": "joelpittet",
+                "homepage": "https://www.drupal.org/user/160302"
+            },
             {
                 "name": "julou",
                 "homepage": "https://www.drupal.org/user/273952"
@@ -5935,7 +5936,7 @@
         "description": "Javascript-based LaTeX rendering solution for your Drupal website.",
         "homepage": "https://www.drupal.org/project/mathjax",
         "support": {
-            "source": "http://cgit.drupalcode.org/mathjax"
+            "source": "https://git.drupalcode.org/project/mathjax"
         }
     },
     {
diff --git a/web/modules/mathjax/README.txt b/web/modules/mathjax/README.txt
old mode 100644
new mode 100755
diff --git a/web/modules/mathjax/config/install/mathjax.settings.yml b/web/modules/mathjax/config/install/mathjax.settings.yml
index c2b8b0c14b..4a90dc75ea 100644
--- a/web/modules/mathjax/config/install/mathjax.settings.yml
+++ b/web/modules/mathjax/config/install/mathjax.settings.yml
@@ -2,3 +2,4 @@ use_cdn: 1
 cdn_url: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
 config_type: 0
 default_config_string: '{"tex2jax":{"inlineMath":[["$","$"],["\\(","\\)"]],"processEscapes":"true"},"showProcessingMessages":"false","messageStyle":"none"}'
+enable_for_admin: 0
diff --git a/web/modules/mathjax/config/schema/mathjax.schema.yml b/web/modules/mathjax/config/schema/mathjax.schema.yml
index 64633b616d..1ead8c73a7 100644
--- a/web/modules/mathjax/config/schema/mathjax.schema.yml
+++ b/web/modules/mathjax/config/schema/mathjax.schema.yml
@@ -1,5 +1,5 @@
 mathjax.settings:
-  label: 'Mathjax settings'
+  label: 'MathJax settings'
   type: config_object
   mapping:
     use_cdn:
@@ -17,3 +17,6 @@ mathjax.settings:
     config_string:
       type: string
       label: 'Current configuration'
+    enable_for_admin:
+      type: integer
+      label: 'Enable on admin pages'
diff --git a/web/modules/mathjax/mathjax.info.yml b/web/modules/mathjax/mathjax.info.yml
index 6cc2be7adb..7ba3048aea 100644
--- a/web/modules/mathjax/mathjax.info.yml
+++ b/web/modules/mathjax/mathjax.info.yml
@@ -1,15 +1,14 @@
 name: MathJax
 type: module
 description: Javascript-based LaTeX rendering solution for your Drupal website.
-# core: 8.x
+core_version_requirement: ^8 || ^9
 configure: mathjax.settings
 libraries:
   - mathjax/setup
   - mathjax/source
   - mathjax/config
 
-# Information added by Drupal.org packaging script on 2017-04-14
-version: '8.x-2.7'
-core: '8.x'
+# Information added by Drupal.org packaging script on 2020-11-25
+version: '3.0.0-beta1'
 project: 'mathjax'
-datestamp: 1492196649
+datestamp: 1606331552
diff --git a/web/modules/mathjax/mathjax.install b/web/modules/mathjax/mathjax.install
index 3aff70a3f3..a80e88a72c 100644
--- a/web/modules/mathjax/mathjax.install
+++ b/web/modules/mathjax/mathjax.install
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * MathJax module install.
@@ -8,18 +9,18 @@
  * Implements hook_requirements().
  */
 function mathjax_requirements($phase) {
-  $requirements = array();
+  $requirements = [];
 
   if ($phase == 'runtime') {
     $config = Drupal::config('mathjax.settings');
     if (!$config->get('use_cdn')) {
       if (!_mathjax_library_present()) {
-        $requirements['mathjax_local_libraries'] = array(
+        $requirements['mathjax_local_libraries'] = [
           'title' => t('MathJax'),
           'value' => t('Missing JavaScript libraries'),
           'description' => t("MathJax is configured to use local library files but they could not be found. See the README."),
           'severity' => REQUIREMENT_ERROR,
-        );
+        ];
       }
     }
   }
@@ -42,13 +43,22 @@ function _mathjax_library_present() {
  * Update the CDN URL.
  */
 function mathjax_update_8201() {
-    $config_factory = \Drupal::configFactory();
-    $config = $config_factory->getEditable('mathjax.settings');
-    $url = $config->get('cdn_url');
-    $new = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
-    $old = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js';
-    if (strpos($url, $old) !== FALSE) {
-        $url = str_replace($old, $new, $url);
-        $config->set('cdn_url', $url)->save(TRUE);
-    }
+  $config_factory = \Drupal::configFactory();
+  $config = $config_factory->getEditable('mathjax.settings');
+  $url = $config->get('cdn_url');
+  $new = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
+  $old = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js';
+  if (strpos($url, $old) !== FALSE) {
+    $url = str_replace($old, $new, $url);
+    $config->set('cdn_url', $url)->save(TRUE);
+  }
+}
+
+/**
+ * Enable on admin to preserve backwards compatibility.
+ */
+function mathjax_update_8202() {
+  $config_factory = \Drupal::configFactory();
+  $config = $config_factory->getEditable('mathjax.settings');
+  $config->set('enable_for_admin', 1)->save(TRUE);
 }
diff --git a/web/modules/mathjax/mathjax.module b/web/modules/mathjax/mathjax.module
index 1f3f320c58..0d92254302 100644
--- a/web/modules/mathjax/mathjax.module
+++ b/web/modules/mathjax/mathjax.module
@@ -25,6 +25,12 @@ function mathjax_help($route_name, RouteMatchInterface $route_match) {
  */
 function mathjax_page_attachments(&$page) {
   $config = Drupal::config('mathjax.settings');
+
+  // Exit if MathJax is not allowed on admin pages and we are on an admin page.
+  if (!$config->get('enable_for_admin') && \Drupal::service('router.admin_context')->isAdminRoute()) {
+    return;
+  }
+
   $config_type = $config->get('config_type');
   if ($config_type == 1) {
     $page['#attached']['drupalSettings']['mathjax'] = [
diff --git a/web/modules/mathjax/src/Form/MathjaxSettingsForm.php b/web/modules/mathjax/src/Form/MathjaxSettingsForm.php
index 544cf14ad6..51f6c9adee 100644
--- a/web/modules/mathjax/src/Form/MathjaxSettingsForm.php
+++ b/web/modules/mathjax/src/Form/MathjaxSettingsForm.php
@@ -31,42 +31,42 @@ protected function getEditableConfigNames() {
   public function buildForm(array $form, FormStateInterface $form_state) {
     $config = $this->config('mathjax.settings');
 
-    $form['test'] = array(
+    $form['test'] = [
       '#type' => 'fieldset',
       '#title' => 'MathJax Test',
-    );
-    $form['test']['library'] = array(
+    ];
+    $form['test']['library'] = [
       '#type' => 'item',
       '#markup' => '<div class="tex2jax_process"><p>If the MathJax library is installed properly, you should see the square root of x here: $ \sqrt{x} $ and the square root of y here: \(\sqrt{y}\)</p><p>$$\text{The quadratic formula should appear here: } x = \frac {-b \pm \sqrt {b^2 - 4ac}}{2a}$$</p><p>\[\text{The cubic equation should appear here: } a x^3\; +\; b x^2\; +\; c x\; +\; d\; =\; 0\]</p></div>',
-    );
+    ];
 
-    $form['use_cdn'] = array(
+    $form['use_cdn'] = [
       '#type' => 'checkbox',
       '#title' => $this->t('Use MathJax Content Delivery Network (CDN)'),
       '#default_value' => $config->get('use_cdn'),
       '#description' => t('Check this box to load MathJax source from MathJax servers (recommended) or from the link you can provide below. If you do not check this box, see the README about configuring a local MathJax source. <em>MathJax CDN services are provided subject to its <a href=":url">Terms of Service</a> (TOS). By accessing and using the MathJax CDN, you accept and agree to be bound by the terms and provisions of the TOS</em>.', [':url' => 'https://www.mathjax.org/mathjax-cdn-terms-of-service/']),
-    );
-    $form['cdn_url'] = array(
+    ];
+    $form['cdn_url'] = [
       '#type' => 'textfield',
       '#title' => $this->t('MathJax CDN URL'),
       '#default_value' => $config->get('cdn_url'),
-      '#description' => $this->t("Enter the Mathjax CDN url here or leave it unchanged to use the one provided by <a target='_blank' href=':url'>www.mathjax.org</a>.", array(':url' => 'http://www.mathjax.org')),
-      '#states' => array(
-        'invisible' => array(
-          ':input[name="use_cdn"]' => array('checked' => FALSE),
-        ),
-      ),
-    );
-    $form['config_type'] = array(
+      '#description' => $this->t("Enter the MathJax CDN url here or leave it unchanged to use the one provided by <a target='_blank' href=':url'>www.mathjax.org</a>.", [':url' => 'http://www.mathjax.org']),
+      '#states' => [
+        'invisible' => [
+          ':input[name="use_cdn"]' => ['checked' => FALSE],
+        ],
+      ],
+    ];
+    $form['config_type'] = [
       '#type' => 'radios',
       '#title' => $this->t('Configuration Type'),
-      '#options' => array(
-        0 => $this->t('Text Format (Recommended&mdash;Add the MathJax filter to a <a href=":textformats">text format</a>.)', array(':textformats' => Url::fromRoute('filter.admin_overview')->toString())),
+      '#options' => [
+        0 => $this->t('Text Format (Recommended&mdash;Add the MathJax filter to a <a href=":textformats">text format</a>.)', [':textformats' => Url::fromRoute('filter.admin_overview')->toString()]),
         1 => $this->t('Custom'),
-      ),
+      ],
       '#default_value' => $config->get('config_type'),
-    );
-    $form['mathjax_note_default'] = array(
+    ];
+    $form['mathjax_note_default'] = [
       '#type' => 'item',
       '#prefix' => '<span class="tex2jax_ignore">',
       '#markup' => $this->t('MathJax
@@ -75,25 +75,25 @@ public function buildForm(array $form, FormStateInterface $form_state) {
       default math delimiters are $$...$$ and \[...\] for displayed mathematics,
       and $...$ and \(...\) for in-line mathematics. <strong>You must add
       the MathJax filter to a <a href=":textformats">text format</a> and put
-      MathJax at the bottom of the filter processing order.</strong>', array(':textformats' => Url::fromRoute('filter.admin_overview')->toString())),
+      MathJax at the bottom of the filter processing order.</strong>', [':textformats' => Url::fromRoute('filter.admin_overview')->toString()]),
       '#suffix' => '</span>',
-      '#states' => array(
-        'invisible' => array(
-          ':input[name="config_type"]' => array('value' => 1),
-        ),
-      ),
-    );
-    $form['config_string'] = array(
+      '#states' => [
+        'invisible' => [
+          ':input[name="config_type"]' => ['value' => 1],
+        ],
+      ],
+    ];
+    $form['config_string'] = [
       '#type' => 'textarea',
       '#title' => $this->t('Custom configuration'),
       '#default_value' => ($config->get('config_string')) ? $config->get('config_string') : $config->get('default_config_string'),
-      '#description' => $this->t("Enter a JSON configuration string as documented on  <a target='_blank' href=':mathjax-help'>MathJax help</a>. Use with caution as you may introduce JavaScript errors.", array(':mathjax-help' => 'http://docs.mathjax.org/en/latest/')),
-      '#states' => array(
-        'invisible' => array(
-          ':input[name="config_type"]' => array('value' => 0),
-        ),
-      ),
-    );
+      '#description' => $this->t("Enter a JSON configuration string as documented on  <a target='_blank' href=':mathjax-help'>MathJax help</a>. Use with caution as you may introduce JavaScript errors.", [':mathjax-help' => 'http://docs.mathjax.org/en/latest/']),
+      '#states' => [
+        'invisible' => [
+          ':input[name="config_type"]' => ['value' => 0],
+        ],
+      ],
+    ];
     $config_type = $config->get('config_type');
     if ($config_type == 0) {
       $config_string = $config->get('default_config_string');
@@ -112,6 +112,14 @@ public function buildForm(array $form, FormStateInterface $form_state) {
         ],
       ],
     ];
+
+    $form['enable_for_admin'] = [
+      '#type' => 'checkbox',
+      '#title' => $this->t('Enable on admin pages.'),
+      '#description' => $this->t('Embeds the MathJax code on admin pages.'),
+      '#default_value' => $config->get('enable_for_admin'),
+    ];
+
     return parent::buildForm($form, $form_state);
   }
 
@@ -120,11 +128,12 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
     $this->config('mathjax.settings')
-        ->set('use_cdn', $form_state->getValue('use_cdn'))
-        ->set('cdn_url', $form_state->getValue('cdn_url'))
-        ->set('config_type', $form_state->getValue('config_type'))
-        ->set('config_string', $form_state->getValue('config_string'))
-        ->save();
+      ->set('use_cdn', $form_state->getValue('use_cdn'))
+      ->set('cdn_url', $form_state->getValue('cdn_url'))
+      ->set('config_type', $form_state->getValue('config_type'))
+      ->set('config_string', $form_state->getValue('config_string'))
+        ->set('enable_for_admin', $form_state->getValue('enable_for_admin'))
+      ->save();
     drupal_flush_all_caches();
     parent::submitForm($form, $form_state);
   }
diff --git a/web/modules/mathjax/src/Plugin/Filter/MathjaxFilter.php b/web/modules/mathjax/src/Plugin/Filter/MathjaxFilter.php
index 31b8c28ee8..a123d4bd88 100644
--- a/web/modules/mathjax/src/Plugin/Filter/MathjaxFilter.php
+++ b/web/modules/mathjax/src/Plugin/Filter/MathjaxFilter.php
@@ -7,10 +7,10 @@
 use Drupal\Core\Url;
 
 /**
- * Provides a filter to format text with Mathjax.
+ * Provides a filter to format text with MathJax.
  *
  * Wraps the text in a div with a class name that is looked-for
- * by the Mathjax Javascript library.
+ * by the MathJax Javascript library.
  *
  * @Filter(
  *   id = "filter_mathjax",
@@ -22,6 +22,7 @@
  * )
  */
 class MathjaxFilter extends FilterBase {
+
   /**
    * {@inheritdoc}
    */
@@ -55,7 +56,7 @@ public function tips($long = FALSE) {
     return $this->t('<span class="tex2jax_ignore">Mathematics inside the <a href=":url">configured delimiters</a> is
       rendered by MathJax. The default math delimiters are $$...$$ and \[...\] for
       displayed mathematics, and $...$ and \(...\) for in-line mathematics.</span>',
-        array(':url' => Url::fromRoute('mathjax.settings')->toString())
+        [':url' => Url::fromRoute('mathjax.settings')->toString()]
     );
   }
 
diff --git a/web/modules/mathjax/src/Tests/MathjaxWebTest.php b/web/modules/mathjax/tests/src/Functional/MathjaxWebTest.php
similarity index 77%
rename from web/modules/mathjax/src/Tests/MathjaxWebTest.php
rename to web/modules/mathjax/tests/src/Functional/MathjaxWebTest.php
index c01c98f1df..7035a4821f 100644
--- a/web/modules/mathjax/src/Tests/MathjaxWebTest.php
+++ b/web/modules/mathjax/tests/src/Functional/MathjaxWebTest.php
@@ -1,8 +1,9 @@
 <?php
 
-namespace Drupal\mathjax\Tests;
+namespace Drupal\Tests\mathjax\Functional;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
+use Drupal\Tests\user\Traits\UserCreationTrait;
 use Drupal;
 
 /**
@@ -10,24 +11,31 @@
  *
  * @group MathJax
  */
-class MathjaxWebTest extends WebTestBase {
+class MathjaxWebTest extends BrowserTestBase {
+
+  use UserCreationTrait;
 
   /**
    * An administrator.
    *
-   * @var Drupal\user\UserInterface
+   * @var \Drupal\user\UserInterface
    */
   protected $administrator;
 
+  /**
+   * {@inheritdoc}
+   */
+  protected $defaultTheme = 'stark';
+
   /**
    * Provide info on these tests to the admin interface.
    */
   public static function getInfo() {
-    return array(
+    return [
       'name' => 'MathJax tests',
       'description' => 'Tests the default configuration and admin functions.',
       'group' => 'MathJax',
-    );
+    ];
   }
 
   /**
@@ -35,21 +43,21 @@ public static function getInfo() {
    *
    * @var array
    */
-  public static $modules = array('mathjax', 'filter');
+  public static $modules = ['mathjax', 'filter'];
 
   /**
-   * Set up the test evironment.
+   * Set up the test environment.
    */
-  protected function setUp() {
+  protected function setUp(): void {
     parent::setUp();
 
-    $this->administrator = $this->drupalCreateUser(array(
+    $this->administrator = $this->drupalCreateUser([
       'administer mathjax',
       'administer filters',
       'access site reports',
       'access administration pages',
       'administer site configuration',
-    ));
+    ]);
   }
 
   /**
@@ -63,23 +71,23 @@ public function testAdmin() {
     $this->drupalGet('admin/config/content/formats/add');
     $this->assertText('Mathematics inside the configured delimiters is rendered by MathJax');
     $this->drupalGet('admin/config/content/mathjax');
-    $this->assertTitle('MathJax | Drupal', 'Page title set.');
+    $this->assertTitle('MathJax | Drupal');
     $this->assertText('MathJax CDN URL');
-    $this->assertFieldByName('cdn_url', $config->get('cdn_url'), 'Default CDN config string found.');
-    $this->assertText('Enter the Mathjax CDN url here or leave it unchanged to use the one provided by www.mathjax.org.');
+    $this->assertFieldByName('cdn_url', $config->get('cdn_url'));
+    $this->assertText('Enter the MathJax CDN url here or leave it unchanged to use the one provided by www.mathjax.org.');
     $this->assertText('Configuration Type');
     $this->assertFieldByName('config_type', 0);
 
     $custom = '{"tex2jax":{"inlineMath":[["#","#"],["\\(","\\)"]],"processEscapes":"true"},"showProcessingMessages":"false","messageStyle":"none"}';
     $path = 'admin/config/content/mathjax';
-    $edit = array(
+    $edit = [
       'config_type' => 1,
       'config_string' => $custom,
-    );
+    ];
 
     $this->drupalPostForm($path, $edit, t('Save configuration'));
     $this->assertText('Enter a JSON configuration string as documented');
-    $this->assertRaw(htmlentities($custom), 'Custom configuration string found.');
+    $this->assertRaw(htmlentities($custom));
   }
 
   /**
@@ -90,9 +98,9 @@ public function testLibraryDetection() {
     $this->drupalGet('admin/reports/status');
     $this->assertNoText('MathJax is configured to use local library files but they could not be found. See the README.');
     $this->drupalGet('admin/config/content/mathjax');
-    $edit = array(
+    $edit = [
       'use_cdn' => FALSE,
-    );
+    ];
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
     $this->drupalGet('admin/reports/status');
     $this->assertText('MathJax is configured to use local library files but they could not be found. See the README.');
@@ -105,13 +113,13 @@ public function testFilterOrder() {
     $this->drupalLogin($this->administrator);
     // Activate the MathJax filter on the plain_text format.
     $this->drupalGet('admin/config/content/formats/manage/plain_text');
-    $edit = array('filters[filter_mathjax][status]' => TRUE);
+    $edit = ['filters[filter_mathjax][status]' => TRUE];
     $this->drupalPostForm(NULL, $edit, t('Save configuration'));
     $this->drupalGet('admin/config/content/formats/manage/plain_text');
     // Ensure that MathJax appears at the bottom of the active filter list.
     $count = count($this->xpath("//div[@id='edit-filters-status']/div/input[@class='form-checkbox' and @checked='checked']"));
     $result = $this->xpath("//table[@id='filter-order']/tbody/tr[$count]/td[1]");
-    $this->assertEqual($result[0]->__toString(), 'MathJax');
+    $this->assertEqual($result[0]->getText(), 'MathJax');
   }
 
 }
-- 
GitLab