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:
parent
f9be233bc0
commit
13a58fa434
1 changed files with 20 additions and 0 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue