class FakeRecord

Same name in other branches
  1. 7.x modules/simpletest/tests/database_test.test \FakeRecord
  2. 9 core/modules/system/tests/src/Functional/Database/FakeRecord.php \Drupal\Tests\system\Functional\Database\FakeRecord
  3. 8.9.x core/modules/system/src/Tests/Database/FakeRecord.php \Drupal\system\Tests\Database\FakeRecord
  4. 8.9.x core/modules/system/tests/src/Functional/Database/FakeRecord.php \Drupal\Tests\system\Functional\Database\FakeRecord
  5. 10 core/modules/system/tests/src/Functional/Database/FakeRecord.php \Drupal\Tests\system\Functional\Database\FakeRecord

Fetches into a class.

PDO supports using a new instance of an arbitrary class for records rather than just a stdClass or array. This class is for testing that functionality. (See testQueryFetchClass() below)

Hierarchy

  • class \Drupal\Tests\system\Functional\Database\FakeRecord

Expanded class hierarchy of FakeRecord

2 files declare their use of FakeRecord
DatabaseTestSchemaDataTrait.php in core/tests/Drupal/KernelTests/Core/Database/DatabaseTestSchemaDataTrait.php
FetchTest.php in core/tests/Drupal/KernelTests/Core/Database/FetchTest.php

File

core/modules/system/tests/src/Functional/Database/FakeRecord.php, line 14

Namespace

Drupal\Tests\system\Functional\Database
View source
class FakeRecord {
    
    /**
     * A class variable.
     *
     * @var int
     */
    public $fakeArg;
    
    /**
     * The property used in tests.
     *
     * @var string
     *
     * @see \Drupal\KernelTests\Core\Database\FetchTest
     */
    public string $name;
    
    /**
     * The property used in tests.
     *
     * @var string
     *
     * @see \Drupal\KernelTests\Core\Database\DatabaseTestBase
     */
    public string $job;
    
    /**
     * Constructs a FakeRecord object with an optional constructor argument.
     *
     * @param int $fakeArg
     *   A class variable.
     */
    public function __construct($fakeArg = 0) {
        $this->fakeArg = $fakeArg;
    }

}

Members

Title Sort descending Modifiers Object type Summary
FakeRecord::$fakeArg public property A class variable.
FakeRecord::$job public property The property used in tests.
FakeRecord::$name public property The property used in tests.
FakeRecord::__construct public function Constructs a FakeRecord object with an optional constructor argument.

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