Sulu\Bundle\SecurityBundle\Entity\UserSetting::setValue PHP Method

setValue() public method

Sets the value for this user setting.
public setValue ( string $value ) : UserSetting
$value string
return UserSetting
    public function setValue($value)
    {
        $this->value = $value;
        return $this;
    }

Usage Example

Esempio n. 1
0
 public function testIndexAction()
 {
     $client = $this->createAuthenticatedClient();
     $client->request('GET', '/admin/');
     // required because test user does not exist otherwise
     $userSetting = new UserSetting();
     $userSetting->setKey('test');
     $userSetting->setValue(json_encode(['key' => 'value']));
     $userSetting->setUser($this->getTestUser());
     $this->em->persist($userSetting);
     $this->em->flush();
     $client->request('GET', '/admin/');
     $this->assertContains('"settings":{"test":{"key":"value"}}', $client->getResponse()->getContent());
 }