forked from solariumphp/solarium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCurlTest.php
49 lines (41 loc) · 1.42 KB
/
CurlTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Solarium\Tests\Integration\Proxy;
use Solarium\Core\Client\Request;
use Solarium\Plugin\ParallelExecution\ParallelExecution;
use Solarium\Tests\Integration\TestClientFactory;
/**
* Test connecting through a proxy with the Curl adapter.
*
* @group integration
* @group proxy
*/
class CurlTest extends AbstractProxyTestCase
{
protected static function createClient(): void
{
self::$client = TestClientFactory::createWithCurlAdapter(self::$config);
}
protected static function setProxy(): void
{
self::$client->getAdapter()->setProxy(sprintf('%s:%d', self::$proxy_server, self::$proxy_port));
}
public function testParallelConnections()
{
$query1 = self::$client->createApi([
'version' => Request::API_V1,
'handler' => 'admin/info/properties',
]);
$query2 = self::$client->createApi([
'version' => Request::API_V1,
'handler' => 'admin/info/system',
]);
/** @var ParallelExecution $parallel */
$parallel = self::$client->getPlugin('parallelexecution');
$parallel->addQuery('query1', $query1);
$parallel->addQuery('query2', $query2);
$results = $parallel->execute();
$this->assertTrue($results['query1']->getWasSuccessful());
$this->assertTrue($results['query2']->getWasSuccessful());
self::$client->removePlugin('parallelexecution');
}
}