function test_profile_invalid_user() { $params = array( 'users', 'profile', 'no_such_user++'); $usr = new ctrl_users(); $usr->params = $params; try { $usr->profile(); $this->fail(); } catch(exception $e) { $this->assertEquals(preg_match("/users/", $e->getMessage()), 1); } // After redirect, should display error $usr->index(); $result = $usr->display_outer(true); $this->assertEquals(preg_match("/The specified user does not exist/", $result), 1); }