From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001
From: Horus3
Date: Mon, 24 Feb 2014 16:42:14 +0100
Subject: init
---
.../Zend/Gdata/Spreadsheets/CellEntryTest.php | 64 ++++++
.../tests/Zend/Gdata/Spreadsheets/CellFeedTest.php | 91 +++++++++
.../Zend/Gdata/Spreadsheets/CellQueryTest.php | 138 +++++++++++++
zend/tests/Zend/Gdata/Spreadsheets/CellTest.php | 67 ++++++
.../tests/Zend/Gdata/Spreadsheets/ColCountTest.php | 54 +++++
zend/tests/Zend/Gdata/Spreadsheets/CustomTest.php | 57 ++++++
.../Zend/Gdata/Spreadsheets/DocumentQueryTest.php | 91 +++++++++
.../Zend/Gdata/Spreadsheets/ListEntryTest.php | 225 +++++++++++++++++++++
.../tests/Zend/Gdata/Spreadsheets/ListFeedTest.php | 68 +++++++
.../Zend/Gdata/Spreadsheets/ListQueryTest.php | 109 ++++++++++
.../tests/Zend/Gdata/Spreadsheets/RowCountTest.php | 54 +++++
.../Gdata/Spreadsheets/SpreadsheetFeedTest.php | 65 ++++++
.../Zend/Gdata/Spreadsheets/WorksheetEntryTest.php | 57 ++++++
.../Zend/Gdata/Spreadsheets/WorksheetFeedTest.php | 65 ++++++
.../_files/TestDataCellFeedSample1.xml | 49 +++++
.../_files/TestDataListFeedSample1.xml | 56 +++++
.../_files/TestDataSpreadsheetFeedSample1.xml | 38 ++++
.../_files/TestDataWorksheetFeedSample1.xml | 37 ++++
18 files changed, 1385 insertions(+)
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/CellTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/ColCountTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/CustomTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/RowCountTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml
create mode 100644 zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml
(limited to 'zend/tests/Zend/Gdata/Spreadsheets')
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php b/zend/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php
new file mode 100644
index 0000000..84b2ca3
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php
@@ -0,0 +1,64 @@
+cellEntry = new Zend_Gdata_Spreadsheets_CellEntry();
+ }
+
+ public function testToAndFromString()
+ {
+ $this->cellEntry->setCell(new Zend_Gdata_Spreadsheets_Extension_Cell('my cell', '1', '2', 'input value', 'numeric value'));
+ $this->assertTrue($this->cellEntry->getCell()->getText() == 'my cell');
+ $this->assertTrue($this->cellEntry->getCell()->getRow() == '1');
+ $this->assertTrue($this->cellEntry->getCell()->getColumn() == '2');
+ $this->assertTrue($this->cellEntry->getCell()->getInputValue() == 'input value');
+ $this->assertTrue($this->cellEntry->getCell()->getNumericValue() == 'numeric value');
+
+ $newCellEntry = new Zend_Gdata_Spreadsheets_CellEntry();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->cellEntry->saveXML());
+ $newCellEntry->transferFromDom($doc->documentElement);
+
+ $this->assertTrue($this->cellEntry->getCell()->getText() == $newCellEntry->getCell()->getText());
+ $this->assertTrue($this->cellEntry->getCell()->getRow() == $newCellEntry->getCell()->getRow());
+ $this->assertTrue($this->cellEntry->getCell()->getColumn() == $newCellEntry->getCell()->getColumn());
+ $this->assertTrue($this->cellEntry->getCell()->getInputValue() == $newCellEntry->getCell()->getInputValue());
+ $this->assertTrue($this->cellEntry->getCell()->getNumericValue() == $newCellEntry->getCell()->getNumericValue());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php b/zend/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php
new file mode 100644
index 0000000..b6c804d
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php
@@ -0,0 +1,91 @@
+cellFeed = new Zend_Gdata_Spreadsheets_CellFeed(
+ file_get_contents('Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml', true),
+ true);
+ }
+
+ public function testToAndFromString()
+ {
+ $this->assertTrue(count($this->cellFeed->entries) == 2);
+ $this->assertTrue($this->cellFeed->entries->count() == 2);
+
+ foreach($this->cellFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry);
+ }
+ $this->assertTrue($this->cellFeed->getRowCount() instanceof Zend_Gdata_Spreadsheets_Extension_RowCount);
+ $this->assertTrue($this->cellFeed->getRowCount()->getText() == '100');
+ $this->assertTrue($this->cellFeed->getColumnCount() instanceof Zend_Gdata_Spreadsheets_Extension_ColCount);
+ $this->assertTrue($this->cellFeed->getColumnCount()->getText() == '20');
+
+ $newCellFeed = new Zend_Gdata_Spreadsheets_CellFeed();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->cellFeed->saveXML());
+ $newCellFeed->transferFromDom($doc->documentElement);
+
+ $this->assertTrue(count($newCellFeed->entries) == 2);
+ $this->assertTrue($newCellFeed->entries->count() == 2);
+
+ foreach($newCellFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry);
+ }
+ $this->assertTrue($newCellFeed->getRowCount() instanceof Zend_Gdata_Spreadsheets_Extension_RowCount);
+ $this->assertTrue($newCellFeed->getRowCount()->getText() == '100');
+ $this->assertTrue($newCellFeed->getColumnCount() instanceof Zend_Gdata_Spreadsheets_Extension_ColCount);
+ $this->assertTrue($newCellFeed->getColumnCount()->getText() == '20');
+ }
+
+ public function testGetSetCounts()
+ {
+ $newRowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
+ $newRowCount->setText("20");
+ $newColCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
+ $newColCount->setText("50");
+
+ $this->cellFeed->setRowCount($newRowCount);
+ $this->cellFeed->setColumnCount($newColCount);
+
+ $this->assertTrue($this->cellFeed->getRowCount()->getText() == "20");
+ $this->assertTrue($this->cellFeed->getColumnCount()->getText() == "50");
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php b/zend/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php
new file mode 100644
index 0000000..997c926
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php
@@ -0,0 +1,138 @@
+docQuery = new Zend_Gdata_Spreadsheets_CellQuery();
+ }
+
+ public function testMinRow()
+ {
+ $this->assertTrue($this->docQuery->getMinRow() == null);
+ $this->docQuery->setMinRow('1');
+ $this->assertTrue($this->docQuery->getMinRow() == '1');
+ $this->assertTrue($this->docQuery->getQueryString() == '?min-row=1');
+ $this->docQuery->setMinRow(null);
+ $this->assertTrue($this->docQuery->getMinRow() == null);
+ }
+
+ public function testMaxRow()
+ {
+ $this->assertTrue($this->docQuery->getMaxRow() == null);
+ $this->docQuery->setMaxRow('2');
+ $this->assertTrue($this->docQuery->getMaxRow() == '2');
+ $this->assertTrue($this->docQuery->getQueryString() == '?max-row=2');
+ $this->docQuery->setMaxRow(null);
+ $this->assertTrue($this->docQuery->getMaxRow() == null);
+ }
+
+ public function testMinCol()
+ {
+ $this->assertTrue($this->docQuery->getMinCol() == null);
+ $this->docQuery->setMinCol('3');
+ $this->assertTrue($this->docQuery->getMinCol() == '3');
+ $this->assertTrue($this->docQuery->getQueryString() == '?min-col=3');
+ $this->docQuery->setMinCol(null);
+ $this->assertTrue($this->docQuery->getMinCol() == null);
+ }
+
+ public function testMaxCol()
+ {
+ $this->assertTrue($this->docQuery->getMaxCol() == null);
+ $this->docQuery->setMaxCol('4');
+ $this->assertTrue($this->docQuery->getMaxCol() == '4');
+ $this->assertTrue($this->docQuery->getQueryString() == '?max-col=4');
+ $this->docQuery->setMaxCol(null);
+ $this->assertTrue($this->docQuery->getMaxCol() == null);
+ }
+
+ public function testRange()
+ {
+ $this->assertTrue($this->docQuery->getRange() == null);
+ $this->docQuery->setRange('A1:B4');
+ $this->assertTrue($this->docQuery->getRange() == 'A1:B4');
+ $this->assertTrue($this->docQuery->getQueryString() == '?range=A1%3AB4');
+ $this->docQuery->setRange(null);
+ $this->assertTrue($this->docQuery->getRange() == null);
+ }
+
+ public function testReturnEmpty()
+ {
+ $this->assertTrue($this->docQuery->getReturnEmpty() == null);
+ $this->docQuery->setReturnEmpty('false');
+ $this->assertTrue($this->docQuery->getReturnEmpty() == 'false');
+ $this->assertTrue($this->docQuery->getQueryString() == '?return-empty=false');
+ $this->docQuery->setReturnEmpty(null);
+ $this->assertTrue($this->docQuery->getReturnEmpty() == null);
+ }
+
+ public function testWorksheetId()
+ {
+ $this->assertTrue($this->docQuery->getWorksheetId() == 'default');
+ $this->docQuery->setWorksheetId('123');
+ $this->assertTrue($this->docQuery->getWorksheetId() == '123');
+ }
+
+ public function testSpreadsheetKey()
+ {
+ $this->assertTrue($this->docQuery->getSpreadsheetKey() == null);
+ $this->docQuery->setSpreadsheetKey('abc');
+ $this->assertTrue($this->docQuery->getSpreadsheetKey() == 'abc');
+ }
+
+ public function testCellId()
+ {
+ $this->assertTrue($this->docQuery->getCellId() == null);
+ $this->docQuery->setCellId('xyz');
+ $this->assertTrue($this->docQuery->getCellId() == 'xyz');
+ }
+
+ public function testProjection()
+ {
+ $this->assertTrue($this->docQuery->getProjection() == 'full');
+ $this->docQuery->setProjection('abc');
+ $this->assertTrue($this->docQuery->getProjection() == 'abc');
+ }
+
+ public function testVisibility()
+ {
+ $this->assertTrue($this->docQuery->getVisibility() == 'private');
+ $this->docQuery->setVisibility('xyz');
+ $this->assertTrue($this->docQuery->getVisibility() == 'xyz');
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/CellTest.php b/zend/tests/Zend/Gdata/Spreadsheets/CellTest.php
new file mode 100644
index 0000000..f743d15
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/CellTest.php
@@ -0,0 +1,67 @@
+cell = new Zend_Gdata_Spreadsheets_Extension_Cell();
+ }
+
+ public function testToAndFromString()
+ {
+ $this->cell->setText('test cell');
+ $this->assertTrue($this->cell->getText() == 'test cell');
+ $this->cell->setRow('1');
+ $this->assertTrue($this->cell->getRow() == '1');
+ $this->cell->setColumn('2');
+ $this->assertTrue($this->cell->getColumn() == '2');
+ $this->cell->setInputValue('test input value');
+ $this->assertTrue($this->cell->getInputValue() == 'test input value');
+ $this->cell->setNumericValue('test numeric value');
+ $this->assertTrue($this->cell->getNumericValue() == 'test numeric value');
+
+ $newCell = new Zend_Gdata_Spreadsheets_Extension_Cell();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->cell->saveXML());
+ $newCell->transferFromDom($doc->documentElement);
+ $this->assertTrue($this->cell->getText() == $newCell->getText());
+ $this->assertTrue($this->cell->getRow() == $newCell->getRow());
+ $this->assertTrue($this->cell->getColumn() == $newCell->getColumn());
+ $this->assertTrue($this->cell->getInputValue() == $newCell->getInputValue());
+ $this->assertTrue($this->cell->getNumericValue() == $newCell->getNumericValue());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/ColCountTest.php b/zend/tests/Zend/Gdata/Spreadsheets/ColCountTest.php
new file mode 100644
index 0000000..e54d10f
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/ColCountTest.php
@@ -0,0 +1,54 @@
+colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
+ }
+
+ public function testToAndFromString()
+ {
+ $this->colCount->setText('20');
+ $this->assertTrue($this->colCount->getText() == '20');
+ $newColCount = new Zend_Gdata_Spreadsheets_Extension_ColCount();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->colCount->saveXML());
+ $newColCount->transferFromDom($doc->documentElement);
+ $this->assertTrue($this->colCount->getText() == $newColCount->getText());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/CustomTest.php b/zend/tests/Zend/Gdata/Spreadsheets/CustomTest.php
new file mode 100644
index 0000000..73f06b6
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/CustomTest.php
@@ -0,0 +1,57 @@
+custom = new Zend_Gdata_Spreadsheets_Extension_Custom();
+ }
+
+ public function testToAndFromString()
+ {
+ $this->custom->setText('value');
+ $this->assertTrue($this->custom->getText() == 'value');
+ $this->custom->setColumnName('column_name');
+ $this->assertTrue($this->custom->getColumnName() == 'column_name');
+ $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->custom->saveXML());
+ $newCustom->transferFromDom($doc->documentElement);
+ $this->assertTrue($this->custom->getText() == $newCustom->getText());
+ $this->assertTrue($this->custom->getColumnName() == $newCustom->getColumnName());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php b/zend/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php
new file mode 100644
index 0000000..39016b7
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php
@@ -0,0 +1,91 @@
+docQuery = new Zend_Gdata_Spreadsheets_DocumentQuery();
+ }
+
+ public function testTitle()
+ {
+ $this->assertTrue($this->docQuery->getTitle() == null);
+ $this->docQuery->setTitle('test title');
+ $this->assertTrue($this->docQuery->getTitle() == 'test title');
+ $this->assertTrue($this->docQuery->getQueryString() == '?title=test+title');
+ $this->docQuery->setTitle(null);
+ $this->assertTrue($this->docQuery->getTitle() == null);
+ }
+
+ public function testTitleExact()
+ {
+ $this->assertTrue($this->docQuery->getTitleExact() == null);
+ $this->docQuery->setTitleExact('test title');
+ $this->assertTrue($this->docQuery->getTitleExact() == 'test title');
+ $this->assertTrue($this->docQuery->getQueryString() == '?title-exact=test+title');
+ $this->docQuery->setTitleExact(null);
+ $this->assertTrue($this->docQuery->getTitleExact() == null);
+ }
+
+ public function testWorksheetId()
+ {
+ $this->assertTrue($this->docQuery->getWorksheetId() == null);
+ $this->docQuery->setWorksheetId('123');
+ $this->assertTrue($this->docQuery->getWorksheetId() == '123');
+ }
+
+ public function testSpreadsheetKey()
+ {
+ $this->assertTrue($this->docQuery->getSpreadsheetKey() == null);
+ $this->docQuery->setSpreadsheetKey('abc');
+ $this->assertTrue($this->docQuery->getSpreadsheetKey() == 'abc');
+ }
+
+ public function testProjection()
+ {
+ $this->assertTrue($this->docQuery->getProjection() == 'full');
+ $this->docQuery->setProjection('abc');
+ $this->assertTrue($this->docQuery->getProjection() == 'abc');
+ }
+
+ public function testVisibility()
+ {
+ $this->assertTrue($this->docQuery->getVisibility() == 'private');
+ $this->docQuery->setVisibility('xyz');
+ $this->assertTrue($this->docQuery->getVisibility() == 'xyz');
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php b/zend/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php
new file mode 100644
index 0000000..1c3458e
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php
@@ -0,0 +1,225 @@
+listEntry = new Zend_Gdata_Spreadsheets_ListEntry();
+ $this->rowData = array();
+ $this->rowData[] = new Zend_Gdata_Spreadsheets_Extension_Custom(
+ 'column_1', 'value 1');
+ $this->rowData[] = new Zend_Gdata_Spreadsheets_Extension_Custom(
+ 'column_2', 'value 2');
+ }
+
+ public function testToAndFromString()
+ {
+ $this->listEntry->setCustom($this->rowData);
+ $rowDataOut = $this->listEntry->getCustom();
+
+ $this->assertEquals(count($this->rowData), count($rowDataOut));
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->assertEquals($this->rowData[$i]->getText(),
+ $rowDataOut[$i]->getText());
+ $this->assertEquals($this->rowData[$i]->getColumnName(),
+ $rowDataOut[$i]->getColumnName());
+ }
+
+ $newListEntry = new Zend_Gdata_Spreadsheets_ListEntry();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->listEntry->saveXML());
+ $newListEntry->transferFromDom($doc->documentElement);
+ $rowDataFromXML = $newListEntry->getCustom();
+
+ $this->assertEquals(count($this->rowData), count($rowDataFromXML));
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->assertEquals($this->rowData[$i]->getText(),
+ $rowDataFromXML[$i]->getText());
+ $this->assertEquals($this->rowData[$i]->getColumnName(),
+ $rowDataFromXML[$i]->getColumnName());
+ }
+ }
+
+ public function testCustomElementOrderingPreserved()
+ {
+ $this->listEntry->setCustom($this->rowData);
+
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->assertEquals($this->rowData[$i],
+ $this->listEntry->custom[$i]);
+ }
+ }
+
+ public function testCustomElementsCanBeRetrievedByName()
+ {
+ $this->listEntry->setCustom($this->rowData);
+
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->assertEquals($this->rowData[$i],
+ $this->listEntry->getCustomByName(
+ $this->rowData[$i]->getColumnName()));
+ }
+ }
+
+ public function testCustomElementsCanBeRetrievedByNameUsingArrayNotation()
+ {
+ $this->listEntry->setCustom($this->rowData);
+
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->assertEquals($this->rowData[$i],
+ $this->listEntry->getCustomByName(
+ $this->rowData[$i]->getColumnName()));
+ }
+ }
+
+ public function testCanAddIndividualCustomElements()
+ {
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->listEntry->addCustom($this->rowData[$i]);
+ }
+
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ for ($i = 0; $i < count($this->rowData); $i++) {
+ $this->assertEquals($this->rowData[$i],
+ $this->listEntry->custom[$i]);
+ }
+ }
+
+ public function testRetrievingNonexistantCustomElementReturnsNull()
+ {
+ $this->assertNull($this->listEntry->getCustomByName('nonexistant'));
+ }
+
+ public function testCanReplaceAllCustomElements()
+ {
+ $this->listEntry->setCustom($this->rowData);
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ $this->listEntry->setCustom(array());
+ $this->assertEquals(0, count($this->listEntry->getCustom()));
+ }
+
+ public function testCanDeleteCustomElementById()
+ {
+ $this->listEntry->setCustom($this->rowData);
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ $this->assertEquals($this->rowData[0], $this->listEntry->custom[0]);
+
+ $this->listEntry->removeCustom(0);
+ $this->assertEquals(count($this->rowData) - 1,
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ $this->assertEquals($this->rowData[1], $this->listEntry->custom[0]);
+ }
+
+ public function testCanDeleteCustomElementByName()
+ {
+ $this->listEntry->setCustom($this->rowData);
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ $this->assertEquals($this->rowData[0],
+ $this->listEntry->getCustomByName(
+ $this->rowData[0]->getColumnName()));
+
+ $this->listEntry->removeCustomByName('column_1');
+ $this->assertEquals(count($this->rowData) - 1,
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+ $this->assertNull($this->listEntry->getCustomByName(
+ $this->rowData[0]->getColumnName()));
+ }
+
+ public function testDeletingNonexistantElementByIdThrowsException()
+ {
+ $this->listEntry->setCustom($this->rowData);
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+
+ $exceptionCaught = false;
+ try {
+ $this->listEntry->removeCustom(9999);
+ } catch (Zend_Gdata_App_InvalidArgumentException $e) {
+ $exceptionCaught = true;
+ $this->assertEquals('Element does not exist.', $e->getMessage());
+ }
+ $this->assertTrue($exceptionCaught);
+ }
+
+ public function testDeletingNonexistantElementByNameThrowsException()
+ {
+ $this->listEntry->setCustom($this->rowData);
+ $this->assertEquals(count($this->rowData),
+ count($this->listEntry->getCustom()));
+ $this->assertEquals(count($this->listEntry->getCustom()),
+ count($this->listEntry->getCustomByName()));
+
+ $exceptionCaught = false;
+ try {
+ $this->listEntry->removeCustomByName('nonexistant');
+ } catch (Zend_Gdata_App_InvalidArgumentException $e) {
+ $exceptionCaught = true;
+ $this->assertEquals('Element does not exist.', $e->getMessage());
+ }
+ $this->assertTrue($exceptionCaught);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php b/zend/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php
new file mode 100644
index 0000000..8be5dd2
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php
@@ -0,0 +1,68 @@
+listFeed = new Zend_Gdata_Spreadsheets_ListFeed(
+ file_get_contents(dirname(__FILE__) . '/_files/TestDataListFeedSample1.xml'),
+ true);
+ }
+
+ public function testToAndFromString()
+ {
+ $this->assertTrue(count($this->listFeed->entries) == 2);
+ $this->assertTrue($this->listFeed->entries->count() == 2);
+ foreach($this->listFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry);
+ }
+
+ $newListFeed = new Zend_Gdata_Spreadsheets_ListFeed();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->listFeed->saveXML());
+ $newListFeed->transferFromDom($doc->documentElement);
+
+ $this->assertTrue(count($newListFeed->entries) == 2);
+ $this->assertTrue($newListFeed->entries->count() == 2);
+ foreach($newListFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry);
+ }
+
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php b/zend/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php
new file mode 100644
index 0000000..81fb405
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php
@@ -0,0 +1,109 @@
+docQuery = new Zend_Gdata_Spreadsheets_ListQuery();
+ }
+
+ public function testWorksheetId()
+ {
+ $this->assertTrue($this->docQuery->getWorksheetId() == 'default');
+ $this->docQuery->setWorksheetId('123');
+ $this->assertTrue($this->docQuery->getWorksheetId() == '123');
+ }
+
+ public function testSpreadsheetKey()
+ {
+ $this->assertTrue($this->docQuery->getSpreadsheetKey() == null);
+ $this->docQuery->setSpreadsheetKey('abc');
+ $this->assertTrue($this->docQuery->getSpreadsheetKey() == 'abc');
+ }
+
+ public function testRowId()
+ {
+ $this->assertTrue($this->docQuery->getRowId() == null);
+ $this->docQuery->setRowId('xyz');
+ $this->assertTrue($this->docQuery->getRowId() == 'xyz');
+ }
+
+ public function testProjection()
+ {
+ $this->assertTrue($this->docQuery->getProjection() == 'full');
+ $this->docQuery->setProjection('abc');
+ $this->assertTrue($this->docQuery->getProjection() == 'abc');
+ }
+
+ public function testVisibility()
+ {
+ $this->assertTrue($this->docQuery->getVisibility() == 'private');
+ $this->docQuery->setVisibility('xyz');
+ $this->assertTrue($this->docQuery->getVisibility() == 'xyz');
+ }
+
+ public function testSpreadsheetQuery()
+ {
+ $this->assertTrue($this->docQuery->getSpreadsheetQuery() == null);
+ $this->docQuery->setSpreadsheetQuery('first=john&last=smith');
+ $this->assertTrue($this->docQuery->getSpreadsheetQuery() == 'first=john&last=smith');
+ $this->assertTrue($this->docQuery->getQueryString() == '?sq=first%3Djohn%26last%3Dsmith');
+ $this->docQuery->setSpreadsheetQuery(null);
+ $this->assertTrue($this->docQuery->getSpreadsheetQuery() == null);
+ }
+
+
+ public function testOrderBy()
+ {
+ $this->assertTrue($this->docQuery->getOrderBy() == null);
+ $this->docQuery->setOrderBy('column:first');
+ $this->assertTrue($this->docQuery->getOrderBy() == 'column:first');
+ $this->assertTrue($this->docQuery->getQueryString() == '?orderby=column%3Afirst');
+ $this->docQuery->setOrderBy(null);
+ $this->assertTrue($this->docQuery->getOrderBy() == null);
+ }
+
+ public function testReverse()
+ {
+ $this->assertTrue($this->docQuery->getReverse() == null);
+ $this->docQuery->setReverse('true');
+ $this->assertTrue($this->docQuery->getReverse() == 'true');
+ $this->assertTrue($this->docQuery->getQueryString() == '?reverse=true');
+ $this->docQuery->setReverse(null);
+ $this->assertTrue($this->docQuery->getReverse() == null);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/RowCountTest.php b/zend/tests/Zend/Gdata/Spreadsheets/RowCountTest.php
new file mode 100644
index 0000000..822eb10
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/RowCountTest.php
@@ -0,0 +1,54 @@
+rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
+ }
+
+ public function testToAndFromString()
+ {
+ $this->rowCount->setText('20');
+ $this->assertTrue($this->rowCount->getText() == '20');
+ $newRowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->rowCount->saveXML());
+ $newRowCount->transferFromDom($doc->documentElement);
+ $this->assertTrue($this->rowCount->getText() == $newRowCount->getText());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php b/zend/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php
new file mode 100644
index 0000000..d715326
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php
@@ -0,0 +1,65 @@
+sprFeed = new Zend_Gdata_Spreadsheets_SpreadsheetFeed(
+ file_get_contents(dirname(__FILE__) . '/_files/TestDataSpreadsheetFeedSample1.xml'),
+ true);
+ }
+
+ public function testToAndFromString()
+ {
+ $this->assertTrue(count($this->sprFeed->entries) == 1);
+ foreach($this->sprFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry);
+ }
+
+ $newSprFeed = new Zend_Gdata_Spreadsheets_SpreadsheetFeed();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->sprFeed->saveXML());
+ $newSprFeed->transferFromDom($doc->documentElement);
+
+ $this->assertTrue(count($newSprFeed->entries) == 1);
+ foreach($newSprFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry);
+ }
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php b/zend/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php
new file mode 100644
index 0000000..69d5aab
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php
@@ -0,0 +1,57 @@
+wksEntry = new Zend_Gdata_Spreadsheets_WorksheetEntry();
+ }
+
+ public function testToAndFromString()
+ {
+ $this->wksEntry->setRowCount(new Zend_Gdata_Spreadsheets_Extension_RowCount('20'));
+ $this->assertTrue($this->wksEntry->getRowCount()->getText() == '20');
+ $this->wksEntry->setColumnCount(new Zend_Gdata_Spreadsheets_Extension_ColCount('40'));
+ $this->assertTrue($this->wksEntry->getColumnCount()->getText() == '40');
+ $newWksEntry = new Zend_Gdata_Spreadsheets_WorksheetEntry();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->wksEntry->saveXML());
+ $newWksEntry->transferFromDom($doc->documentElement);
+ $this->assertTrue($this->wksEntry->getRowCount()->getText() == $newWksEntry->getRowCount()->getText());
+ $this->assertTrue($this->wksEntry->getColumnCount()->getText() == $newWksEntry->getColumnCount()->getText());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php b/zend/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php
new file mode 100644
index 0000000..8a26f6a
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php
@@ -0,0 +1,65 @@
+wksFeed = new Zend_Gdata_Spreadsheets_WorksheetFeed(
+ file_get_contents(dirname(__FILE__) . '/_files/TestDataWorksheetFeedSample1.xml'),
+ true);
+ }
+
+ public function testToAndFromString()
+ {
+ $this->assertTrue(count($this->wksFeed->entries) == 1);
+ foreach($this->wksFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_WorksheetEntry);
+ }
+
+ $newWksFeed = new Zend_Gdata_Spreadsheets_WorksheetFeed();
+ $doc = new DOMDocument();
+ $doc->loadXML($this->wksFeed->saveXML());
+ $newWksFeed->transferFromDom($doc->documentElement);
+
+ $this->assertTrue(count($newWksFeed->entries) == 1);
+ foreach($newWksFeed->entries as $entry)
+ {
+ $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_WorksheetEntry);
+ }
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml
new file mode 100644
index 0000000..e40a0c3
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml
@@ -0,0 +1,49 @@
+
+ http://spreadsheets.google.com/feeds/cells/key/od6/private/full
+ 2006-11-17T18:27:32.543Z
+ Sheet1
+
+
+
+
+
+ Fitzwilliam Darcy
+ fitz@gmail.com
+
+ 1
+ 1
+ 100
+ 20
+
+ http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C1
+ 2006-11-17T18:27:32.543Z
+
+ A1
+ Name
+
+
+ Name
+
+
+ http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C2
+ 2006-11-17T18:27:32.543Z
+
+ B1
+ Hours
+
+
+ Hours
+
+
\ No newline at end of file
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml
new file mode 100644
index 0000000..1f8212b
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml
@@ -0,0 +1,56 @@
+
+ http://spreadsheets.google.com/feeds/list/key/od6/private/full
+ 2006-11-17T18:23:45.173Z
+ Sheet1
+
+
+
+
+
+ Fitzwilliam Darcy
+ fitz@gmail.com
+
+ 2
+ 1
+ 2
+
+ http://spreadsheets.google.com/feeds/list/key/od6/private/full/cokwr
+ 2006-11-17T18:23:45.173Z
+
+ Bingley
+ Hours: 10, Items: 2, IPM: 0.0033
+
+
+ Bingley
+ 10
+ 2
+ 0.0033
+
+
+ http://spreadsheets.google.com/feeds/list/key/od6/private/full/cyevm
+ 2006-11-17T18:23:45.173Z
+
+ Charlotte
+ Hours: 60, Items: 18000, IPM: 5
+
+
+ Charlotte
+ 60
+ 18000
+ 5
+
+
\ No newline at end of file
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml
new file mode 100644
index 0000000..b069efc
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml
@@ -0,0 +1,38 @@
+
+ http://spreadsheets.google.com/feeds/spreadsheets/private/full
+ 2006-11-17T18:23:45.173Z
+ Available Spreadsheets
+
+
+
+
+ Fitzwilliam Darcy
+ fitz@gmail.com
+
+ 1
+ 1
+ 1
+
+ http://spreadsheets.google.com/feeds/spreadsheets/private/full/key
+ 2006-11-17T18:24:18.231Z
+ Groceries R Us
+ Groceries R Us
+
+
+
+
+ Fitzwilliam Darcy
+ fitz@gmail.com
+
+
+
\ No newline at end of file
diff --git a/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml
new file mode 100644
index 0000000..d86afca
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml
@@ -0,0 +1,37 @@
+
+ http://spreadsheets.google.com/feeds/worksheets/key/private/full
+ 2006-11-17T18:23:45.173Z
+ Groceries R Us
+
+
+
+
+ Fitzwilliam Darcy
+ fitz@gmail.com
+
+ 1
+ 1
+ 1
+
+ http://spreadsheets.google.com/feeds/worksheets/key/private/full/od6
+ 2006-11-17T18:23:45.173Z
+ Sheet1
+ Sheet1
+
+
+
+ 100
+ 20
+
+
\ No newline at end of file
--
cgit v1.2.3