Issue #2263339 by damiankloip, blueminds, mgifford, xjm, almaudoh, mitrpaka, znerol, dawehner: Fix all current_user set calls

8.0.x
webchick 2014-12-29 12:54:35 -08:00
parent ee5af45d11
commit b422ee7f22
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@
namespace Drupal\system\Tests\Form;
use Drupal\Core\Form\FormState;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Session\UserSession;
use Drupal\simpletest\KernelTestBase;
@ -88,7 +89,8 @@ class FormCacheTest extends KernelTestBase {
* Tests the form cache without a logged-in user.
*/
function testNoCacheToken() {
$this->container->set('current_user', new UserSession(array('uid' => 0)));
$current_user = $this->container->get('current_user');
$current_user->setAccount(new AnonymousUserSession());
$this->form_state->set('example', $this->randomMachineName());
\Drupal::formBuilder()->setCache($this->form_build_id, $this->form, $this->form_state);