eZ\Bundle\EzPublishRestBundle\Tests\Functional\TestCase::setUp PHP Method

setUp() protected method

protected setUp ( )
    protected function setUp()
    {
        parent::setUp();
        $this->httpHost = getenv('EZP_TEST_REST_HOST') ?: 'localhost';
        $this->httpAuth = getenv('EZP_TEST_REST_AUTH') ?: 'admin:publish';
        list($this->loginUsername, $this->loginPassword) = explode(':', $this->httpAuth);
        $this->httpClient = new \Buzz\Client\Curl();
        $this->httpClient->setVerifyPeer(false);
        $this->httpClient->setTimeout(90);
        $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false);
        if ($this->autoLogin) {
            $session = $this->login();
            $this->headers[] = sprintf('Cookie: %s=%s', $session->name, $session->identifier);
            $this->headers[] = sprintf('X-CSRF-Token: %s', $session->csrfToken);
        }
    }

Usage Example

 public function setUp()
 {
     $this->autoLogin = false;
     parent::setUp();
 }