5a: Create the ArticleWrapper class
Add the contents for the article wrapper class. This fails as there’s no article to wrap yet within the test.
This commit is contained in:
parent
13a58fa434
commit
8d309299ea
2 changed files with 20 additions and 0 deletions
19
web/modules/custom/my_module/src/Wrapper/ArticleWrapper.php
Normal file
19
web/modules/custom/my_module/src/Wrapper/ArticleWrapper.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\my_module\Wrapper;
|
||||||
|
|
||||||
|
use Drupal\node\NodeInterface;
|
||||||
|
|
||||||
|
class ArticleWrapper {
|
||||||
|
|
||||||
|
private $article;
|
||||||
|
|
||||||
|
public function __construct(NodeInterface $node) {
|
||||||
|
$this->article = $node;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOriginal(): NodeInterface {
|
||||||
|
return $this->article;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Drupal\Tests\my_module\Unit\Wrapper;
|
namespace Drupal\Tests\my_module\Unit\Wrapper;
|
||||||
|
|
||||||
|
use Drupal\my_module\Wrapper\ArticleWrapper;
|
||||||
use Drupal\node\NodeInterface;
|
use Drupal\node\NodeInterface;
|
||||||
use Drupal\Tests\UnitTestCase;
|
use Drupal\Tests\UnitTestCase;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue