/** * Asserts that user has only Sales-related permissions * * @param Dashboard $dashboard * @param UserIndex $userIndex * @return void */ public function processAssert(Dashboard $dashboard, UserIndex $userIndex) { $menuItems = $dashboard->getMenuBlock()->getTopMenuItems(); $userIndex->open(); $deniedMessage = $userIndex->getAccessDeniedBlock()->getTextFromAccessDeniedBlock(); $isMenuItemSingle = count($menuItems) == 1; $hasSales = in_array(self::ROLE_RESOURCE, $menuItems); \PHPUnit_Framework_Assert::assertTrue($hasSales && $isMenuItemSingle && self::DENIED_ACCESS == $deniedMessage, 'Sales item is absent in Menu block or possible access to another page, not related to Sales.'); }
/** * Verify whether customer has logged in to the Backend * * @param User $user * @param AdminAuthLogin $adminAuth * @param Dashboard $dashboard * @param User $customAdmin * @internal param null|string $userToLoginInAssert * @return void */ public function processAssert(User $user, AdminAuthLogin $adminAuth, Dashboard $dashboard, User $customAdmin = null) { $adminUser = $customAdmin === null ? $user : $customAdmin; if ($dashboard->getAdminPanelHeader()->isVisible()) { $dashboard->getAdminPanelHeader()->logOut(); } $adminAuth->getLoginBlock()->fill($adminUser); $adminAuth->getLoginBlock()->submit(); \PHPUnit_Framework_Assert::assertTrue($dashboard->getAdminPanelHeader()->isLoggedIn(), 'Admin user was not logged in.'); }
/** * Logout Admin User from account * * return void */ public function tearDown() { $this->dashboard->getAdminPanelHeader()->logOut(); }
/** * Logout Admin User from account * * @return void */ public function tearDown() { if ($this->dashboard->getAdminPanelHeader()->isVisible()) { $this->dashboard->getAdminPanelHeader()->logOut(); } }
/** * Asserts that 'You have logged out.' message is present on page * * @param AdminAuthLogin $adminAuth * @param Dashboard $dashboard * @return void */ public function processAssert(AdminAuthLogin $adminAuth, Dashboard $dashboard) { $dashboard->getAdminPanelHeader()->logOut(); $isLoginBlockVisible = $adminAuth->getLoginBlock()->isVisible(); \PHPUnit_Framework_Assert::assertTrue($isLoginBlockVisible, 'Admin user was not logged out.'); }