test a url with phpunit

Hi

Scenario :

user fill a registration form, an email is sent to him with a link to validate the registration.

Function test for form filling is ok.

Now I try to write the test to check if the registration link is correct but i don’t know how to check this url ? (maybe i shouldn’t write this test?).




class UserTest extends CDbTestCase

{

...

	public function testUserValidation()

	{

                $u = $this->users('user1');

                $link = $u->getValidationLink();


		// just test that the method exist and return a link with email and $key but we have to check deeper

		$this->assertGreaterThan(3, strlen($link));


		// for the moment, test with a simple link (no @.- ) so use the next $link

		$link = 'user/validate?email=someonemail&key=sdfgsdfg';

		$urlValidator = new CUrlValidator();

		$urlValidator->createValidator('url', $u, array('pattern' => 'user/validate/<email:\w+>/<key:\w>', )); 

		$this->assertTrue( (bool) $urlValidator->validateValue($link)); // that test fails

        }

}