Skip to content

Commit d6f46d7

Browse files
committed
fix(test): mark ContentManagerTest as a DB test and more fixes
The phpunit workflow failed on Nextcloud 36 with PHP >= 8.4: TypeError: OC\Files\Config\UserMountCache::__construct(): Argument #1 ($connection) must be of type OCP\IDBConnection, null given - Extend PHPUnit\Framework\TestCase instead of Test\TestCase. - Add the DB group, since the test uses the real IJobList, and declare it with the #[Group] attribute. Signed-off-by: kyteinsky <kyteinsky@gmail.com> Assisted-by: Github Copilot:claude-opus-5
1 parent 08c5041 commit d6f46d7

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"psalm:clear": "psalm --clear-cache && psalm --clear-global-cache",
3838
"psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType",
3939
"test": "@test:unit",
40-
"test:unit": "phpunit --configuration tests/phpunit.xml"
40+
"test:unit": "phpunit --configuration tests/phpunit.xml --no-coverage"
4141
},
4242
"config": {
4343
"optimize-autoloader": true,

tests/integration/ContentManagerTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@
2626
use OCP\EventDispatcher\IEventDispatcher;
2727
use OCP\IServerContainer;
2828
use OCP\Server;
29+
use PHPUnit\Framework\Attributes\Group;
2930
use PHPUnit\Framework\MockObject\MockObject;
31+
use PHPUnit\Framework\TestCase;
3032
use Psr\Log\LoggerInterface;
3133
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher;
32-
use Test\TestCase;
3334

35+
/**
36+
* The test uses the real IJobList, so it needs a working database connection.
37+
*/
38+
#[Group('DB')]
3439
class ContentManagerTest extends TestCase {
3540
/** @var MockObject | IAppConfig */
3641
private IAppConfig $appConfig;

0 commit comments

Comments
 (0)