diff --git a/web/modules/custom/example/src/PostWrapper.php b/web/modules/custom/example/src/PostWrapper.php new file mode 100644 index 0000000..849dcba --- /dev/null +++ b/web/modules/custom/example/src/PostWrapper.php @@ -0,0 +1,16 @@ +post->bundle(); + } + +} diff --git a/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php b/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php index 2d7fdd1..a07d7a0 100644 --- a/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php +++ b/web/modules/custom/example/tests/src/Unit/PostWrapperTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\example\Unit; +use Drupal\example\PostWrapper; use Drupal\node\NodeInterface; use Drupal\Tests\UnitTestCase; @@ -15,8 +16,12 @@ final class PostWrapperTest extends UnitTestCase { $node = $this->createMock(NodeInterface::class); $node->method('bundle')->willReturn('post'); + $wrapper = new PostWrapper($node); + self::assertInstanceOf(NodeInterface::class, $node); self::assertSame('post', $node->bundle()); + + self::assertSame('post', $wrapper->getType()); } }