Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8674471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:43:07+00:00 2026-06-12T19:43:07+00:00

I am tryinng to run a functional test with an authenticated user on YII

  • 0

I am tryinng to run a functional test with an authenticated user on YII with selenium.
I wrote the following

protected function _login(){

    $id=new UserIdentity('admin','admin');
    $id->authenticate();
    if($id->errorCode===UserIdentity::ERROR_NONE)
    {
        Yii::app()->user->login($id);
        return true;
    }
    return false;
}
public function testSpot(){
    $this->assertTrue($this->_login());
    ob_end_flush();
    $this->open('production/request/create');
}

I added an ob_start() on bootstrap.php because the header were being sent twice and flushed it after the login.Still the test when access production/request/create goes to the login page, because the login is not computed even though it’s valid.

EDIT:
the ob_end_flush and ob_start is not needed if you use –stderr option on phpunit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T19:43:09+00:00Added an answer on June 12, 2026 at 7:43 pm

    This wont work because you are only authenticating against the session that is running from the command line. You need to authenticate the web session.

    See this comment:

    http://www.yiiframework.com/doc/guide/1.1/en/test.functional#c10015

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run a functional test in Python using Selenium, and I
I'm trying to write a functional test for an action that must run over
I'm new to testing, and I'm having some difficulties trying to run a functional
I'm new to selenium testing and am trying to get my first test up
I have the following script inside a HTML page: <script> function Test(){ alert(i got
I'm trying to run a function that is located within a .ps1 file. The
I'm trying to run a function called makeHighlight within my constructor SmartButton. makeHighlight is
I am trying to run a function of the main class, but even with
I'm trying to run the Count() function of a Linq statement in an overriden
I am trying to run a map/reduce function in mongodb where I group by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.