<?php
require_once('../simpletest/web_tester.php');
require_once(
'../simpletest/reporter.php');
require_once(
'../classes/User.php');

class 
TestOfLogging extends WebTestCase {
  function 
testAuth() {
    
$this->WebTestCase();
  }

  function 
testUnknownUser() {
    
$this->get ('http://localhost/xp/login.php');
    
$this->assertNoUnWantedPattern('/utilisateur inconnu/i');
    
$this->setField('login'"inconnu");
    
$this->setField('password''mot-de-passe');
    
$this->clickSubmit('Ok');
    
$this->assertWantedPattern('/utilisateur inconnu/i');
  }

  function 
testKnownUserCanLogIn() {
    
$this->get ('http://localhost/xp/login.php');
    
$this->setField('login''Lebon');
    
$this->setField('password''Secret');
    
$this->clickSubmit('Ok');
    
$this->assertWantedPattern('/connecté/i');
  }
}

$test =  new TestOfLogging();
$test->run(new HtmlReporter());
?>