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); }
function test_following_invalid_user() { $rel = new ctrl_relations(); $rel->params = array('relations', 'followers', 'unknows++'); $rmt_mck = new mck_mdl_remotes('sue', 'Big fat human'); try { $rel->following($rmt_mck); $this->fail(); } catch(exception $e) { $this->assertEquals(preg_match("/users/", $e->getMessage()), 1); } // After redirect, should display error $usr = new ctrl_users(); $usr->index(); $result = $usr->display_outer(true); $this->assertEquals(preg_match("/The specified user does not exist/", $result), 1); }