summaryrefslogtreecommitdiff
path: root/zend/tests/Zend/Gdata/Spreadsheets
diff options
context:
space:
mode:
authorHorus32014-02-24 16:42:14 +0100
committerHorus32014-02-24 16:42:14 +0100
commit06f945f27840b53e57795dadbc38e76f7e11ab1c (patch)
tree689d5c7f4ffa15460c7e90f47c6a7dd59ce4e8bd /zend/tests/Zend/Gdata/Spreadsheets
downloadrandom-06f945f27840b53e57795dadbc38e76f7e11ab1c.tar.gz
init
Diffstat (limited to 'zend/tests/Zend/Gdata/Spreadsheets')
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php64
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php91
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php138
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/CellTest.php67
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/ColCountTest.php54
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/CustomTest.php57
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php91
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php225
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php68
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/RowCountTest.php54
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php65
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php57
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php65
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml49
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml56
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml38
-rw-r--r--zend/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml37
18 files changed, 1385 insertions, 0 deletions
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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_CellEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_CellFeedTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_CellQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_CellTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_ColCountTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_CustomTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_DocumentQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_ListEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_ListFeedTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_ListQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_RowCountTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_SpreadsheetFeedTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_WorksheetEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id $
+ */
+
+require_once 'Zend/Gdata/Spreadsheets.php';
+require_once 'Zend/Http/Client.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Spreadsheets
+ * @subpackage UnitTests
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @group Zend_Gdata
+ * @group Zend_Gdata_Spreadsheets
+ */
+class Zend_Gdata_Spreadsheets_WorksheetFeedTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->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 @@
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gs="http://schemas.google.com/spreadsheets/2006">
+ <id>http://spreadsheets.google.com/feeds/cells/key/od6/private/full</id>
+ <updated>2006-11-17T18:27:32.543Z</updated>
+ <title type="text">Sheet1</title>
+ <link rel="alternate" type="text/html"
+ href="http://spreadsheets.google.com/ccc?key=key"/>
+ <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full"/>
+ <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full"/>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full"/>
+ <author>
+ <name>Fitzwilliam Darcy</name>
+ <email>fitz@gmail.com</email>
+ </author>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <openSearch:itemsPerPage>1</openSearch:itemsPerPage>
+ <gs:rowCount>100</gs:rowCount>
+ <gs:colCount>20</gs:colCount>
+ <entry>
+ <id>http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C1</id>
+ <updated>2006-11-17T18:27:32.543Z</updated>
+ <category scheme="http://schemas.google.com/spreadsheets/2006"
+ term="http://schemas.google.com/spreadsheets/2006#cell"/>
+ <title type="text">A1</title>
+ <content type="text">Name</content>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C1"/>
+ <link rel="edit" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C1/bgvjf"/>
+ <gs:cell row="1" col="1" inputValue="Name">Name</gs:cell>
+ </entry>
+ <entry>
+ <id>http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C2</id>
+ <updated>2006-11-17T18:27:32.543Z</updated>
+ <category scheme="http://schemas.google.com/spreadsheets/2006"
+ term="http://schemas.google.com/spreadsheets/2006#cell"/>
+ <title type="text">B1</title>
+ <content type="text">Hours</content>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C2"/>
+ <link rel="edit" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full/R1C2/1pn567"/>
+ <gs:cell row="1" col="2" inputValue="Hours">Hours</gs:cell>
+ </entry>
+</feed> \ 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 @@
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended">
+ <id>http://spreadsheets.google.com/feeds/list/key/od6/private/full</id>
+ <updated>2006-11-17T18:23:45.173Z</updated>
+ <title type="text">Sheet1</title>
+ <link rel="alternate" type="text/html"
+ href="http://spreadsheets.google.com/ccc?key=key"/>
+ <link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full"/>
+ <link rel="http://schemas.google.com/g/2005#post"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full"/>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full"/>
+ <author>
+ <name>Fitzwilliam Darcy</name>
+ <email>fitz@gmail.com</email>
+ </author>
+ <openSearch:totalResults>2</openSearch:totalResults>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <openSearch:itemsPerPage>2</openSearch:itemsPerPage>
+ <entry>
+ <id>http://spreadsheets.google.com/feeds/list/key/od6/private/full/cokwr</id>
+ <updated>2006-11-17T18:23:45.173Z</updated>
+ <category scheme="http://schemas.google.com/spreadsheets/2006"
+ term="http://schemas.google.com/spreadsheets/2006#list"/>
+ <title type="text">Bingley</title>
+ <content type="text">Hours: 10, Items: 2, IPM: 0.0033</content>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full/cokwr"/>
+ <link rel="edit" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full/cokwr/2ehkc2oh7d"/>
+ <gsx:name>Bingley</gsx:name>
+ <gsx:hours>10</gsx:hours>
+ <gsx:items>2</gsx:items>
+ <gsx:ipm>0.0033</gsx:ipm>
+ </entry>
+ <entry>
+ <id>http://spreadsheets.google.com/feeds/list/key/od6/private/full/cyevm</id>
+ <updated>2006-11-17T18:23:45.173Z</updated>
+ <category scheme="http://schemas.google.com/spreadsheets/2006"
+ term="http://schemas.google.com/spreadsheets/2006#list"/>
+ <title type="text">Charlotte</title>
+ <content type="text">Hours: 60, Items: 18000, IPM: 5</content>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full/cyevm"/>
+ <link rel="edit" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full/cyevm/64rl27px3zyn"/>
+ <gsx:name>Charlotte</gsx:name>
+ <gsx:hours>60</gsx:hours>
+ <gsx:items>18000</gsx:items>
+ <gsx:ipm>5</gsx:ipm>
+ </entry>
+</feed> \ 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 @@
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gs="http://schemas.google.com/spreadsheets/2006">
+ <id>http://spreadsheets.google.com/feeds/spreadsheets/private/full</id>
+ <updated>2006-11-17T18:23:45.173Z</updated>
+ <title type="text">Available Spreadsheets</title>
+ <link rel="alternate" type="text/html"
+ href="http://spreadsheets.google.com/ccc?key=key"/>
+ <link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/worksheets/key/private/full"/>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/worksheets/key/private/full"/>
+ <author>
+ <name>Fitzwilliam Darcy</name>
+ <email>fitz@gmail.com</email>
+ </author>
+ <openSearch:totalResults>1</openSearch:totalResults>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <openSearch:itemsPerPage>1</openSearch:itemsPerPage>
+ <entry>
+ <id>http://spreadsheets.google.com/feeds/spreadsheets/private/full/key</id>
+ <updated>2006-11-17T18:24:18.231Z</updated>
+ <title type="text">Groceries R Us</title>
+ <content type="text">Groceries R Us</content>
+ <link rel="http://schemas.google.com/spreadsheets/2006#worksheetsfeed"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/worksheets/key/private/full"/>
+ <link rel="alternate" type="text/html"
+ href="http://spreadsheets.google.com/ccc?key=key"/>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/spreadsheets/private/full/key"/>
+ <author>
+ <name>Fitzwilliam Darcy</name>
+ <email>fitz@gmail.com</email>
+ </author>
+ </entry>
+</feed> \ 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 @@
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gs="http://schemas.google.com/spreadsheets/2006">
+ <id>http://spreadsheets.google.com/feeds/worksheets/key/private/full</id>
+ <updated>2006-11-17T18:23:45.173Z</updated>
+ <title type="text">Groceries R Us</title>
+ <link rel="alternate" type="text/html"
+ href="http://spreadsheets.google.com/ccc?key=key"/>
+ <link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/worksheets/key/private/full"/>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/worksheets/key/private/full"/>
+ <author>
+ <name>Fitzwilliam Darcy</name>
+ <email>fitz@gmail.com</email>
+ </author>
+ <openSearch:totalResults>1</openSearch:totalResults>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <openSearch:itemsPerPage>1</openSearch:itemsPerPage>
+ <entry>
+ <id>http://spreadsheets.google.com/feeds/worksheets/key/private/full/od6</id>
+ <updated>2006-11-17T18:23:45.173Z</updated>
+ <title type="text">Sheet1</title>
+ <content type="text">Sheet1</content>
+ <link rel="http://schemas.google.com/spreadsheets/2006#listfeed"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/list/key/od6/private/full"/>
+ <link rel="http://schemas.google.com/spreadsheets/2006#cellsfeed"
+ type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/cells/key/od6/private/full"/>
+ <link rel="self" type="application/atom+xml"
+ href="http://spreadsheets.google.com/feeds/worksheets/key/private/full/od6"/>
+ <gs:rowCount>100</gs:rowCount>
+ <gs:colCount>20</gs:colCount>
+ </entry>
+</feed> \ No newline at end of file