Skip to content

Commit

Permalink
Merge branch '4.3-dev' into feature/workflow-emails
Browse files Browse the repository at this point in the history
  • Loading branch information
roland-d committed Jul 3, 2022
2 parents ab57b56 + 967d655 commit 78d52a4
Show file tree
Hide file tree
Showing 112 changed files with 18,114 additions and 17,772 deletions.
153 changes: 153 additions & 0 deletions build/github_rebase.php
@@ -0,0 +1,153 @@
<?php

/**
* This script rebases Joomla Github Pull Requests to the target branch
*
* @package Joomla.Build
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// Set defaults
$scriptRoot = __DIR__;
$prNumber = false;
$php = 'php';
$git = 'git';
$gh = 'gh';
$checkPath = false;
$ghRepo = 'joomla/joomla-cms';
$baseBranches = '4.1-dev';
$targetBranch = '4.2-dev';

$script = array_shift($argv);

if (empty($argv)) {
echo <<<TEXT
Joomla! Github Rebase script
============================
Usage:
php {$script} --base=4.1-dev[,...] --target=4.2-dev [--pr=<number>]
Description:
Rebase all open pull requests on github to the target branch.
--base:
The base branch of the pull request. Multiple branches can be seperated by comma.
--target:
The target branch the pull request gets rebased to.
--pr:
Rebase only the given PR.
TEXT;
die(1);
}

foreach ($argv as $arg) {
if (substr($arg, 0, 2) === '--') {
$argi = explode('=', $arg, 2);
switch ($argi[0]) {
case '--base':
$baseBranches = $argi[1];
break;
case '--target':
$targetBranch = $argi[1];
break;
case '--pr':
$prNumber = $argi[1];
break;
}
} else {
$checkPath = $arg;
break;
}
}

$cmd = $git . ' -C "' . $scriptRoot . '" rev-parse --show-toplevel';
$output = [];
$repoScript = '';
exec($cmd, $output, $result);
if ($result !== 0) {
$repoScript = $output[0];
die($script . ' must be located inside of the git repository');
}

echo "Validate gh client...\n";
$cmd = $gh;
$output = [];
exec($cmd, $output, $result);
if ($result !== 0) {
die('Github cli client not found. Please install the client first (https://cli.github.com)');
}

echo "Validate gh authentication...\n";
$cmd = $gh . ' auth status';
passthru($cmd, $result);
if ($result !== 0) {
die('Please login with the github cli client first. (gh auth login)');
}

$fieldList = [
"number",
"author",
"baseRefName",
"headRefName",
"headRepository",
"headRepositoryOwner",
"isCrossRepository",
"maintainerCanModify",
"mergeStateStatus",
"mergeable",
"state",
"title",
"url",
"labels",
];

$branches = 'base:' . implode(' base:', explode(',', $baseBranches));

if (!empty($prNumber)) {
echo "Retrieving Pull Request " . $prNumber . "...\n";
$cmd = $gh . ' pr view ' . $prNumber . ' --json ' . implode(',', $fieldList);
} else {
echo "Retrieving Pull Request list...\n";
$cmd = $gh . ' pr list --limit 1000 --json ' . implode(',', $fieldList) . ' --search "is:pr is:open ' . $branches . '"';
}

$output = [];
exec($cmd, $output, $result);
if ($result !== 0) {
var_dump([$cmd, $output, $result]);
die('Unable to retrieve PR list.');
}

$json = $output[0];

if (!empty($prNumber)) {
$json = '[' . $json . ']';
}

$list = json_decode($json, true);

echo "\nFound " . count($list) . " pull request(s).\n";

foreach ($list as $pr) {
echo "Rebase #" . $pr['number'] . "\n";

$cmd = $gh . ' pr edit ' . $pr['url'] . ' --base ' . $targetBranch;
$output = [];
exec($cmd, $output, $result);
if ($result !== 0) {
var_dump([$cmd, $output, $result]);
die('Unable to set target branch for pr #' . $pr['number']);
}

$cmd = $gh . ' pr comment ' . $pr['url'] . ' --body "This pull request has been automatically rebased to ' . $targetBranch . '."';
$output = [];
exec($cmd, $output, $result);
if ($result !== 0) {
var_dump([$cmd, $output, $result]);
die('Unable to create a comment for pr #' . $pr['number']);
}
}
Expand Up @@ -6,6 +6,10 @@
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @copyright (C) 2014-2019 Spomky-Labs
* @license This software may be modified and distributed under the terms
* of the MIT license.
* See libraries/vendor/web-auth/webauthn-lib/LICENSE
*/

namespace Joomla\Plugin\Multifactorauth\Webauthn\Hotfix;
Expand Down
Expand Up @@ -6,6 +6,10 @@
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @copyright (C) 2014-2019 Spomky-Labs
* @license This software may be modified and distributed under the terms
* of the MIT license.
* See libraries/vendor/web-auth/webauthn-lib/LICENSE
*/

namespace Joomla\Plugin\Multifactorauth\Webauthn\Hotfix;
Expand Down
4 changes: 4 additions & 0 deletions plugins/multifactorauth/webauthn/src/Hotfix/Server.php
Expand Up @@ -6,6 +6,10 @@
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @copyright (C) 2014-2019 Spomky-Labs
* @license This software may be modified and distributed under the terms
* of the MIT license.
* See libraries/vendor/web-auth/webauthn-lib/LICENSE
*/

namespace Joomla\Plugin\Multifactorauth\Webauthn\Hotfix;
Expand Down
41 changes: 20 additions & 21 deletions plugins/system/webauthn/src/Extension/Webauthn.php
Expand Up @@ -45,8 +45,28 @@
*/
final class Webauthn extends CMSPlugin implements SubscriberInterface
{
// Add WebAuthn buttons
use AdditionalLoginButtons;

// AJAX request handlers
use AjaxHandler;
use AjaxHandlerInitCreate;
use AjaxHandlerCreate;
use AjaxHandlerSaveLabel;
use AjaxHandlerDelete;
use AjaxHandlerChallenge;
use AjaxHandlerLogin;

// Utility methods for setting the events' return values
use EventReturnAware;
use CoreEventAware;

// Custom user profile fields
use UserProfileFields;

// Handle user profile deletion
use UserDeletion;

/**
* Autoload the language files
*
Expand All @@ -73,27 +93,6 @@ final class Webauthn extends CMSPlugin implements SubscriberInterface
*/
protected $authenticationHelper;

// AJAX request handlers
use AjaxHandler;
use AjaxHandlerInitCreate;
use AjaxHandlerCreate;
use AjaxHandlerSaveLabel;
use AjaxHandlerDelete;
use AjaxHandlerChallenge;
use AjaxHandlerLogin;

// Custom user profile fields
use UserProfileFields;

// Handle user profile deletion
use UserDeletion;

// Add WebAuthn buttons
use AdditionalLoginButtons;

// Utility methods for setting the events' return values
use EventReturnAware;

/**
* Constructor. Loads the language files as well.
*
Expand Down
2 changes: 1 addition & 1 deletion ruleset.xml
Expand Up @@ -10,7 +10,6 @@
<exclude-pattern type="relative">media/*</exclude-pattern>
<exclude-pattern type="relative">node_modules/*</exclude-pattern>
<exclude-pattern type="relative">tmp/*</exclude-pattern>
<exclude-pattern type="relative">tests/*</exclude-pattern>

<!-- Exclude 3rd party libraries and Framework code. -->
<exclude-pattern type="relative">libraries/php-encryption/*</exclude-pattern>
Expand Down Expand Up @@ -245,6 +244,7 @@
<exclude-pattern type="relative">plugins/content/pagebreak/pagebreak\.php</exclude-pattern>
<exclude-pattern type="relative">plugins/editors/none/none\.php</exclude-pattern>
<exclude-pattern type="relative">plugins/user/joomla/joomla\.php</exclude-pattern>
<exclude-pattern type="relative">tests/</exclude-pattern>
</rule>

<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
Expand Down
87 changes: 44 additions & 43 deletions tests/Codeception/_support/AcceptanceTester.php
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Tests
* @subpackage AcceptanceTester
Expand All @@ -7,6 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// phpcs:ignoreFile
use Codeception\Actor;
use Codeception\Lib\Friend;

Expand All @@ -33,53 +35,52 @@
*/
class AcceptanceTester extends Actor
{
use _generated\AcceptanceTesterActions;
use _generated\AcceptanceTesterActions;

/**
* Function to check for PHP Notices or Warnings.
*
* @param string $page Optional, if not given checks will be done in the current page
*
* @note doAdminLogin() before
*
* @since 3.7.3
*
* @return void
*/
public function checkForPhpNoticesOrWarnings($page = null)
{
$I = $this;
/**
* Function to check for PHP Notices or Warnings.
*
* @param string $page Optional, if not given checks will be done in the current page
*
* @note doAdminLogin() before
*
* @since 3.7.3
*
* @return void
*/
public function checkForPhpNoticesOrWarnings($page = null)
{
$I = $this;

if ($page)
{
$I->amOnPage($page);
}
if ($page) {
$I->amOnPage($page);
}

$I->dontSeeInPageSource('Notice:');
$I->dontSeeInPageSource('<b>Notice</b>:');
$I->dontSeeInPageSource('Warning:');
$I->dontSeeInPageSource('<b>Warning</b>:');
$I->dontSeeInPageSource('Strict standards:');
$I->dontSeeInPageSource('<b>Strict standards</b>:');
$I->dontSeeInPageSource('The requested page can\'t be found');
}
$I->dontSeeInPageSource('Notice:');
$I->dontSeeInPageSource('<b>Notice</b>:');
$I->dontSeeInPageSource('Warning:');
$I->dontSeeInPageSource('<b>Warning</b>:');
$I->dontSeeInPageSource('Strict standards:');
$I->dontSeeInPageSource('<b>Strict standards</b>:');
$I->dontSeeInPageSource('The requested page can\'t be found');
}

/**
* Function to wait for JS to be properly loaded on page change.
*
* @param integer|float $timeout Time to wait for JS to be ready
*
* @since 4.0.0
*
* @return void
*/
public function waitForJsOnPageLoad($timeout = 1)
{
$I = $this;
/**
* Function to wait for JS to be properly loaded on page change.
*
* @param integer|float $timeout Time to wait for JS to be ready
*
* @since 4.0.0
*
* @return void
*/
public function waitForJsOnPageLoad($timeout = 1)
{
$I = $this;

$I->waitForJS('return document.readyState == "complete"', $timeout);
$I->waitForJS('return document.readyState == "complete"', $timeout);

// Wait an additional 500ms to make sure that really all JS is loaded
$I->wait(0.5);
}
// Wait an additional 500ms to make sure that really all JS is loaded
$I->wait(0.5);
}
}
10 changes: 6 additions & 4 deletions tests/Codeception/_support/ApiTester.php
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Tests
* @subpackage AcceptanceTester
Expand All @@ -7,6 +8,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// phpcs:ignoreFile
use Codeception\Actor;
use Codeception\Lib\Friend;

Expand All @@ -30,9 +32,9 @@
*/
class ApiTester extends Actor
{
use _generated\ApiTesterActions;
use _generated\ApiTesterActions;

/**
* Define custom actions here
*/
/**
* Define custom actions here
*/
}

0 comments on commit 78d52a4

Please sign in to comment.