From 8f8218260b7a2000b91b67fa16f17c40b1c4e853 Mon Sep 17 00:00:00 2001 From: Oliver Davies <oliver@oliverdavies.uk> Date: Sat, 14 Nov 2020 10:04:45 +0000 Subject: [PATCH] 5d: Ensure the label will return the title --- .../custom/my_module/tests/src/Unit/Entity/PostTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/modules/custom/my_module/tests/src/Unit/Entity/PostTest.php b/web/modules/custom/my_module/tests/src/Unit/Entity/PostTest.php index 4ab5273..11c990d 100644 --- a/web/modules/custom/my_module/tests/src/Unit/Entity/PostTest.php +++ b/web/modules/custom/my_module/tests/src/Unit/Entity/PostTest.php @@ -12,6 +12,10 @@ class PostTest extends UnitTestCase { public function it_returns_the_title() { $node = $this->createMock(NodeInterface::class); + $node->expects($this->once()) + ->method('label') + ->willReturn('Test post'); + $post = new Post($node); $this->assertSame('Test post', $post->getTitle());