[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/test/tests/ui/ -> login_test.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/test/helpers/testtools.class.php" );    
   5      
   6      /**
   7       * \ingroup Test
   8       */
   9      class Login_Test extends LifeTypeTestCase
  10      {
  11  		function setUp()
  12          {
  13              $this->user = TestTools::createUser();
  14              $this->user2 = TestTools::createUser();
  15              $this->blog = TestTools::createBlog( $this->user2->getId());
  16          }
  17          
  18  		function tearDown()
  19          {
  20              TestTools::deleteDaoTestData( Array( $this->user, $this->user2, $this->blog ));
  21          }
  22          
  23          /**
  24           * check that the login page is working as expected
  25           */
  26  		function testLoginPage()
  27          {
  28              $this->assertUIScript(
  29                  Array(
  30                      "login_page" => Array(
  31                          "url" => $this->getAdminUrl(),
  32                          "type" => "get",
  33                          "expected" => "Welcome to LifeType",
  34                          "message" => "The login screen did not display the right message"
  35                      )
  36                  )
  37              );
  38          }
  39          
  40          /**
  41           * Test that a user without a blog cannot login
  42           */
  43  		function testUserHasNoBlog()
  44          {
  45              $this->assertUIScript(
  46                  Array(
  47                      "login_page" => Array(
  48                          "url" => $this->getAdminUrl(),
  49                          "type" => "post",
  50                          "params" => Array(
  51                              "userName" => $this->user->getUserName(),
  52                              "userPassword" => "password",
  53                              "op" => "Login"
  54                          ),
  55                          "expected" => "you do not belong to any blog yet",
  56                          "message" => "User was not warned that he did not belong to any blog yet"
  57                      )
  58                  )
  59              );            
  60          }
  61          
  62          /**
  63           * Test the whoe login and logout process
  64           */
  65  		function testLoginLogout()
  66          {
  67              $this->assertUIScript(
  68                  Array(
  69                      "login" => Array(
  70                          "url" => $this->getAdminUrl(),
  71                          "type" => "post",
  72                          "params" => Array(
  73                              "userName" => $this->user2->getUserName(),
  74                              "userPassword" => "password",
  75                              "op" => "Login"
  76                          ),
  77                          "expected" => "Dashboard",
  78                          "message" => "The dashboard did not appear when logging in"
  79                       ),
  80                      "select_blog" => Array(
  81                          "url" => $this->getAdminUrl(),
  82                          "type" => "get",
  83                          "params" => Array(
  84                              "op" => "blogSelect",
  85                              "blogId" => $this->blog->getId()
  86                          ),
  87                          "expected" => "New Post",
  88                          "message" => "The blog could not be selected after the dashboard"
  89                      ),
  90                      "logout" => Array(
  91                          "url" => $this->getAdminUrl(),
  92                          "type" => "get",
  93                          "params" => Array( "op" => "Logout" ),
  94                          "expected" => "You have been successfully logged out",
  95                          "message" => "The logout screen was not displayed correctly"
  96                      )
  97                  )
  98              );                        
  99          }
 100      }
 101  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics