protected function RevisionTest::editContentAndRepopulate in Entity Share 8.3
Update all entities by changing the labels, and populate response mapping.
Parameters
int $version: The ordinal number of content modification.
2 calls to RevisionTest::editContentAndRepopulate()
- RevisionTest::setUp in modules/
entity_share_client/ tests/ src/ Functional/ RevisionTest.php - RevisionTest::testRevisionPlugin in modules/
entity_share_client/ tests/ src/ Functional/ RevisionTest.php - Test the "Revision" Import Processor plugin.
File
- modules/
entity_share_client/ tests/ src/ Functional/ RevisionTest.php, line 66
Class
- RevisionTest
- Functional test class to test import plugin "Revision".
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function editContentAndRepopulate(int $version) {
foreach ($this->entities as $entities_per_type) {
foreach ($entities_per_type as $entity) {
$entity
->set('title', $entity
->label() . " V{$version}")
->save();
}
}
foreach ($this->visitedUrlsDuringSetup as $url) {
$parsed_url = UrlHelper::parse($url);
// Just add the fake parameter (ie. `&2=2`) which doesn't affect JSON:API
// response, but is different from the regular JSON:API URL.
$parsed_url['query'][$version] = $version;
$query = UrlHelper::buildQuery($parsed_url['query']);
$prepared_url = $parsed_url['path'] . '?' . $query;
// Issue the request in order to populate response mapping with different
// data.
$this->remoteManager
->request($this->remote, 'GET', $prepared_url);
// For convenience, save the N'th version of the URL in a class variable.
$this->urlsByPass[$url][$version] = $prepared_url;
}
}