function StageOwnershipTest::testOwnershipEnforcedWhenLoggedIn
Tests only the owner of stage can perform operations.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ StageOwnershipTest.php, line 52
Class
- StageOwnershipTest
- Tests that ownership of the stage is enforced.
Namespace
Drupal\Tests\package_manager\KernelCode
public function testOwnershipEnforcedWhenLoggedIn() : void {
$user_1 = $this->createUser([], NULL, FALSE, [
'uid' => 2,
]);
$this->setCurrentUser($user_1);
$will_create = $this->createStage();
// Rebuild the container so that the shared tempstore factory is made
// properly aware of the new current user ($user_2) before another stage
// is created.
$kernel = $this->container
->get('kernel');
$this->container = $kernel->rebuildContainer();
$user_2 = $this->createUser();
$this->setCurrentUser($user_2);
$this->assertOwnershipIsEnforced($will_create, $this->createStage());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.