public function testGetRawResponseBody() { try { $rowData = array(); $entry = $this->gdata->insertRow($rowData, $this->sprKey); $this->fail('Expecting Zend\\GData\\App\\HttpException'); } catch (\Zend\GData\App\HttpException $hExc) { $message = $hExc->getMessage(); $this->assertEquals('Expected response code 200, got 400', $message); $body = $hExc->getRawResponseBody(); $this->assertNotNull($body); $this->assertNotEquals(stripos($body, 'Blank rows cannot be written; use delete instead.'), false); } }
/** * Returns the worksheets in this spreadsheet * * @return \Zend\GData\Spreadsheets\WorksheetFeed The worksheets */ public function getWorksheets() { $service = new Spreadsheets($this->getHttpClient()); return $service->getWorksheetFeed($this); }
public function testCustomElementsCollected() { $rowData = array(); $rowData['a1'] = 'new'; $rowData['b1'] = 'row'; $rowData['c1'] = 'data'; $rowData['d1'] = 'here'; $entry = $this->gdata->insertRow($rowData, $this->sprKey); $this->assertEquals(4, count($entry->custom)); $this->assertEquals(4, count($entry->customByName)); $this->assertEquals('new', $entry->custom[0]->getText()); $this->assertEquals('row', $entry->custom[1]->getText()); $this->assertEquals('data', $entry->custom[2]->getText()); $this->assertEquals('here', $entry->custom[3]->getText()); $this->assertEquals('new', $entry->customByName['a1']->getText()); $this->assertEquals('row', $entry->customByName['b1']->getText()); $this->assertEquals('data', $entry->customByName['c1']->getText()); $this->assertEquals('here', $entry->customByName['d1']->getText()); $ssTest = new Spreadsheets($entry->getHttpClient()); $ssTest->delete($entry); }
/** * Returns the content of all cells as an associative array, indexed * off the cell location (ie 'A1', 'D4', etc). Each element of * the array is an associative array with a 'value' and a 'function'. * Only non-empty cells are returned by default. 'range' is the * value of the 'range' query parameter specified at: * http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters * * @param string $range The range of cells to retrieve * @param boolean $empty Whether to retrieve empty cells * @return array An associative array of cells */ public function getContentsAsCells($range = null, $empty = false) { $service = new Spreadsheets($this->getHttpClient()); return $service->getSpreadsheetCellFeedContents($this, $range, $empty); }