5b: Add a test for which nodes are wrappable

If we attempt to wrap a node which is not an article, we expect an
Exception to be thrown. As one currently isn’t, the test will fail.
This commit is contained in:
Oliver Davies 2020-03-19 21:55:28 +00:00
parent 7823e56b09
commit 76172f4667

View file

@ -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);
}
}