AccountFeedTest.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_Analytics
  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/Analytics.php';
  23. require_once 'Zend/Http/Client.php';
  24. /**
  25. * @category Zend
  26. * @package Zend_Gdata_Analytics
  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_Analytics
  32. */
  33. class Zend_Gdata_Analytics_AccountFeedTest extends PHPUnit_Framework_TestCase
  34. {
  35. /** @var AccountFeed */
  36. public $accountFeed;
  37. public function setUp()
  38. {
  39. $this->accountFeed = new Zend_Gdata_Analytics_AccountFeed(
  40. file_get_contents(dirname(__FILE__) . '/_files/TestAccountFeed.xml')
  41. );
  42. }
  43. public function testAccountFeed()
  44. {
  45. $this->assertEquals(2, count($this->accountFeed->entries));
  46. foreach ($this->accountFeed->entries as $entry) {
  47. $this->assertInstanceOf('Zend_Gdata_Analytics_AccountEntry', $entry);
  48. }
  49. }
  50. public function testFirstAccountProperties()
  51. {
  52. $account = $this->accountFeed->entries[0];
  53. $this->assertEquals(876543, "{$account->accountId}");
  54. $this->assertEquals('foobarbaz', "{$account->accountName}");
  55. $this->assertInstanceOf('Zend_GData_App_Extension_Link', $account->link[0]);
  56. }
  57. public function testSecondAccountProperties()
  58. {
  59. $account = $this->accountFeed->entries[1];
  60. $this->assertEquals(23456789, "{$account->accountId}");
  61. $this->assertEquals('brain dump', "{$account->accountName}");
  62. $this->assertInstanceOf('Zend_GData_App_Extension_Link', $account->link[0]);
  63. }
  64. }