.../rest/src/Plugin/views/row/DataFieldRow.php | 2 +- .../rest/src/Tests/Views/ExcludedFieldTokenTest.php | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php index ebdb590..8cebb73 100644 --- a/core/modules/rest/src/Plugin/views/row/DataFieldRow.php +++ b/core/modules/rest/src/Plugin/views/row/DataFieldRow.php @@ -146,7 +146,7 @@ public function render($row) { $value = $field->advancedRender($row); } - // The rendered output doesn't contain the excluded fields. + // Omit excluded fields from the rendered output. if (empty($field->options['exclude'])) { $output[$this->getFieldKeyAlias($id)] = $value; } diff --git a/core/modules/rest/src/Tests/Views/ExcludedFieldTokenTest.php b/core/modules/rest/src/Tests/Views/ExcludedFieldTokenTest.php index 4610ef8..ae997ab 100644 --- a/core/modules/rest/src/Tests/Views/ExcludedFieldTokenTest.php +++ b/core/modules/rest/src/Tests/Views/ExcludedFieldTokenTest.php @@ -31,19 +31,19 @@ class ExcludedFieldTokenTest extends ViewTestBase { * * @var array */ - public static $testViews = array('test_excluded_field_token_display'); + public static $testViews = ['test_excluded_field_token_display']; /** * The modules that need to be installed for this test. * * @var array */ - public static $modules = array( + public static $modules = [ 'entity_test', 'rest_test_views', 'node', - 'field' - ); + 'field', + ]; /** * {@inheritdoc} @@ -51,7 +51,7 @@ class ExcludedFieldTokenTest extends ViewTestBase { protected function setUp() { parent::setUp(); - ViewTestData::createTestViews(get_class($this), array('rest_test_views')); + ViewTestData::createTestViews(get_class($this), ['rest_test_views']); $this->setAdminUser(); $this->createTestNodes(); @@ -69,7 +69,7 @@ public function testExcludedTitleTokenDisplay() { $this->assertResponse(200); $expected = $this->getExpectedOutput(); - $this->assertIdentical($actual_json, $expected, 'The expected JSON output was found.'); + $this->assertIdentical($actual_json, $expected); } /** @@ -77,11 +77,10 @@ public function testExcludedTitleTokenDisplay() { */ protected function createTestNodes() { for ($i = 1; $i <= 10; $i++) { - $node = Node::create([ + Node::create([ 'type' => 'article', 'title' => 'Article test ' . $i, - ]); - $node->save(); + ])->save(); } } @@ -99,9 +98,9 @@ protected function setAdminUser() { */ private function getExpectedOutput() { $this->executeView($this->view); - $expected = array(); + $expected = []; foreach ($this->view->result as $rowIndex => $row) { - $expected_row = array(); + $expected_row = []; foreach ($this->view->field as $id => $field) { if (empty($field->options['exclude'])) { $expected_row[$id] = $this->view->getStyle()->getField($rowIndex, $id)->__toString();