File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -609,4 +609,9 @@ function &get_instance()
609
609
/* Location: ./system/core/CodeIgniter.php */
610
610
611
611
/* End of file index.php */
612
- /* Location: ./index.php */
612
+ /* Location: ./index.php */
613
+
614
+ function load_controller ($ class ) {
615
+ require_once (FCPATH . APPPATH . 'controllers/ ' . strtolower ($ class ) . '.php ' );
616
+ return new $ class ();
617
+ }
Original file line number Diff line number Diff line change @@ -10,10 +10,12 @@ public function setUp()
10
10
11
11
public function testLogin ()
12
12
{
13
- $ _POST [
'email ' ] =
'[email protected] ' ;
14
- $ _POST ['password ' ] = 'password123 ' ;
15
- require_once (FCPATH . APPPATH . 'controllers/user.php ' );
16
- $ this ->CI ->User = new User ();
17
- echo $ this ->CI ->User ->login ();
13
+
14
+ $ password = 'password123 ' ;
15
+ $ _POST ['email ' ] = $ email ;
16
+ $ _POST ['password ' ] = $ password ;
17
+ $ this ->CI ->User = load_controller ('User ' );
18
+ $ result = json_decode ($ this ->CI ->User ->login ())->output ;
19
+ $ this ->assertEquals ($ result ->email , $ email );
18
20
}
19
21
}
You can’t perform that action at this time.
0 commit comments