diff --git a/web/modules/custom/opdavies_blog/tests/src/Kernel/Entity/Node/PostTest.php b/web/modules/custom/opdavies_blog/tests/src/Kernel/Entity/Node/PostTest.php index 34bff62..43c8b82 100644 --- a/web/modules/custom/opdavies_blog/tests/src/Kernel/Entity/Node/PostTest.php +++ b/web/modules/custom/opdavies_blog/tests/src/Kernel/Entity/Node/PostTest.php @@ -6,6 +6,7 @@ namespace Drupal\Tests\custom\Kernel\Entity\Node; use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; use Drupal\node\Entity\Node; +use Drupal\node\NodeInterface; use Drupal\opdavies_blog\Entity\Node\Post; final class PostTest extends EntityKernelTestBase { @@ -38,6 +39,25 @@ final class PostTest extends EntityKernelTestBase { $this->assertTrue($post->hasTweet()); } + /** @test */ + public function it_converts_a_post_to_a_tweet(): void { + /** @var Post $post */ + $post = Node::create([ + 'status' => NodeInterface::PUBLISHED, + 'title' => 'Creating a custom PHPUnit command for DDEV', + 'type' => 'post', + ]); + $post->save(); + + $expected = <<assertSame($expected, $post->toTweet()); + } + protected function setUp() { parent::setUp();