function EntityResourceTestBase::assertPatchProtectedFieldNamesStructure
Same name in other branches
- 8.9.x core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::assertPatchProtectedFieldNamesStructure()
- 10 core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::assertPatchProtectedFieldNamesStructure()
- 11.x core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::assertPatchProtectedFieldNamesStructure()
Asserts structure of $patchProtectedFieldNames.
1 call to EntityResourceTestBase::assertPatchProtectedFieldNamesStructure()
- EntityResourceTestBase::testPatch in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php - Tests a PATCH request for an entity, plus edge cases to ensure good DX.
File
-
core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php, line 1200
Class
- EntityResourceTestBase
- Defines a base class for testing all entity resources.
Namespace
Drupal\Tests\rest\Functional\EntityResourceCode
protected function assertPatchProtectedFieldNamesStructure() {
$is_null_or_string = function ($value) {
return is_null($value) || is_string($value);
};
$this->assertTrue(Inspector::assertAllStrings(array_keys(static::$patchProtectedFieldNames)), 'In Drupal 8.6, the structure of $patchProtectedFieldNames changed. It used to be an array with field names as values. Now those values are the keys, and their values should be either NULL or a string: a string containing the reason for why the field cannot be PATCHed, or NULL otherwise.');
$this->assertTrue(Inspector::assertAll($is_null_or_string, static::$patchProtectedFieldNames), 'In Drupal 8.6, the structure of $patchProtectedFieldNames changed. It used to be an array with field names as values. Now those values are the keys, and their values should be either NULL or a string: a string containing the reason for why the field cannot be PATCHed, or NULL otherwise.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.