Add tdd_dublin_test sub-module
This commit is contained in:
parent
81cb121a99
commit
349ec8f965
|
@ -0,0 +1,10 @@
|
||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies: { }
|
||||||
|
name: Article
|
||||||
|
type: article
|
||||||
|
description: 'Use <em>articles</em> for time-sensitive content like news, press releases or blog posts.'
|
||||||
|
help: ''
|
||||||
|
new_revision: true
|
||||||
|
preview_mode: 1
|
||||||
|
display_submitted: true
|
6
tests/modules/tdd_dublin_test/tdd_dublin_test.info.yml
Normal file
6
tests/modules/tdd_dublin_test/tdd_dublin_test.info.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
name: TDD Dublin Test
|
||||||
|
type: module
|
||||||
|
core: 8.x
|
||||||
|
dependencies:
|
||||||
|
- tdd_dublin:tdd_dublin
|
||||||
|
hidden: true
|
|
@ -18,6 +18,7 @@ class PageListTest extends KernelTestBase {
|
||||||
'node',
|
'node',
|
||||||
'system',
|
'system',
|
||||||
'tdd_dublin',
|
'tdd_dublin',
|
||||||
|
'tdd_dublin_test',
|
||||||
'user',
|
'user',
|
||||||
'views',
|
'views',
|
||||||
];
|
];
|
||||||
|
@ -57,11 +58,10 @@ class PageListTest extends KernelTestBase {
|
||||||
// This makes it easier to test certain scenarios, and ensures that the
|
// This makes it easier to test certain scenarios, and ensures that the
|
||||||
// test is future-proofed and won't fail at a later date due to a change in
|
// test is future-proofed and won't fail at a later date due to a change in
|
||||||
// the presentation code.
|
// the presentation code.
|
||||||
$result = views_get_view_result('pages');
|
$nids = [];
|
||||||
|
foreach (views_get_view_result('pages') as $result) {
|
||||||
// $result contains an array of Drupal\views\ResultRow objects. We can use
|
$nids[] = $result->nid;
|
||||||
// array_column to get the nid from each node and return them as an array.
|
}
|
||||||
$nids = array_column($result, 'nid');
|
|
||||||
|
|
||||||
// Only node 1 matches the criteria of being a published page, so only that
|
// Only node 1 matches the criteria of being a published page, so only that
|
||||||
// node ID should be being returned from the view. assertEquals() can be
|
// node ID should be being returned from the view. assertEquals() can be
|
||||||
|
@ -89,7 +89,10 @@ class PageListTest extends KernelTestBase {
|
||||||
Node::create($this->getValidParams(['title' => 'Page B']))->save();
|
Node::create($this->getValidParams(['title' => 'Page B']))->save();
|
||||||
|
|
||||||
// Get the result data from the view.
|
// Get the result data from the view.
|
||||||
$nids = array_column(views_get_view_result('pages'), 'nid');
|
$nids = [];
|
||||||
|
foreach (views_get_view_result('pages') as $result) {
|
||||||
|
$nids[] = $result->nid;
|
||||||
|
}
|
||||||
|
|
||||||
// Compare the expected order based on the titles defined above to the
|
// Compare the expected order based on the titles defined above to the
|
||||||
// ordered results from the view.
|
// ordered results from the view.
|
||||||
|
|
Loading…
Reference in a new issue