assertTrue dosn不能与phpunit symfony2

时间:2015-10-08 16:03:37

标签: php symfony phpunit

$this->assertTrue($this->client->getResponse()->isSuccessful());

他没有工作!!网址存在

消息错误:

声明false为真的失败

class DefunctControllerTest extends WebTestCase

{
  private $client;


protected function setUp()
{
    $client = static::createClient();
    $this->client = $client;

    $connection = static::createClient();
    $connection->request('POST', '/connection', array('identifiant' => 'login', 'mdp' => 'pass'));
    $this->connection = $connection;

}
  public function testAddDefunct()
{

    $cookieJar = $this->connection->getCookieJar();


    $JSESSIONID = $cookieJar->get('JSESSIONID')->getValue();
    $frsimplifiaauth = $cookieJar->get('frsimplifiaauth')->getValue();


    $JSESSIONIDname = $cookieJar->get('JSESSIONID')->getName();
    $frsimplifiaauthname = $cookieJar->get('frsimplifiaauth')->getName();


    $this->client->request('GET', '/146c0a06-be8e-11e4-8c91-cba28340dea8/add-defunct');


    $this->client->getResponse()->headers->setCookie(new Cookie($JSESSIONIDname, $JSESSIONID));
    $this->client->getResponse()->headers->setCookie(new Cookie($frsimplifiaauthname, $frsimplifiaauth));


    $this->assertTrue($this->client->getResponse()->isSuccessful());

}

0 个答案:

没有答案