From 9f175475c564392f880d830942cd5fdfc97b63a0 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 20 Jan 2024 09:28:22 +0000 Subject: [PATCH] Add a test the Exception is thrown --- .../example/tests/src/Unit/PostWrapperTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php b/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php index a07d7a0..9884d3d 100644 --- a/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php +++ b/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php @@ -24,4 +24,17 @@ final class PostWrapperTest extends UnitTestCase { self::assertSame('post', $wrapper->getType()); } + /** + * @test + * @testdox It can't wrap a page + */ + public function it_cant_wrap_a_page(): void { + self::expectException(\InvalidArgumentException::class); + + $node = $this->createMock(NodeInterface::class); + $node->method('bundle')->willReturn('page'); + + new PostWrapper($node); + } + }