function test_register_mismatched_passwords() { $_POST = array( 'name' => 'abcdefg', 'email' => '*****@*****.**', 'pass' => 'aaaaa', 'pass_v' => 'aaaaa', 'Submit' => 'Submit'); $usr = new ctrl_users(); $usr->register(); $result = $usr->display_outer(true); // Check page redisplay with invalid username error $this->assertEquals(preg_match("/<h2>Register<\/h2>/", $result), 1); $this->assertEquals(preg_match("/<input name=\"name\".+>/", $result), 1); $this->assertEquals(preg_match("/<div\ +id=\"errors\">/", $result), 1); $this->assertEquals(preg_match("/<li>Password too short/", $result), 1); }