$this->
assertNull($temp_store->
getMetadata('test_view'
), 'The view is not locked.'
);
$this->
drupalGet('admin/structure/views/view/test_view/edit'
);
// Make sure we have 'changes' to the view.
$this->
drupalGet('admin/structure/views/nojs/display/test_view/default/title'
);
$this->
submitForm([], 'Apply'
);
$this->
assertSession()->
pageTextContains('You have unsaved changes.'
);
$this->
assertEquals($views_admin_user_uid,
$temp_store->
getMetadata('test_view'
)->
getOwnerId(), 'View cache has been saved.'
);
$view_cache =
$temp_store->
get('test_view'
);
// The view should be enabled.
$this->
assertTrue($view_cache->
status(), 'The view is enabled.'
);
// The view should now be locked.
$this->
assertEquals($views_admin_user_uid,
$temp_store->
getMetadata('test_view'
)->
getOwnerId(), 'The view is locked.'
);
// Cancel the view edit and make sure the cache is deleted.
$this->
submitForm([], 'Cancel'
);
$this->
assertNull($temp_store->
getMetadata('test_view'
), 'Shared tempstore data has been removed.'
);
// Test we are redirected to the view listing page.
$this->
assertSession()->
addressEquals('admin/structure/views'
);
// Log in with another user and make sure the view is locked and break.
$this->
drupalGet('admin/structure/views/nojs/display/test_view/default/title'
);