From 07ad4dc2b16e468e24d97073a49a16fc6b181ab0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 14 Nov 2020 09:57:54 +0000 Subject: [PATCH] 5b: Check that it returns the post title > Drupal\Tests\my_module\Unit\Entity\PostTest::it_returns_the_title > Error: Call to undefined method Drupal\my_module\Entity\Post::getTitle() --- .../custom/my_module/tests/src/Unit/Entity/PostTest.php | 8 ++++++++ 1 file changed, 8 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 0419d69..254408a 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 @@ -2,8 +2,16 @@ namespace Drupal\Tests\my_module\Unit\Entity; +use Drupal\my_module\Entity\Post; use Drupal\Tests\UnitTestCase; class PostTest extends UnitTestCase { + /** @test */ + public function it_returns_the_title() { + $post = new Post(); + + $this->assertSame('Test post', $post->getTitle()); + } + }