public function amLoggedInAs($user)
    {
        try {
            $this->client->findAndLoginUser($user);
        } catch (ConfigurationException $e) {
            throw new ModuleException($this, $e->getMessage());
        } catch (\RuntimeException $e) {
            throw new ModuleException($this, $e->getMessage());
        }
    }
public function amLoggedInAs($user)
    {
        try {
            $this->client->findAndLoginUser($user);
        } catch (ConfigurationException $e) {
            throw new ModuleException($this, $e->getMessage());
        } catch (\RuntimeException $e) {
            throw new ModuleException($this, $e->getMessage());
        }
    }
public function amLoggedInAs ( $ user ) { try { $ this -> client -> findAndLoginUser ( $ user ) ; } catch ( ConfigurationException $ e ) { throw new ModuleException ( $ this , $ e -> getMessage ( ) ) ; } catch ( \ RuntimeException $ e ) { throw new ModuleException ( $ this , $ e -> getMessage ( ) ) ; } }
Authorizes user on a site without submitting login form.
Use it for fast pragmatic authorization in functional tests.

```php
<?php
// User is found by id
$I->amLoggedInAs(1);

// User object is passed as parameter
$admin = \app\models\User::findByUsername('admin');
$I->amLoggedInAs($admin);
```
Requires `user` component to be enabled and configured.

@param $user
@throws ModuleException
Authorizes user on a site without submitting login form . Use it for fast pragmatic authorization in functional tests .