Hi
I'm trying to do test my application. I began by writing first test
for first method and i have now problem.
It is my first test written in cake, and examples found on other sides
seems to me be a little nonsense
so i'm writing here :)

function login(){
                
                $usr = $this->data['User']['username'];
                $pass = sha1($this->data['User']['password']);
                
                $anonymous = $this->User->findByUsername($usr);
                
                $pass2 = $anonymous['User']['password'];
                
                if(!empty($anonymous['User']['username']) && $pass == $pass2){
                        $this->set('uzyt', $usr);
                        $this->Session->write('User', $anonymous);
                        $this->redirect(array('controller' => 'users', 'action' 
=> 'main'));
                }
                else{
                        $this->set('uzyt', 'You are not logged');
                }
        }

and here is tested method

function testLogin() {
                
                $this->Users->data = array(
                'User' => array(
                                'id' => '1',
                'username' => 'mariano',
                'password' => '5f4dcc3b5aa765d61d8327deb882cf99',
                )
                );
                
                $this->Users->Component->startup($this->Users);
                $this->Users->login();
                $result = $this->Users->User->read(null, 1);
        $this->assertEqual($result['User']['username'], 'mariano');
        $this->assertEqual($result['User']['password'],
'5f4dcc3b5aa765d61d8327deb882cf99');
        }

What should i do to check if session form login method is set correct??

-- 
Cheers
Dominik

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to