Skip to content

Commit

Permalink
Fix PHPCR tests for PHPUnit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Mar 12, 2024
1 parent 7a3052e commit b2deb0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\Common\DataFixtures\Purger\PHPCRPurger;
use Doctrine\ODM\PHPCR\DocumentManager;
use Doctrine\Tests\Common\DataFixtures\BaseTestCase;
use Doctrine\Tests\Mock\PHPCRDocumentManager;
use Exception;
use PHPUnit\Framework\MockObject\MockObject;
use Throwable;
Expand Down Expand Up @@ -125,20 +126,15 @@ private function getPurger(): PHPCRPurger
return $this->createMock(PHPCRPurger::class);
}

/** @return DocumentManager&MockObject */
private function getDocumentManager(): DocumentManager
/** @return PHPCRDocumentManager&MockObject */
private function getDocumentManager(): PHPCRDocumentManager
{
if (! class_exists(DocumentManager::class)) {
$this->markTestSkipped('Missing doctrine/phpcr-odm');
}

return $this
->getMockBuilder(DocumentManager::class)
->addMethods([
'transactional',
'flush',
'clear',
])
->getMockBuilder(PHPCRDocumentManager::class)
->disableOriginalConstructor()
->getMock();
}
Expand Down
13 changes: 13 additions & 0 deletions tests/Mock/PHPCRDocumentManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Mock;

use Closure;
use Doctrine\ODM\PHPCR\DocumentManager;

abstract class PHPCRDocumentManager extends DocumentManager

Check failure on line 10 in tests/Mock/PHPCRDocumentManager.php

View workflow job for this annotation

GitHub Actions / Static Analysis / PHPStan (8.3)

Class Doctrine\Tests\Mock\PHPCRDocumentManager extends unknown class Doctrine\ODM\PHPCR\DocumentManager.
{
abstract public function transactional(Closure $func): void;
}

0 comments on commit b2deb0b

Please sign in to comment.