. * */ use Behat\Behat\Hook\Scope\BeforeScenarioScope; /** * Helper trait to set the ancestor of the file list. * * The FileListContext provides steps to interact with and check the behaviour * of a file list. However, the FileListContext does not know the right file * list ancestor that has to be used by the file list steps; this has to be set * from other contexts, for example, when the Files app or the public page for a * shared folder is opened. * * Contexts that "know" that certain file list ancestor has to be used by the * FileListContext steps should use this trait and call * "setFileListAncestorForActor" when needed. */ trait FileListAncestorSetter { /** * @var FileListContext */ private $fileListContext; /** * @BeforeScenario */ public function getSiblingFileListContext(BeforeScenarioScope $scope) { $environment = $scope->getEnvironment(); $this->fileListContext = $environment->getContext("FileListContext"); } /** * Sets the file list ancestor to be used in the file list steps performed * by the given actor. * * @param null|Locator $fileListAncestor the file list ancestor * @param Actor $actor the actor */ private function setFileListAncestorForActor($fileListAncestor, Actor $actor) { $this->fileListContext->setFileListAncestorForActor($fileListAncestor, $actor); } }