Extract a custom assertion method
This commit is contained in:
parent
c687deaf5c
commit
3db62f83b9
|
@ -36,8 +36,22 @@ class PostNodeRepositoryTest extends EntityKernelTestBase {
|
||||||
// Assert.
|
// Assert.
|
||||||
self::assertCount(3, $nodes);
|
self::assertCount(3, $nodes);
|
||||||
|
|
||||||
self::assertSame(
|
self::assertNodeTitlesAreSame(
|
||||||
['Post two', 'Post one', 'Post three'],
|
['Post two', 'Post one', 'Post three'],
|
||||||
|
$nodes,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<int, string> $expectedTitles
|
||||||
|
* @param array<int, NodeInterface> $nodes
|
||||||
|
*/
|
||||||
|
private static function assertNodeTitlesAreSame(
|
||||||
|
array $expectedTitles,
|
||||||
|
array $nodes,
|
||||||
|
): void {
|
||||||
|
self::assertSame(
|
||||||
|
$expectedTitles,
|
||||||
array_map(
|
array_map(
|
||||||
fn (NodeInterface $node) => $node->label(),
|
fn (NodeInterface $node) => $node->label(),
|
||||||
$nodes
|
$nodes
|
||||||
|
|
Loading…
Reference in a new issue