function KernelTestBase::__sleep

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::__sleep()
  2. 10 core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::__sleep()
  3. 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::__sleep()

Prevents serializing any properties.

Kernel tests are run in a separate process. To do this PHPUnit creates a script to run the test. If it fails, the test result object will contain a stack trace which includes the test object. It will attempt to serialize it. Returning an empty array prevents it from serializing anything it should not.

Return value

array An empty array.

See also

vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist

File

core/tests/Drupal/KernelTests/KernelTestBase.php, line 1015

Class

KernelTestBase
Base class for functional integration tests.

Namespace

Drupal\KernelTests

Code

public function __sleep() {
    return [];
}

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