GoogleSpreadsheet\Tests\Google\Spreadsheet\CellFeedTest::testInsertBatch PHP Method

testInsertBatch() public method

public testInsertBatch ( )
    public function testInsertBatch()
    {
        $mockBatchRequest = $this->getMockBuilder(BatchRequest::class)->setMethods(["createRequestXml"])->disableOriginalConstructor()->getMock();
        $mockBatchRequest->expects($this->once())->method("createRequestXml")->will($this->returnValue(new \SimpleXMLElement("<batch/>")));
        $mockCellFeed = $this->getMockBuilder(CellFeed::class)->setMethods(["getBatchUrl"])->disableOriginalConstructor()->getMock();
        $mockCellFeed->expects($this->once())->method("getBatchUrl")->will($this->returnValue("https://spreadsheets.google.com/"));
        $mockServiceRequest = $this->getMockBuilder(DefaultServiceRequest::class)->setMethods(array("post"))->disableOriginalConstructor()->getMock();
        $mockServiceRequest->expects($this->once())->method("post")->with($this->equalTo("https://spreadsheets.google.com/"), $this->stringContains("<batch/>"))->will($this->returnValue("<response/>"));
        ServiceRequestFactory::setInstance($mockServiceRequest);
        $this->assertTrue($mockCellFeed->insertBatch($mockBatchRequest) instanceof BatchResponse);
    }