5a: The article wrapper can return an article

Add a test to ensure that an `ArticleWrapper` can be used to decorate an
article node, and that the original article can be retrieved again.
This commit is contained in:
Oliver Davies 2020-03-19 21:45:19 +00:00
parent f9be233bc0
commit 13a58fa434

View file

@ -0,0 +1,20 @@
<?php
namespace Drupal\Tests\my_module\Unit\Wrapper;
use Drupal\node\NodeInterface;
use Drupal\Tests\UnitTestCase;
class ArticleWrapperTest extends UnitTestCase {
/** @test */
public function it_can_return_the_article() {
$articleWrapper = new ArticleWrapper($article);
$this->assertInstanceOf(NodeInterface::class, $articleWrapper->getOriginal());
$this->assertSame(5, $articleWrapper->getOriginal()->id());
$this->assertSame('article', $articleWrapper->getOriginal()->bundle());
}
}