Skip to content

Commit 6b4d762

Browse files
author
Jonathan Taylor
committed
Update doctrine/orm version used for tests
1 parent cb45831 commit 6b4d762

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"noj/dot": "^1.1.0"
2222
},
2323
"require-dev": {
24-
"doctrine/orm": "^2.8",
24+
"doctrine/orm": "^3.5.2",
2525
"phpunit/phpunit": "^9.6|^10.5|^11.5|^12.4",
2626
"symfony/cache": "^5.4"
2727
},

src/Adapter/Doctrine/PHPUnit/DatabaseAssertions.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Noj\Fabrica\Adapter\Doctrine\PHPUnit;
44

5-
use Doctrine\Common\Util\Debug;
65
use Doctrine\ORM\EntityRepository;
76
use Noj\Fabrica\Fabrica;
87
use PHPUnit\Framework\Assert;
@@ -12,7 +11,7 @@ trait DatabaseAssertions
1211
protected static function assertDatabaseContainsEntity(string $class, array $criteria = []): ?object
1312
{
1413
$entity = self::findDatabaseEntity($class, $criteria);
15-
Assert::assertNotNull($entity, self::doesntContainMessage($class, $criteria));
14+
Assert::assertNotNull($entity, self::doesntContainMessage($class));
1615
return $entity;
1716
}
1817

@@ -26,7 +25,7 @@ protected static function assertDatabaseContainsEntities(string $class, int $amo
2625
Assert::assertCount(
2726
$amount,
2827
self::getRepository($class)->findBy($criteria),
29-
self::doesntContainMessage($class, $criteria)
28+
self::doesntContainMessage($class)
3029
);
3130
}
3231

@@ -52,9 +51,8 @@ protected static function getRepository(string $class): EntityRepository
5251
return $entityManager->getRepository($class);
5352
}
5453

55-
private static function doesntContainMessage(string $class, array $criteria): string
54+
private static function doesntContainMessage(string $class): string
5655
{
57-
return "Database doesn't contain a {$class} with criteria:\n" .
58-
Debug::dump($criteria, 2, true, false);
56+
return "Database doesn't contain a {$class} matching the criteria";
5957
}
6058
}

test/Entities/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class User
3030
#[ORM\Column]
3131
public $banned = false;
3232

33-
#[ORM\OneToMany("user", Post::class, ['persist', 'remove'])]
33+
#[ORM\OneToMany(Post::class, 'user', ['persist', 'remove'])]
3434
public $posts;
3535

3636
public function __construct()

0 commit comments

Comments
 (0)