File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 2
2
namespace Codeception \Lib \Connector ;
3
3
4
4
use Codeception \Exception \ConfigurationException ;
5
+ use Codeception \Exception \ModuleException ;
5
6
use Codeception \Lib \Connector \Yii2 \Logger ;
6
7
use Codeception \Lib \Connector \Yii2 \TestMailer ;
7
8
use Codeception \Lib \InnerBrowser ;
@@ -107,6 +108,7 @@ public function resetApplication()
107
108
* Finds and logs in a user
108
109
* @param $user
109
110
* @throws ConfigurationException
111
+ * @throws \RuntimeException
110
112
*/
111
113
public function findAndLoginUser ($ user )
112
114
{
@@ -121,6 +123,9 @@ public function findAndLoginUser($user)
121
123
// class name implementing IdentityInterface
122
124
$ identityClass = $ app ->user ->identityClass ;
123
125
$ identity = call_user_func ([$ identityClass , 'findIdentity ' ], $ user );
126
+ if (!isset ($ identity )) {
127
+ throw new \RuntimeException ('User not found ' );
128
+ }
124
129
}
125
130
$ app ->user ->login ($ identity );
126
131
}
Original file line number Diff line number Diff line change @@ -408,6 +408,8 @@ public function amLoggedInAs($user)
408
408
$ this ->client ->findAndLoginUser ($ user );
409
409
} catch (ConfigurationException $ e ) {
410
410
throw new ModuleException ($ this , $ e ->getMessage ());
411
+ } catch (\RuntimeException $ e ) {
412
+ throw new ModuleException ($ this , $ e ->getMessage ());
411
413
}
412
414
}
413
415
You can’t perform that action at this time.
0 commit comments