Enablecsrfvalidation Not Working.

Hi,

I was trying some testing tools and got to PHPUnit and WUnit a Yii extension, found out that yii doesn’t give error if I do:




class PmTest extends WUnitTestCase

{

  private $client;


  private function init()

  {

    $this->client = static::createClient();

  }


  function helperLogout($sairC)

  {

    $this->client($sairC->link());

  }


  function helperLogin($username, $password)

  {

    $alreadyLoggedin = false;

    $crawler = $this->client->request('GET', 'index.php');

    $logoutC = $crawler->selectLink('Logout');


    if ($logoutC->count() > 0)

    {

      $usernameC = $crawler->selectLink($username);

      if ($usernameC->count() > 0)

        $alreadyLoggedin = true;

      else

        $this->helperLogout($logoutC);

    }


    if (!$alreadyLoggedin)

    {

      $crawler = $this->client->click($crawler->selectLink('Login')->link());

      $form = $crawler->filter('button:contains("Login")')->form();

      $form['LoginForm[username]'] = $username;

      $form['LoginForm[password]'] = $password;


      $crawler = $this->client->submit($form);

    }


    $this->assertTrue($crawler->filter("html:contains('{$username}')")->count() > 0);

  }


  public function helperReply($pmID, $text)

  {

    $this->client->request('POST', "index.php/pm/reply/{$pmID}", array('Pm'=>array('text'=>$text)));

  }


  public function testTest1()

  {

    $this->init();

    $this->helperLogin('myuser', 'mypassword');

    $this->helperReply(1, 'reply text');

  }

}



Look at this line:




$this->client->request('POST', "index.php/pm/reply/{$pmID}", array('Pm'=>array('text'=>$text)));



Shouldn’t it give the Csrf error?

Thanks.

Can someone please confirm or deny this.