Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / pathauto / tests / src / Unit / VerboseMessengerTest.php
index 9567dd54bee1069a81867bcb81c2461c7c6f7036..13c5c058e41d4ccf8afd43011bc6e518bb0eba0d 100644 (file)
@@ -1,59 +1,54 @@
 <?php
 
-namespace Drupal\Tests\pathauto\Unit {
+namespace Drupal\Tests\pathauto\Unit;
 
-  use Drupal\pathauto\VerboseMessenger;
-  use Drupal\Tests\UnitTestCase;
+use Drupal\Core\Messenger\MessengerInterface;
+use Drupal\Core\Session\AccountInterface;
+use Drupal\pathauto\VerboseMessenger;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\pathauto\VerboseMessenger
+ * @group pathauto
+ */
+class VerboseMessengerTest extends UnitTestCase {
 
   /**
-   * @coversDefaultClass \Drupal\pathauto\VerboseMessenger
-   * @group pathauto
+   * The messenger under test.
+   *
+   * @var \Drupal\pathauto\VerboseMessenger
    */
-  class VerboseMessengerTest extends UnitTestCase {
-
-    /**
-     * The messenger under test.
-     *
-     * @var \Drupal\pathauto\VerboseMessenger
-     */
-    protected $messenger;
-
-    /**
-     * {@inheritdoc}
-     */
-    protected function setUp() {
-      $config_factory = $this->getConfigFactoryStub(array('pathauto.settings' => array('verbose' => TRUE)));
-      $account = $this->getMock('\Drupal\Core\Session\AccountInterface');
-      $account->expects($this->once())
-        ->method('hasPermission')
-        ->withAnyParameters()
-        ->willReturn(TRUE);
-
-      $this->messenger = new VerboseMessenger($config_factory, $account);
-    }
-
-    /**
-     * Tests add messages.
-     * @covers ::addMessage
-     */
-    public function testAddMessage() {
-      $this->assertTrue($this->messenger->addMessage("Test message"), "The message was added");
-    }
-
-    /**
-     * @covers ::addMessage
-     */
-    public function testDoNotAddMessageWhileBulkupdate() {
-      $this->assertFalse($this->messenger->addMessage("Test message", "bulkupdate"), "The message was NOT added");
-    }
+  protected $messenger;
 
-}
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    $config_factory = $this->getConfigFactoryStub(['pathauto.settings' => ['verbose' => TRUE]]);
+    $account = $this->createMock(AccountInterface::class);
+    $account->expects($this->once())
+      ->method('hasPermission')
+      ->withAnyParameters()
+      ->willReturn(TRUE);
+    $messenger = $this->createMock(MessengerInterface::class);
+
+    $this->messenger = new VerboseMessenger($config_factory, $account, $messenger);
+  }
 
-}
-namespace {
-  // @todo Delete after https://drupal.org/node/1858196 is in.
-  if (!function_exists('drupal_set_message')) {
-    function drupal_set_message() {
-    }
+  /**
+   * Tests add messages.
+   *
+   * @covers ::addMessage
+   */
+  public function testAddMessage() {
+    $this->assertTrue($this->messenger->addMessage("Test message"), "The message was added");
+  }
+
+  /**
+   * @covers ::addMessage
+   */
+  public function testDoNotAddMessageWhileBulkupdate() {
+    $this->assertFalse($this->messenger->addMessage("Test message", "bulkupdate"), "The message was NOT added");
   }
+
 }