protected function ContentLockTimeoutTest::lockContentByUser1 in Content locking (anti-concurrent editing) 8
Same name and namespace in other branches
- 8.2 modules/content_lock_timeout/tests/src/Functional/ContentLockTimeoutTest.php \Drupal\Tests\content_lock_timeout\Functional\ContentLockTimeoutTest::lockContentByUser1()
Create lock from user 1.
As logout is removing locks, it is only possible to set a lock from another user with the lock service.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity which should be locked.
1 call to ContentLockTimeoutTest::lockContentByUser1()
- ContentLockTimeoutTest::doTestForEntity in modules/
content_lock_timeout/ tests/ src/ Functional/ ContentLockTimeoutTest.php - Run the same tests for node, block and term.
File
- modules/
content_lock_timeout/ tests/ src/ Functional/ ContentLockTimeoutTest.php, line 291
Class
- ContentLockTimeoutTest
- Test content_lock_timeout sub module.
Namespace
Drupal\Tests\content_lock_timeout\FunctionalCode
protected function lockContentByUser1(EntityInterface $entity) {
$this->lockService
->releaseAllUserLocks($this->user2
->id());
$this->lockService
->locking($entity
->id(), $entity
->language()
->getId(), 'edit', $this->user1
->id(), $entity
->getEntityTypeId());
$lock = $this->lockService
->fetchLock($entity
->id(), $entity
->language()
->getId(), 'edit', $entity
->getEntityTypeId());
$this
->assertNotNull($lock, 'Lock present');
$this
->assertEqual($this->user1
->label(), $lock->name, 'Lock present for correct user.');
}