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
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ lib/Controller/CrlApiController.php
-> tests/php/Unit/Controller/CrlApiControllerTest.php
```

Before creating, renaming, or modifying PHPUnit tests, read and follow
the naming conventions and exceptions in the
[Developer Manual](https://docs.libresign.coop/developer_manual/getting-started/tests.html).

Run focused tests during implementation:

```bash
Expand Down
28 changes: 28 additions & 0 deletions tests/php/Integration/BackgroundJob/SignFileJobTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Libresign\Tests\Integration\BackgroundJob;

use OCA\Libresign\BackgroundJob\SignFileJob;
use OCP\App\IAppManager;
use OCP\Server;
use PHPUnit\Framework\TestCase;

final class SignFileJobTest extends TestCase {
public function testJobIsNotAutomaticallyRegistered(): void {
$infoXmlPath = realpath(__DIR__ . '/../../../../appinfo/info.xml');
$this->assertNotFalse($infoXmlPath, 'appinfo/info.xml must exist');

$appInfo = Server::get(IAppManager::class)->getAppInfoByPath($infoXmlPath);
$this->assertIsArray($appInfo, 'appinfo/info.xml must be parseable by Nextcloud');

$jobs = $appInfo['background-jobs'];
$this->assertNotContains(SignFileJob::class, $jobs);
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Libresign\Tests\Integration\AppInfo;
namespace OCA\Libresign\Tests\Integration\BackgroundJob;

use OCA\Libresign\BackgroundJob\SignFileJob;
use OCA\Libresign\BackgroundJob\SignSingleFileJob;
use OCP\App\IAppManager;
use OCP\Server;
use PHPUnit\Framework\TestCase;

final class BackgroundJobsRegistrationTest extends TestCase {
public function testParameterizedSigningJobsAreNotRegisteredWithoutArguments(): void {
final class SignSingleFileJobTest extends TestCase {
public function testJobIsNotAutomaticallyRegistered(): void {
$infoXmlPath = realpath(__DIR__ . '/../../../../appinfo/info.xml');
$this->assertNotFalse($infoXmlPath, 'appinfo/info.xml must exist');

$appInfo = Server::get(IAppManager::class)->getAppInfoByPath($infoXmlPath);
$this->assertIsArray($appInfo, 'appinfo/info.xml must be parseable by Nextcloud');
$jobs = $appInfo['background-jobs'];

$this->assertNotContains(SignFileJob::class, $jobs);
$jobs = $appInfo['background-jobs'];
$this->assertNotContains(SignSingleFileJob::class, $jobs);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* @group DB
*/
final class CrlMapperDbTest extends \OCA\Libresign\Tests\Integration\TestCase {
final class CrlMapperTest extends \OCA\Libresign\Tests\Integration\TestCase {
private CrlMapper $crlMapper;

public function setUp(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @internal
* @group DB
*/
final class FolderServiceDbTest extends \OCA\Libresign\Tests\Integration\TestCase {
final class FolderServiceTest extends \OCA\Libresign\Tests\Integration\TestCase {
/** @runInSeparateProcess */
public function testGetFolderRestoresMissingUserFilesystemBeforeWriting(): void {
$user = $this->createAccount('folderserviceuser', 'password');
Expand Down
Loading