function AlertsJsonFeedTest::setUp
Same name and namespace in other branches
- 11.x core/modules/announcements_feed/tests/src/FunctionalJavascript/AlertsJsonFeedTest.php \Drupal\Tests\announcements_feed\FunctionalJavascript\AlertsJsonFeedTest::setUp()
- 10 core/modules/announcements_feed/tests/src/FunctionalJavascript/AlertsJsonFeedTest.php \Drupal\Tests\announcements_feed\FunctionalJavascript\AlertsJsonFeedTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ announcements_feed/ tests/ src/ FunctionalJavascript/ AlertsJsonFeedTest.php, line 45
Class
- AlertsJsonFeedTest
- Test the access announcement according to json feed changes.
Namespace
Drupal\Tests\announcements_feed\FunctionalJavascriptCode
public function setUp() : void {
parent::setUp();
$this->user = $this->drupalCreateUser([
'access toolbar',
'access announcements',
]);
AnnounceTestHttpClientMiddleware::setAnnounceTestEndpoint('/announce-feed-json/community-feeds');
// Change the version constraint in the updated json feed.
$contents = file_get_contents(dirname(__DIR__, 2) . '/announce_feed/updated.json');
$version = explode('.', \Drupal::VERSION, 2);
$constraint = "^{$version[0]}";
$new_contents = str_replace("^10", $constraint, $contents);
file_put_contents($this->publicFilesDirectory . '/updated.json', $new_contents);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.