diff --git a/web/modules/custom/my_module/tests/src/Unit/Wrapper/ArticleWrapperTest.php b/web/modules/custom/my_module/tests/src/Unit/Wrapper/ArticleWrapperTest.php index 4812f99..d1a8be8 100644 --- a/web/modules/custom/my_module/tests/src/Unit/Wrapper/ArticleWrapperTest.php +++ b/web/modules/custom/my_module/tests/src/Unit/Wrapper/ArticleWrapperTest.php @@ -21,5 +21,15 @@ class ArticleWrapperTest extends UnitTestCase { $this->assertSame('article', $articleWrapper->getOriginal()->bundle()); } + /** @test */ + public function it_throws_an_exception_if_the_node_is_not_an_article() { + $this->expectException(\InvalidArgumentException::class); + + $page = $this->createMock(NodeInterface::class); + $page->method('bundle')->willReturn('page'); + + new ArticleWrapper($page); + } + }