From 568451806e23ceddb8b832343ccdd18f8f843d39 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 22 Jan 2024 18:07:07 +0000 Subject: [PATCH] Mock loadByProperties, return mock nodes, add ...assertions --- .../example/tests/src/Unit/PostNodeRepositoryUnitTest.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/web/modules/custom/example/tests/src/Unit/PostNodeRepositoryUnitTest.php b/web/modules/custom/example/tests/src/Unit/PostNodeRepositoryUnitTest.php index b4e3fac..fddc1e8 100644 --- a/web/modules/custom/example/tests/src/Unit/PostNodeRepositoryUnitTest.php +++ b/web/modules/custom/example/tests/src/Unit/PostNodeRepositoryUnitTest.php @@ -30,10 +30,6 @@ final class PostNodeRepositoryUnitTest extends UnitTestCase { $node3->method('getCreatedTime')->willReturn(strtotime('yesterday')); $node3->method('label')->willReturn('Post three'); - $node4 = $this->createMock(NodeInterface::class); - $node4->method('bundle')->willReturn('page'); - $node4->method('label')->willReturn('Not a post'); - $nodeStorage = $this->createMock(EntityStorageInterface::class); $nodeStorage->method('loadByProperties')->willReturn([$node1, $node2, $node3]); @@ -56,7 +52,6 @@ final class PostNodeRepositoryUnitTest extends UnitTestCase { ['Post two', 'Post one', 'Post three'], $titles, ); - self::assertNotContains('Not a page', $titles); } }