/** * @covers Redmine\Client * @test */ public function testPrepareDeleteUploadRequestWithSslAndImpersonateUser() { // Create the object under test $client = new Client('https://test.local', 'USER_API-KEY159'); $client->setImpersonateUser('test_user'); $client->setUseHttpAuth(false); $client->setCheckSslCertificate(true); $client->setCheckSslHost(true); // Perform the tests $data = array(1 => 'post_1', '25' => 'post_25'); $client->prepareRequest('/uploads.xml', 'DELETE', $data); $curlOptions = $client->getCurlOptions(); $this->assertArrayNotHasKey(CURLOPT_USERPWD, $curlOptions); $this->assertArrayNotHasKey(CURLOPT_HTTPAUTH, $curlOptions); $this->assertSame('https://test.local/uploads.xml', $curlOptions[CURLOPT_URL]); $this->assertSame(0, $curlOptions[CURLOPT_VERBOSE]); $this->assertSame(0, $curlOptions[CURLOPT_HEADER]); $this->assertSame(1, $curlOptions[CURLOPT_RETURNTRANSFER]); $this->assertSame(443, $curlOptions[CURLOPT_PORT]); $this->assertSame(1, $curlOptions[CURLOPT_SSL_VERIFYPEER]); $this->assertSame(2, $curlOptions[CURLOPT_SSL_VERIFYHOST]); $this->assertContains('Expect: ', $curlOptions[CURLOPT_HTTPHEADER]); $this->assertContains('Content-Type: application/octet-stream', $curlOptions[CURLOPT_HTTPHEADER]); $this->assertContains('X-Redmine-Switch-User: test_user', $curlOptions[CURLOPT_HTTPHEADER]); $this->assertContains('X-Redmine-API-Key: USER_API-KEY159', $curlOptions[CURLOPT_HTTPHEADER]); $this->assertSame('DELETE', $curlOptions[CURLOPT_CUSTOMREQUEST]); }