Skip to content

Commit fc182fb

Browse files
committed
WIP
1 parent fce4cde commit fc182fb

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

Spanner/tests/Snippet/InstanceTest.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,15 +445,24 @@ public function testLongRunningOperations()
445445
$snippet = $this->snippetFromMethod(Instance::class, 'longRunningOperations');
446446
$snippet->addLocal('instance', $this->instance);
447447

448-
$this->requestHandler
449-
->sendRequest(
450-
Argument::any(),
451-
'listOperations',
452-
Argument::cetera()
453-
)
454-
->willReturn([$this->getOperationResponseMock()]);
448+
$operation = new Operation();
449+
$page = $this->prophesize(Page::class);
450+
$page->getResponseObject()
451+
->willReturn(new ListOperationsResponse(['operations' => [$operation]]));
452+
$page->getNextPageToken()
453+
->willReturn(null);
454+
$pagedListResponse = $this->prophesize(PagedListResponse::class);
455+
$pagedListResponse->getPage()
456+
->willReturn($page->reveal());
457+
458+
$operationsClient = $this->prophesize(OperationsClient::class);
459+
$operationsClient->listOperations(Argument::cetera())
460+
->willReturn($pagedListResponse->reveal());
461+
462+
$this->databaseAdminClient->getOperationsClient()
463+
->shouldBeCalledTimes(2)
464+
->willReturn($operationsClient->reveal());
455465

456-
$this->instance->___setProperty('requestHandler', $this->requestHandler->reveal());
457466
$res = $snippet->invoke('operations');
458467
$this->assertInstanceOf(ItemIterator::class, $res->returnVal());
459468
$this->assertContainsOnlyInstancesOf(OperationResponse::class, $res->returnVal());

0 commit comments

Comments
 (0)