2
0

ListFeedTest.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata_Spreadsheets
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id $
  21. */
  22. require_once 'Zend/Gdata/Spreadsheets.php';
  23. require_once 'Zend/Http/Client.php';
  24. /**
  25. * @category Zend
  26. * @package Zend_Gdata_Spreadsheets
  27. * @subpackage UnitTests
  28. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. * @group Zend_Gdata
  31. * @group Zend_Gdata_Spreadsheets
  32. */
  33. class Zend_Gdata_Spreadsheets_ListFeedTest extends PHPUnit_Framework_TestCase
  34. {
  35. public function setUp()
  36. {
  37. $this->listFeed = new Zend_Gdata_Spreadsheets_ListFeed(
  38. file_get_contents(dirname(__FILE__) . '/_files/TestDataListFeedSample1.xml'),
  39. true);
  40. }
  41. public function testToAndFromString()
  42. {
  43. $this->assertTrue(count($this->listFeed->entries) == 2);
  44. $this->assertTrue($this->listFeed->entries->count() == 2);
  45. foreach($this->listFeed->entries as $entry)
  46. {
  47. $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry);
  48. }
  49. $newListFeed = new Zend_Gdata_Spreadsheets_ListFeed();
  50. $doc = new DOMDocument();
  51. $doc->loadXML($this->listFeed->saveXML());
  52. $newListFeed->transferFromDom($doc->documentElement);
  53. $this->assertTrue(count($newListFeed->entries) == 2);
  54. $this->assertTrue($newListFeed->entries->count() == 2);
  55. foreach($newListFeed->entries as $entry)
  56. {
  57. $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry);
  58. }
  59. }
  60. }