X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fpathauto%2Ftests%2Fsrc%2FUnit%2FVerboseMessengerTest.php;fp=web%2Fmodules%2Fcontrib%2Fpathauto%2Ftests%2Fsrc%2FUnit%2FVerboseMessengerTest.php;h=9567dd54bee1069a81867bcb81c2461c7c6f7036;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/modules/contrib/pathauto/tests/src/Unit/VerboseMessengerTest.php b/web/modules/contrib/pathauto/tests/src/Unit/VerboseMessengerTest.php new file mode 100644 index 000000000..9567dd54b --- /dev/null +++ b/web/modules/contrib/pathauto/tests/src/Unit/VerboseMessengerTest.php @@ -0,0 +1,59 @@ +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"); + } + +} + +} +namespace { + // @todo Delete after https://drupal.org/node/1858196 is in. + if (!function_exists('drupal_set_message')) { + function drupal_set_message() { + } + } +}