Skip to content

Commit

Permalink
Merge pull request #68 from wmde/doctrine-update-2024
Browse files Browse the repository at this point in the history
Update Doctrine ORM
  • Loading branch information
Abban authored Feb 21, 2024
2 parents 424f428 + 0c23be2 commit bfd6cd4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"require": {
"php": ">=8.1",

"doctrine/orm": "~2.7",
"doctrine/orm": "~2.18 | ~3.0",
"psr/log": "^1.0|^2.0|^3.0",

"wmde/email-address": "~1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/DataAccess/DoctrineSubscriptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\ORMException;
use Doctrine\ORM\Exception\ORMException;
use WMDE\Fundraising\SubscriptionContext\Domain\Model\Subscription;
use WMDE\Fundraising\SubscriptionContext\Domain\Repositories\SubscriptionRepository;
use WMDE\Fundraising\SubscriptionContext\Domain\Repositories\SubscriptionRepositoryException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
class SubscriptionRepositoryException extends \RuntimeException {

public function __construct( string $message, \Exception $previous = null ) {
public function __construct( string $message, \Throwable $previous = null ) {
parent::__construct( $message, 0, $previous );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
namespace WMDE\Fundraising\SubscriptionContext\Tests\Integration\DataAccess;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\ORMException;
use Doctrine\ORM\Exception\ORMException;
use Doctrine\Persistence\ObjectRepository;
use PHPUnit\Framework\TestCase;
use RuntimeException;
use WMDE\Fundraising\SubscriptionContext\DataAccess\DoctrineSubscriptionRepository;
use WMDE\Fundraising\SubscriptionContext\Domain\Model\Subscription;
use WMDE\Fundraising\SubscriptionContext\Domain\Repositories\SubscriptionRepositoryException;
Expand Down Expand Up @@ -62,7 +63,10 @@ public function testMultipleSubscriptions_onlySimilarAreCounted(): void {
public function testDatabaseLayerExceptionsAreConvertedToDomainExceptions(): void {
$entityManager = $this->createMock( EntityManager::class );

$entityManager->expects( $this->once() )->method( 'persist' )->willThrowException( new ORMException() );
$entityManager->expects( $this->once() )->method( 'persist' )->willThrowException(
new class() extends RuntimeException implements ORMException {
}
);
$repository = new DoctrineSubscriptionRepository( $entityManager );
$subscription = new Subscription();
$subscription->setEmail( '[email protected]' );
Expand Down

0 comments on commit bfd6cd4

Please sign in to comment.