docs: DrupalCon updates
This commit is contained in:
parent
6cf7d0fee4
commit
675e89e9d1
28 changed files with 1240 additions and 144 deletions
40
test-driven-drupal/code/14.txt
Normal file
40
test-driven-drupal/code/14.txt
Normal file
|
@ -0,0 +1,40 @@
|
|||
namespace Drupal\Tests\drupalcon\Kernel;
|
||||
|
||||
use Drupal\drupalcon\Repository\ArticleRepository;
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
use Drupal\Tests\node\Traits\NodeCreationTrait;
|
||||
|
||||
class ArticleRepositoryTest extends EntityKernelTestBase {
|
||||
|
||||
public static $modules = [
|
||||
'drupalcon',
|
||||
'node',
|
||||
];
|
||||
|
||||
// start test
|
||||
use NodeCreationTrait;
|
||||
|
||||
/** @test */
|
||||
public function it_returns_blog_posts() {
|
||||
$this->createNode(['type' => 'article']);
|
||||
|
||||
/** @var ArticleRepository */
|
||||
$repository = $this->container->get(ArticleRepository::class);
|
||||
|
||||
$articles = $repository->getAll();
|
||||
|
||||
$this->assertCount(1, $articles);
|
||||
}
|
||||
// end test
|
||||
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
// start output
|
||||
. 1 / 1 (100%)
|
||||
|
||||
Time: 00:00.439, Memory: 6.00 MB
|
||||
|
||||
OK (1 test, 11 assertions)
|
||||
// end output
|
Loading…
Add table
Add a link
Reference in a new issue