function ViewTestData::dataSet

Same name in other branches
  1. 9 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::dataSet()
  2. 8.9.x core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::dataSet()
  3. 10 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::dataSet()

Returns a very simple test dataset.

5 calls to ViewTestData::dataSet()
CounterTest::setUp in core/modules/views/tests/src/Unit/Plugin/field/CounterTest.php
PreviewTest::dataSet in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
Returns a very simple test dataset.
TokenReplaceTest::testTokenReplacementWithSpecificNumberOfItems in core/modules/views/tests/src/Kernel/TokenReplaceTest.php
Tests token replacement of [view:total-rows] when pager is disabled.
ViewsKernelTestBase::dataSet in core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
Returns a very simple test dataset.
ViewTestBase::dataSet in core/modules/views/tests/src/Functional/ViewTestBase.php
Returns a very simple test dataset.

File

core/modules/views/src/Tests/ViewTestData.php, line 237

Class

ViewTestData
Provides tests view data and the base test schema with sample data records.

Namespace

Drupal\views\Tests

Code

public static function dataSet() {
    return [
        [
            'name' => 'John',
            'age' => 25,
            'job' => 'Singer',
            'created' => gmmktime(0, 0, 0, 1, 1, 2000),
            'status' => 1,
        ],
        [
            'name' => 'George',
            'age' => 27,
            'job' => 'Singer',
            'created' => gmmktime(0, 0, 0, 1, 2, 2000),
            'status' => 0,
        ],
        [
            'name' => 'Ringo',
            'age' => 28,
            'job' => 'Drummer',
            'created' => gmmktime(6, 30, 30, 1, 1, 2000),
            'status' => 1,
        ],
        [
            'name' => 'Paul',
            'age' => 26,
            'job' => 'Songwriter',
            'created' => gmmktime(6, 0, 0, 1, 1, 2000),
            'status' => 0,
        ],
        [
            'name' => 'Meredith',
            'age' => 30,
            'job' => 'Speaker',
            'created' => gmmktime(6, 30, 10, 1, 1, 2000),
            'status' => 1,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.