Skip to content

Commit 5b0fecd

Browse files
committed
Module operations divided by responsibilities
I have broken in 3 individual functions the Publish module function
1 parent 77fe304 commit 5b0fecd

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

src/JoomlaBrowser.php

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,19 +575,46 @@ private function searchResultLanguageName($languageName)
575575
/**
576576
* Publishes a module on all frontend pages
577577
*
578-
* @param string $module The name of the module
579-
* @param string $position The template position where to publish the module. Right position by default
578+
* @param string $module The full name of the module
579+
* @param string $position The template position of a module. Right position by default
580580
*/
581-
public function publishModuleOnAllPages($module, $position = 'position-7')
581+
public function setModulePosition($module, $position = 'position-7')
582+
{
583+
$I = $this;
584+
$I->amOnPage('administrator/index.php?option=com_modules');
585+
$I->searchForItem($module);
586+
$I->click(['link' => $module]);
587+
$I->selectOptionInChosen('Position', $position);
588+
$I->click(['xpath' => "//div[@id='toolbar-apply']/button"]);
589+
$I->waitForText('Module successfully saved',30,['id' => 'system-message-container']);
590+
}
591+
592+
/**
593+
* Publishes a module on all frontend pages
594+
*
595+
* @param string $module The full name of the module
596+
*/
597+
public function publishModule($module)
582598
{
583599
$I = $this;
584600
$I->amOnPage('administrator/index.php?option=com_modules');
585601
$I->searchForItem($module);
586602
$I->checkAllResults();
587603
$I->click(['xpath' => "//div[@id='toolbar-publish']/button"]);
588604
$I->waitForText('1 module successfully published.',30,['id' => 'system-message-container']);
605+
}
606+
607+
/**
608+
* Changes the module Menu assignment to be shown on all the pages of the website
609+
*
610+
* @param string $module The full name of the module
611+
*/
612+
public function displayModuleOnAllPages($module)
613+
{
614+
$I = $this;
615+
$I->amOnPage('administrator/index.php?option=com_modules');
616+
$I->searchForItem($module);
589617
$I->click(['link' => $module]);
590-
$I->selectOptionInChosen('Position', $position);
591618
$I->click(['link' => 'Menu Assignment']);
592619
$I->waitForElement(['id' => 'jform_menus-lbl'], 30);
593620
$I->click(['id' => 'jform_assignment_chzn']);

0 commit comments

Comments
 (0)