Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertUserFailedLoginByPermissionMessage.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertUserFailedLoginByPermissionMessage extends AbstractConstraint
17 {
18  const FAILED_LOGIN_MESSAGE = 'More permissions are needed to access this.';
19 
27  public function processAssert(AdminAuthLogin $adminAuth, User $customAdmin)
28  {
29  $adminAuth->open();
30  $adminAuth->getLoginBlock()->fill($customAdmin);
31  $adminAuth->getLoginBlock()->submit();
32 
33  \PHPUnit\Framework\Assert::assertEquals(
34  self::FAILED_LOGIN_MESSAGE,
35  $adminAuth->getMessagesBlock()->getErrorMessage(),
36  'Message "' . self::FAILED_LOGIN_MESSAGE . '" is not visible.'
37  );
38  }
39 
45  public function toString()
46  {
47  return 'Invalid credentials message was displayed.';
48  }
49 }