Skip to content

Exclude hidden files from recently-edited recommendations#997

Open
Copilot wants to merge 7 commits intomasterfrom
copilot/remove-hidden-files-from-recommendations
Open

Exclude hidden files from recently-edited recommendations#997
Copilot wants to merge 7 commits intomasterfrom
copilot/remove-hidden-files-from-recommendations

Conversation

Copy link

Copilot AI commented Mar 19, 2026

composer run test:unit failed with exit 127 because vendor-bin/phpunit/vendor/bin/phpunit doesn't exist — bamarni/composer-bin-plugin exposes the binary at vendor/bin/phpunit (a proxy). Additionally, mocking IRootFolder required OC\Hooks\Emitter stubs at runtime since IRootFolder extends OC\Hooks\Emitter, and the CI workflow removes nextcloud/ocp before install.

Changes

  • composer.jsontest:unit now uses vendor/bin/phpunit
  • tests/bootstrap.php — loads lib/base.php when running inside a Nextcloud server (CI), providing all OCP/OC classes without the nextcloud/ocp dev-dependency; stubs block removed entirely
  • tests/Unit/Service/RecentlyEditedFilesSourceTest.php — replaces createMock(IRootFolder::class) with an anonymous proxy exposing only getUserFolder():
$rootFolderProxy = new class($userFolder) {
    public function __construct(
        private Folder $folder,
    ) {
    }
    public function getUserFolder(string $uid): Folder {
        return $this->folder;
    }
};

IRootFolder::class is a compile-time string constant and doesn't trigger autoloading, so OC\Hooks\Emitter is never loaded — eliminating the need for any runtime stubs.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recommendations to exclude hidden files Exclude hidden files from recently-edited recommendations Mar 19, 2026
Copilot AI requested a review from skjnldsv March 19, 2026 08:33
@skjnldsv skjnldsv added bug Something isn't working 2. developing papercut labels Mar 19, 2026
@skjnldsv skjnldsv added this to the Nextcloud 34 milestone Mar 19, 2026
@skjnldsv skjnldsv marked this pull request as ready for review March 19, 2026 08:36
…red out

Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>

This comment was marked as resolved.

Copilot AI requested a review from skjnldsv March 19, 2026 08:38
Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
Copilot AI changed the title Exclude hidden files from recently-edited recommendations Add unit tests for RecentlyEditedFilesSource hidden file filtering Mar 19, 2026
…ssion test

Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
- composer.json: use vendor/bin/phpunit (bamarni proxy) not vendor-bin/phpunit/vendor/bin/phpunit
- tests/bootstrap.php: load server lib/base.php when present (CI context) so OCP interfaces survive composer remove nextcloud/ocp; load OC\Hooks stubs only when not already defined
- tests/OcHooksStubs.php: extract OC\Hooks stubs into separate file for conditional require
- tests/bootstrap.php: fix PHP CS (empty method bodies on separate lines)

Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
Copilot AI changed the title Add unit tests for RecentlyEditedFilesSource hidden file filtering Fix PHPUnit CI: wrong binary path, PHP CS, and missing OCP interfaces Mar 19, 2026
@skjnldsv skjnldsv changed the title Fix PHPUnit CI: wrong binary path, PHP CS, and missing OCP interfaces Exclude hidden files from recently-edited recommendations Mar 19, 2026
@skjnldsv skjnldsv requested a review from ChristophWurst March 19, 2026 16:28
IRootFolder extends OC\Hooks\Emitter (a server-internal interface), which
is why OcHooksStubs.php was needed. Fix the root cause instead: replace
createMock(IRootFolder::class) with a lightweight anonymous proxy that only
exposes getUserFolder(). PHP then never loads IRootFolder at runtime, so
no OC\Hooks stubs are required at all.

- tests/Unit/Service/RecentlyEditedFilesSourceTest.php: use anonymous proxy
- tests/bootstrap.php: remove stubs loading block
- tests/OcHooksStubs.php: deleted

Co-authored-by: skjnldsv <14975046+skjnldsv@users.noreply.github.com>
Copilot AI changed the title Exclude hidden files from recently-edited recommendations Fix unit test bootstrap for standalone and CI execution Mar 19, 2026
@skjnldsv
Copy link
Member

Done @ChristophWurst

@skjnldsv skjnldsv enabled auto-merge March 19, 2026 16:52
@skjnldsv skjnldsv changed the title Fix unit test bootstrap for standalone and CI execution Exclude hidden files from recently-edited recommendations Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review bug Something isn't working papercut

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants