Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/merge-master-to-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Sync develop branch

on:
push:
branches:
# Keep this in sync with SYNC_SOURCE_BRANCH below.
# GitHub Actions does not allow env values in trigger branch filters.
- master

env:
SYNC_SOURCE_BRANCH: master
SYNC_TARGET_BRANCH: dev/4.0

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
sync-dev-branch:
name: Merge master into dev/4.0 branch
# Keep this named after the GitHub repository.
# GitHub Actions does not allow workflow env values in jobs.<job_id>.if.
if: github.repository == 'phpbb/ideas' && github.event.repository.fork == false
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Configure Git author
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Merge source branch into target branch when clean
run: |
if ! git ls-remote --exit-code --heads origin "${SYNC_TARGET_BRANCH}" > /dev/null 2>&1; then
echo "origin/${SYNC_TARGET_BRANCH} does not exist; skipping."
exit 0
fi

git fetch --no-tags --prune origin "${SYNC_TARGET_BRANCH}"
git checkout -B "${SYNC_TARGET_BRANCH}" "origin/${SYNC_TARGET_BRANCH}"

if git merge --no-edit "$GITHUB_SHA"; then
if [ "$(git rev-list --count "origin/${SYNC_TARGET_BRANCH}..HEAD")" -eq 0 ]; then
echo "${SYNC_TARGET_BRANCH} is already up to date."
exit 0
fi

git push origin "HEAD:${SYNC_TARGET_BRANCH}"
else
echo "${SYNC_SOURCE_BRANCH} could not be merged cleanly into ${SYNC_TARGET_BRANCH}; skipping."
if git rev-parse -q --verify MERGE_HEAD > /dev/null; then
git merge --abort
fi
exit 1
fi
27 changes: 10 additions & 17 deletions tests/functional/viewonline_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,24 @@
class viewonline_test extends ideas_functional_base
{
/**
* Visit Ideas as user "admin"
* Test viewonline page for admin
*/
public function test_viewonline_visit_ideas()
public function test_viewonline_check_viewonline()
{
// Visit Ideas as user "admin"
$this->login();
$crawler = self::request('GET', "app.php/ideas?sid=$this->sid");
$this->assertContainsLang('IDEAS_TITLE', $crawler->filter('h2')->text());
}

/**
* Test viewonline page for admin
*
* We use a second function here, so we get a new session and can log in
* without having to log out "admin" first.
*
* @depends test_viewonline_visit_ideas
*/
public function test_viewonline_check_viewonline()
{
// Create user1 and send them to the Viewonline
$this->create_user('user1');
$this->login('user1');
// Create a second user and check who is online from a separate session.
self::$client->restart();
$this->create_user('ideas-viewonline-user1');
$this->login('ideas-viewonline-user1');
// PHP goes faster than DBMS, make sure session data got written to the database.
sleep(1);
$crawler = self::request('GET', "viewonline.php?sid=$this->sid");

// Is admin still viewing Ideas page
// Is admin still viewing Ideas page?
self::assertStringContainsString('admin', $crawler->filter('#page-body table.table1')->text());

$session_entries = $crawler->filter('#page-body table.table1 tr')->count();
Expand Down
Loading