Skip to content

Commit 71ce14e

Browse files
authored
test: fix batch tests (googleapis#1889)
1 parent 326e37f commit 71ce14e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tests/Google/Http/BatchTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public function testBatchRequestWithAuth()
4444

4545
public function testBatchRequest()
4646
{
47+
$this->checkKey();
4748
$client = $this->getClient();
48-
$batch = new Google_Http_Batch($client);
4949
$plus = new Google_Service_Plus($client);
50+
$batch = $plus->createBatch();
5051

51-
$client->setUseBatch(true);
5252
$batch->add($plus->people->get('+LarryPage'), 'key1');
5353
$batch->add($plus->people->get('+LarryPage'), 'key2');
5454
$batch->add($plus->people->get('+LarryPage'), 'key3');
@@ -61,11 +61,11 @@ public function testBatchRequest()
6161

6262
public function testBatchRequestWithBooksApi()
6363
{
64+
$this->checkKey();
6465
$client = $this->getClient();
65-
$batch = new Google_Http_Batch($client);
6666
$plus = new Google_Service_Plus($client);
67+
$batch = $plus->createBatch();
6768

68-
$client->setUseBatch(true);
6969
$batch->add($plus->people->get('+LarryPage'), 'key1');
7070
$batch->add($plus->people->get('+LarryPage'), 'key2');
7171
$batch->add($plus->people->get('+LarryPage'), 'key3');
@@ -81,16 +81,16 @@ public function testBatchRequestWithPostBody()
8181
$this->checkToken();
8282

8383
$client = $this->getClient();
84-
$batch = new Google_Http_Batch($client);
8584
$shortener = new Google_Service_Urlshortener($client);
85+
$batch = $shortener->createBatch();
86+
8687
$url1 = new Google_Service_Urlshortener_Url;
8788
$url2 = new Google_Service_Urlshortener_Url;
8889
$url3 = new Google_Service_Urlshortener_Url;
8990
$url1->setLongUrl('http://brentertainment.com');
9091
$url2->setLongUrl('http://morehazards.com');
9192
$url3->setLongUrl('http://github.com/bshaffer');
9293

93-
$client->setUseBatch(true);
9494
$batch->add($shortener->url->insert($url1), 'key1');
9595
$batch->add($shortener->url->insert($url2), 'key2');
9696
$batch->add($shortener->url->insert($url3), 'key3');
@@ -103,11 +103,12 @@ public function testBatchRequestWithPostBody()
103103

104104
public function testInvalidBatchRequest()
105105
{
106+
$this->checkKey();
106107
$client = $this->getClient();
107-
$batch = new Google_Http_Batch($client);
108108
$plus = new Google_Service_Plus($client);
109109

110-
$client->setUseBatch(true);
110+
$batch = $plus->createBatch();
111+
111112
$batch->add($plus->people->get('123456789987654321'), 'key1');
112113
$batch->add($plus->people->get('+LarryPage'), 'key2');
113114

0 commit comments

Comments
 (0)