diff --git a/CHANGELOG.md b/CHANGELOG.md index e4ebc2cfa..e4db13d1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -179,8 +179,6 @@ - php 7.2 compatibility fixes - zend-filter - fix auto-loading compress adapters -- zend-gdata - - fix constructing GData-Version header - zend-loader - zend-loader and autoloader overhaul - ensure full compatibility with composer autoloader @@ -221,8 +219,6 @@ + portability fixes for loading xml files in tests - zend-timesync - fix microtime() usage -- zend-tool - - php 7.2 compatibility fixes - zend-validate - idn_to_ascii: use INTL_IDNA_VARIANT_UTS46 contant, if available + file size calculation fixed for php 7.x diff --git a/README.orig.md b/README.orig.md index 66d3d6bba..1190f1048 100644 --- a/README.orig.md +++ b/README.orig.md @@ -89,19 +89,6 @@ Microsoft (Mpns). Zend_Mobile_Push was contributed by Mike Willbanks. -Zend_Gdata_Analytics --------------------- - -Zend_Gdata_Analytics is an extension to Zend_Gdata to allow interaction -with Google’s Analytics Data Export API. This extension does not -encompass any major changes in the overall operation of Zend_Gdata -components. - -Zend_Gdata_Analytics was contributed by Daniel Hartmann. - -Removed features -================ - Zend_Http_UserAgent_Features_Adapter_WurflApi --------------------------------------------- diff --git a/composer.json b/composer.json index a205ba4f0..0b1802121 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,6 @@ "Zend_File_Transfer": "packages/zend-file-transfer/library/", "Zend_Filter": "packages/zend-filter/library/", "Zend_Form": "packages/zend-form/library/", - "Zend_Gdata": "packages/zend-gdata/library/", "Zend_Http": "packages/zend-http/library/", "Zend_Json": "packages/zend-json/library/", "Zend_Layout": "packages/zend-layout/library/", @@ -103,7 +102,6 @@ "Zend_Test": "packages/zend-test/library/", "Zend_Text": "packages/zend-text/library/", "Zend_TimeSync": "packages/zend-timesync/library/", - "Zend_Tool": "packages/zend-tool/library/", "Zend_Translate": "packages/zend-translate/library/", "Zend_Uri": "packages/zend-uri/library/", "Zend_Validate": "packages/zend-validate/library/", @@ -141,7 +139,6 @@ "zf1s/zend-file-transfer": "self.version", "zf1s/zend-filter": "self.version", "zf1s/zend-form": "self.version", - "zf1s/zend-gdata": "self.version", "zf1s/zend-http": "self.version", "zf1s/zend-json": "self.version", "zf1s/zend-layout": "self.version", @@ -191,7 +188,6 @@ "zf1s/zend-test": "self.version", "zf1s/zend-text": "self.version", "zf1s/zend-timesync": "self.version", - "zf1s/zend-tool": "self.version", "zf1s/zend-translate": "self.version", "zf1s/zend-uri": "self.version", "zf1s/zend-validate": "self.version", diff --git a/packages/zend-gdata/LICENSE.txt b/packages/zend-gdata/LICENSE.txt deleted file mode 100644 index 6eab5aa14..000000000 --- a/packages/zend-gdata/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Zend Technologies USA, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/zend-gdata/README.md b/packages/zend-gdata/README.md deleted file mode 100644 index 1bce2236d..000000000 --- a/packages/zend-gdata/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# zend-gdata (Zend Framework 1) - -This package is a part of the Zend Framework 1. Each component was separated and put into its own composer package. -**PHP 5.3-8.0** compatible. - -- [Report issues](https://github.com/zf1s/zf1/issues) and - [send Pull Requests](https://github.com/zf1s/zf1/pulls) - in the [main repository](https://github.com/zf1s/zf1) -- This package can also be found at [Packagist](http://packagist.org/packages/zf1s). - -## Installation - -``` -composer require zf1s/zend-gdata -``` - -## Resources - -- [Main Repository](https://github.com/zf1s/zf1) -- [Original documentation](https://framework.zend.com/manual/1.12/en/manual.html) -- [Changelog](https://github.com/zf1s/zf1/blob/master/CHANGELOG.md) diff --git a/packages/zend-gdata/composer.json b/packages/zend-gdata/composer.json deleted file mode 100644 index 0bf846963..000000000 --- a/packages/zend-gdata/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "zf1s/zend-gdata", - "description": "Zend Framework 1 Gdata package", - "keywords": ["framework", "zf1", "zend", "gdata"], - "homepage": "http://framework.zend.com/", - "license": "BSD-3-Clause", - "require": { - "jworman/polyfill-php81": "^1.25", - "php": ">=5.3.3", - "ext-ctype": "*", - "ext-dom": "*", - "zf1s/zend-exception": "^1.14.0", - "zf1s/zend-http": "^1.14.0", - "zf1s/zend-mime": "^1.14.0", - "zf1s/zend-version": "^1.14.0", - "zf1s/zend-xml": "^1.14.0", - "symfony/polyfill-php70": "^1.19" - }, - "autoload": { - "psr-0": { - "Zend_Gdata": "library/" - } - }, - "suggest": { - "zf1s/zend-loader": "Used in special situations or with special adapters" - }, - "replace": { - "zf1/zend-gdata": "^1.12" - }, - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata.php b/packages/zend-gdata/library/Zend/Gdata.php deleted file mode 100644 index 68b850b30..000000000 --- a/packages/zend-gdata/library/Zend/Gdata.php +++ /dev/null @@ -1,245 +0,0 @@ -decodeRequest('GET', $uri); - $response = $app->performHttpRequest($requestData['method'], $requestData['url']); - - $feedContent = $response->getBody(); - - $feed = self::importString($feedContent, $className); - if (null != $client) { - $feed->setHttpClient($client); - } - - return $feed; - } - - /** - * Retrieve feed as string or object. - * - * @param mixed $location The location as string or Zend_Gdata_Query - * @param string $className The class type to use for returning the feed - * - * @return string|Zend_Gdata_App_Feed returns string only if the object - * mapping has been disabled explicitly - * by passing false to the - * useObjectMapping() function - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getFeed($location, $className = 'Zend_Gdata_Feed') - { - if (is_string($location)) { - $uri = $location; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You must specify the location as either a string URI or a child of Zend_Gdata_Query'); - } - - return parent::getFeed($uri, $className); - } - - /** - * Retrieve entry as string or object. - * - * @param mixed $location The location as string or Zend_Gdata_Query - * - * @return string|Zend_Gdata_App_Entry returns string only if the object - * mapping has been disabled explicitly - * by passing false to the - * useObjectMapping() function - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getEntry($location, $className = 'Zend_Gdata_Entry') - { - if (is_string($location)) { - $uri = $location; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You must specify the location as either a string URI or a child of Zend_Gdata_Query'); - } - - return parent::getEntry($uri, $className); - } - - /** - * Performs a HTTP request using the specified method. - * - * Overrides the definition in the parent (Zend_Gdata_App) - * and uses the Zend_Gdata_HttpClient functionality - * to filter the HTTP requests and responses. - * - * @param string $method The HTTP method for the request - - * 'GET', 'POST', 'PUT', 'DELETE' - * @param string $url The URL to which this request is being performed, - * or null if found in $data - * @param array $headers An associative array of HTTP headers - * for this request - * @param string $body The body of the HTTP request - * @param string $contentType The value for the content type of the - * request body - * @param int $remainingRedirects Number of redirects to follow - * if requests results in one - * - * @return Zend_Http_Response The response object - */ - public function performHttpRequest($method, $url, $headers = [], $body = null, $contentType = null, $remainingRedirects = null) - { - if ($this->_httpClient instanceof Zend_Gdata_HttpClient) { - $filterResult = $this->_httpClient->filterHttpRequest($method, $url, $headers, $body, $contentType); - $method = $filterResult['method']; - $url = $filterResult['url']; - $body = $filterResult['body']; - $headers = $filterResult['headers']; - $contentType = $filterResult['contentType']; - - return $this->_httpClient->filterHttpResponse(parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects)); - } else { - return parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects); - } - } - - /** - * Determines whether service object is authenticated. - * - * @return bool true if service object is authenticated, false otherwise - */ - public function isAuthenticated() - { - $client = parent::getHttpClient(); - if ($client->getClientLoginToken() - || $client->getAuthSubToken()) { - return true; - } - - return false; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics.php b/packages/zend-gdata/library/Zend/Gdata/Analytics.php deleted file mode 100644 index 879bf5032..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics.php +++ /dev/null @@ -1,138 +0,0 @@ -registerPackage('Zend_Gdata_Analytics'); - $this->registerPackage('Zend_Gdata_Analytics_Extension'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - } - - /** - * Retrieve account feed object. - * - * @param string|Zend_Uri_Uri $uri - * - * @return string|Zend_Gdata_App_Feed - */ - public function getAccountFeed($uri = self::ANALYTICS_ACCOUNT_FEED_URI) - { - if ($uri instanceof Query) { - $uri = $uri->getQueryUrl(); - } - - return parent::getFeed($uri, 'Zend_Gdata_Analytics_AccountFeed'); - } - - /** - * Retrieve data feed object. - * - * @param string|Zend_Uri_Uri $uri - * - * @return string|Zend_Gdata_App_Feed - */ - public function getDataFeed($uri = self::ANALYTICS_FEED_URI) - { - if ($uri instanceof Query) { - $uri = $uri->getQueryUrl(); - } - - return parent::getFeed($uri, 'Zend_Gdata_Analytics_DataFeed'); - } - - /** - * Returns a new DataQuery object. - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function newDataQuery() - { - return new Zend_Gdata_Analytics_DataQuery(); - } - - /** - * Returns a new AccountQuery object. - * - * @return Zend_Gdata_Analytics_AccountQuery - */ - public function newAccountQuery() - { - return new Zend_Gdata_Analytics_AccountQuery(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountEntry.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountEntry.php deleted file mode 100644 index 2e676eaa0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountEntry.php +++ /dev/null @@ -1,101 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct($element); - } - - /** - * @param DOMElement $child - * - * @return void - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('analytics').':property': - $property = new Zend_Gdata_Analytics_Extension_Property(); - $property->transferFromDOM($child); - $this->{$property->getName()} = $property; - break; - case $this->lookupNamespace('analytics').':tableId': - $tableId = new Zend_Gdata_Analytics_Extension_TableId(); - $tableId->transferFromDOM($child); - $this->_tableId = $tableId; - break; - case $this->lookupNamespace('ga').':goal': - $goal = new Zend_Gdata_Analytics_Extension_Goal(); - $goal->transferFromDOM($child); - $this->_goal = $goal; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountFeed.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountFeed.php deleted file mode 100644 index 937694108..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountFeed.php +++ /dev/null @@ -1,55 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountQuery.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountQuery.php deleted file mode 100644 index 244703586..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/AccountQuery.php +++ /dev/null @@ -1,201 +0,0 @@ -_accountId = $accountId; - - return $this; - } - - /** - * @return string - */ - public function getAccountId() - { - return $this->_accountId; - } - - /** - * @param string $webpropertyId - * - * @return Zend_Gdata_Analytics_AccountQuery - */ - public function setWebpropertyId($webpropertyId) - { - $this->_webpropertyId = $webpropertyId; - - return $this; - } - - /** - * @return string - */ - public function getWebpropertyId() - { - return $this->_webpropertyId; - } - - /** - * @param string $profileId - * - * @return Zend_Gdata_Analytics_AccountQuery - */ - public function setProfileId($profileId) - { - $this->_profileId = $profileId; - - return $this; - } - - /** - * @return string - */ - public function getProfileId() - { - return $this->_profileId; - } - - /** - * @param string $accountId - * - * @return Zend_Gdata_Analytics_AccountQuery - */ - public function webproperties($accountId = '~all') - { - $this->_webproperties = true; - $this->setAccountId($accountId); - - return $this; - } - - /** - * @param string $webpropertyId - * @param string $accountId - * - * @return Zend_Gdata_Analytics_AccountQuery - */ - public function profiles($webpropertyId = '~all', $accountId = '~all') - { - $this->_profiles = true; - if (null !== $accountId) { - $this->setAccountId($accountId); - } - $this->setWebpropertyId($webpropertyId); - - return $this; - } - - /** - * @param string $webpropertyId - * @param string $accountId - * @param string $accountId - * - * @return Zend_Gdata_Analytics_AccountQuery - */ - public function goals($profileId = '~all', $webpropertyId = '~all', $accountId = '~all') - { - $this->_goals = true; - if (null !== $accountId) { - $this->setAccountId($accountId); - } - if (null !== $webpropertyId) { - $this->setWebpropertyId($webpropertyId); - } - $this->setProfileId($profileId); - - return $this; - } - - /** - * @return string url - */ - public function getQueryUrl() - { - $url = $this->_defaultFeedUri; - - // add account id - if ($this->_webproperties or $this->_profiles or $this->_goals) { - $url .= '/'.$this->_accountId.'/webproperties'; - } - - if ($this->_profiles or $this->_goals) { - $url .= '/'.$this->_webpropertyId.'/profiles'; - } - - if ($this->_goals) { - $url .= '/'.$this->_profileId.'/goals'; - } - - $url .= $this->getQueryString(); - - return $url; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/DataEntry.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/DataEntry.php deleted file mode 100644 index 4978421b6..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/DataEntry.php +++ /dev/null @@ -1,115 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct($element); - } - - /** - * @param DOMElement $child - * - * @return void - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('analytics').':dimension': - $dimension = new Zend_Gdata_Analytics_Extension_Dimension(); - $dimension->transferFromDOM($child); - $this->_dimensions[] = $dimension; - break; - case $this->lookupNamespace('analytics').':metric': - $metric = new Zend_Gdata_Analytics_Extension_Metric(); - $metric->transferFromDOM($child); - $this->_metrics[] = $metric; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * @param string $name - */ - public function getDimension($name) - { - foreach ($this->_dimensions as $dimension) { - if ($dimension->getName() == $name) { - return $dimension; - } - } - - return null; - } - - /** - * @param string $name - */ - public function getMetric($name) - { - foreach ($this->_metrics as $metric) { - if ($metric->getName() == $name) { - return $metric; - } - } - - return null; - } - - /** - * @param string $name - */ - public function getValue($name) - { - if (null !== ($metric = $this->getMetric($name))) { - return $metric; - } - - return $this->getDimension($name); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/DataFeed.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/DataFeed.php deleted file mode 100644 index 6dbbbdea2..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/DataFeed.php +++ /dev/null @@ -1,61 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/DataQuery.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/DataQuery.php deleted file mode 100644 index 2a956e325..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/DataQuery.php +++ /dev/null @@ -1,424 +0,0 @@ -'; - public const LESS = '>'; - public const GREATER_EQUAL = '>='; - public const LESS_EQUAL = '<='; - public const CONTAINS = '=@'; - public const CONTAINS_NOT = '!@'; - public const REGULAR = '=~'; - public const REGULAR_NOT = '!~'; - - /** - * @var string - */ - protected $_profileId; - /** - * @var array - */ - protected $_dimensions = []; - /** - * @var array - */ - protected $_metrics = []; - /** - * @var array - */ - protected $_sort = []; - /** - * @var array - */ - protected $_filters = []; - - /** - * @param string $id - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function setProfileId($id) - { - $this->_profileId = $id; - - return $this; - } - - /** - * @return string - */ - public function getProfileId() - { - return $this->_profileId; - } - - /** - * @param string $dimension - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function addDimension($dimension) - { - $this->_dimensions[$dimension] = true; - - return $this; - } - - /** - * @param string $metric - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function addMetric($metric) - { - $this->_metrics[$metric] = true; - - return $this; - } - - /** - * @return array - */ - public function getDimensions() - { - return $this->_dimensions; - } - - /** - * @return array - */ - public function getMetrics() - { - return $this->_metrics; - } - - /** - * @param string $dimension - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function removeDimension($dimension) - { - unset($this->_dimensions[$dimension]); - - return $this; - } - - /** - * @param string $metric - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function removeMetric($metric) - { - unset($this->_metrics[$metric]); - - return $this; - } - - /** - * @return Zend_Gdata_Analytics_DataQuery - */ - public function setStartDate($date) - { - $this->setParam('start-date', $date); - - return $this; - } - - /** - * @return Zend_Gdata_Analytics_DataQuery - */ - public function setEndDate($date) - { - $this->setParam('end-date', $date); - - return $this; - } - - /** - * @param string $filter - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function addFilter($filter) - { - $this->_filters[] = [$filter, true]; - - return $this; - } - - /** - * @param string $filter - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function addOrFilter($filter) - { - $this->_filters[] = [$filter, false]; - - return $this; - } - - /** - * @param string $sort - * @param boolean[optional] $descending - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function addSort($sort, $descending = false) - { - // add to sort storage - $this->_sort[] = ($descending ? '-' : '').$sort; - - return $this; - } - - /** - * @return Zend_Gdata_Analytics_DataQuery - */ - public function clearSort() - { - $this->_sort = []; - - return $this; - } - - /** - * @param string $segment - * - * @return Zend_Gdata_Analytics_DataQuery - */ - public function setSegment($segment) - { - $this->setParam('segment', $segment); - - return $this; - } - - /** - * @return string url - */ - public function getQueryUrl() - { - $uri = $this->_defaultFeedUri; - if (isset($this->_url)) { - $uri = $this->_url; - } - - $dimensions = $this->getDimensions(); - if (!empty($dimensions)) { - $this->setParam('dimensions', implode(',', array_keys($dimensions))); - } - - $metrics = $this->getMetrics(); - if (!empty($metrics)) { - $this->setParam('metrics', implode(',', array_keys($metrics))); - } - - // profile id (ga:tableId) - if (null != $this->getProfileId()) { - $this->setParam('ids', 'ga:'.ltrim((string) $this->getProfileId(), 'ga:')); - } - - // sorting - if ($this->_sort) { - $this->setParam('sort', implode(',', $this->_sort)); - } - - // filtering - $filters = ''; - foreach ($this->_filters as $filter) { - $filters .= (true === $filter[1] ? ';' : ',').$filter[0]; - } - - if ('' != $filters) { - $this->setParam('filters', ltrim((string) $filters, ',;')); - } - - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Dimension.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Dimension.php deleted file mode 100644 index b98b7c994..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Dimension.php +++ /dev/null @@ -1,37 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct(); - } - - /** - * @return string - */ - public function __toString() - { - $attribs = $this->getExtensionAttributes(); - - return $attribs['name']['value']; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Metric.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Metric.php deleted file mode 100644 index f53975b87..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Metric.php +++ /dev/null @@ -1,51 +0,0 @@ -localName) { - case 'name': - $this->_name = $attribute->nodeValue; - break; - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Property.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Property.php deleted file mode 100644 index 006166f1d..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/Property.php +++ /dev/null @@ -1,125 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct(); - $this->_value = $value; - $this->_name = $name; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'name': - $name = explode(':', $attribute->nodeValue); - $this->_name = end($name); - break; - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return string the value associated with this attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Analytics_Extension_Property the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * @param string $name - * - * @return Zend_Gdata_Analytics_Extension_Property - */ - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - /** - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/TableId.php b/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/TableId.php deleted file mode 100644 index ff1029730..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Analytics/Extension/TableId.php +++ /dev/null @@ -1,112 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Analytics::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - */ - protected function takeChildFromDOM($child) - { - $this->_value = $child->nodeValue; - } - - /** - * Get the value for this element's value attribute. - * - * @return string the value associated with this attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Analytics_Extension_TableId the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App.php b/packages/zend-gdata/library/Zend/Gdata/App.php deleted file mode 100644 index b574e87fd..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App.php +++ /dev/null @@ -1,1274 +0,0 @@ -= 1 is considered valid. - * - * Under most circumtances, this will be automatically set by - * Zend_Gdata_App subclasses. - * - * @see setMajorProtocolVersion() - * @see getMajorProtocolVersion() - */ - protected $_majorProtocolVersion; - - /** - * Indicates the minor protocol version that should be used. Can be set - * to either an integer >= 0, or NULL if no minor version should be sent - * to the server. - * - * At present, this field is not used by any Google services, but may be - * used in the future. - * - * Under most circumtances, this will be automatically set by - * Zend_Gdata_App subclasses. - * - * @see setMinorProtocolVersion() - * @see getMinorProtocolVersion() - */ - protected $_minorProtocolVersion; - - /** - * Whether we want to use XML to object mapping when fetching data. - * - * @var bool - */ - protected $_useObjectMapping = true; - - /** - * Create Gdata object. - * - * @param Zend_Http_Client $client - * @param string $applicationId - */ - public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0') - { - $this->setHttpClient($client, $applicationId); - // Set default protocol version. Subclasses should override this as - // needed once a given service supports a new version. - $this->setMajorProtocolVersion(self::DEFAULT_MAJOR_PROTOCOL_VERSION); - $this->setMinorProtocolVersion(self::DEFAULT_MINOR_PROTOCOL_VERSION); - } - - /** - * Adds a Zend Framework package to the $_registeredPackages array. - * This array is searched when using the magic __call method below - * to instantiante new objects. - * - * @param string $name The name of the package (eg Zend_Gdata_App) - * - * @return void - */ - public function registerPackage($name) - { - array_unshift($this->_registeredPackages, $name); - } - - /** - * Retrieve feed as string or object. - * - * @param string $uri The uri from which to retrieve the feed - * @param string $className The class which is used as the return type - * - * @return string|Zend_Gdata_App_Feed returns string only if the object - * mapping has been disabled explicitly - * by passing false to the - * useObjectMapping() function - */ - public function getFeed($uri, $className = 'Zend_Gdata_App_Feed') - { - return $this->importUrl($uri, $className, null); - } - - /** - * Retrieve entry as string or object. - * - * @param string $uri - * @param string $className The class which is used as the return type - * - * @return string|Zend_Gdata_App_Entry returns string only if the object - * mapping has been disabled explicitly - * by passing false to the - * useObjectMapping() function - */ - public function getEntry($uri, $className = 'Zend_Gdata_App_Entry') - { - return $this->importUrl($uri, $className, null); - } - - /** - * Get the Zend_Http_Client object used for communication. - * - * @return Zend_Http_Client - */ - public function getHttpClient() - { - return $this->_httpClient; - } - - /** - * Set the Zend_Http_Client object used for communication. - * - * @param Zend_Http_Client $client The client to use for communication - * - * @return Zend_Gdata_App Provides a fluent interface - * - * @throws Zend_Gdata_App_HttpException - */ - public function setHttpClient($client, - $applicationId = 'MyCompany-MyApp-1.0') - { - if (null === $client) { - $client = new Zend_Http_Client(); - } - if (!$client instanceof Zend_Http_Client) { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException('Argument is not an instance of Zend_Http_Client.'); - } - $userAgent = $applicationId.' Zend_Framework_Gdata/'. - Zend_Version::VERSION; - $client->setHeaders('User-Agent', $userAgent); - $client->setConfig([ - 'strictredirects' => true, - ] - ); - $this->_httpClient = $client; - self::setStaticHttpClient($client); - - return $this; - } - - /** - * Set the static HTTP client instance. - * - * Sets the static HTTP client object to use for retrieving the feed. - * - * @return void - */ - public static function setStaticHttpClient(Zend_Http_Client $httpClient) - { - self::$_staticHttpClient = $httpClient; - } - - /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. - * - * @return Zend_Http_Client - */ - public static function getStaticHttpClient() - { - if (!self::$_staticHttpClient instanceof Zend_Http_Client) { - $client = new Zend_Http_Client(); - $userAgent = 'Zend_Framework_Gdata/'.Zend_Version::VERSION; - $client->setHeaders('User-Agent', $userAgent); - $client->setConfig([ - 'strictredirects' => true, - ] - ); - self::$_staticHttpClient = $client; - } - - return self::$_staticHttpClient; - } - - /** - * Toggle using POST instead of PUT and DELETE HTTP methods. - * - * Some feed implementations do not accept PUT and DELETE HTTP - * methods, or they can't be used because of proxies or other - * measures. This allows turning on using POST where PUT and - * DELETE would normally be used; in addition, an - * X-Method-Override header will be sent with a value of PUT or - * DELETE as appropriate. - * - * @param bool $override whether to override PUT and DELETE with POST - * - * @return void - */ - public static function setHttpMethodOverride($override = true) - { - self::$_httpMethodOverride = $override; - } - - /** - * Get the HTTP override state. - * - * @return bool - */ - public static function getHttpMethodOverride() - { - return self::$_httpMethodOverride; - } - - /** - * Toggle requesting gzip encoded responses. - * - * @param bool $enabled Whether or not to enable gzipped responses - * - * @return void - */ - public static function setGzipEnabled($enabled = false) - { - if ($enabled && !function_exists('gzinflate')) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You cannot enable gzipped responses if the zlib module is not enabled in your PHP installation.'); - } - self::$_gzipEnabled = $enabled; - } - - /** - * Get the HTTP override state. - * - * @return bool - */ - public static function getGzipEnabled() - { - return self::$_gzipEnabled; - } - - /** - * Get whether to use verbose exception messages. - * - * In the case of HTTP errors, use the body of the HTTP response - * in the exception message. - * - * @return bool - */ - public static function getVerboseExceptionMessages() - { - return self::$_verboseExceptionMessages; - } - - /** - * Set whether to use verbose exception messages. - * - * In the case of HTTP errors, use the body of the HTTP response - * in the exception message. - * - * @param bool $verbose Whether to use verbose exception messages - */ - public static function setVerboseExceptionMessages($verbose) - { - self::$_verboseExceptionMessages = $verbose; - } - - /** - * Set the maximum number of redirects to follow during HTTP operations. - * - * @param int $maxRedirects Maximum number of redirects to follow - * - * @return void - */ - public static function setMaxRedirects($maxRedirects) - { - self::$_maxRedirects = $maxRedirects; - } - - /** - * Get the maximum number of redirects to follow during HTTP operations. - * - * @return int Maximum number of redirects to follow - */ - public static function getMaxRedirects() - { - return self::$_maxRedirects; - } - - /** - * Set the major protocol version that should be used. Values < 1 will - * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. - * - * @see _majorProtocolVersion - * - * @param int $value the major protocol version to use - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setMajorProtocolVersion($value) - { - if (!($value >= 1)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Major protocol version must be >= 1'); - } - $this->_majorProtocolVersion = $value; - } - - /** - * Get the major protocol version that is in use. - * - * @see _majorProtocolVersion - * - * @return int the major protocol version in use - */ - public function getMajorProtocolVersion() - { - return $this->_majorProtocolVersion; - } - - /** - * Set the minor protocol version that should be used. If set to NULL, no - * minor protocol version will be sent to the server. Values < 0 will - * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. - * - * @see _minorProtocolVersion - * - * @param (int|null) $value the minor protocol version to use - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setMinorProtocolVersion($value) - { - if (!($value >= 0)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Minor protocol version must be >= 0'); - } - $this->_minorProtocolVersion = $value; - } - - /** - * Get the minor protocol version that is in use. - * - * @see _minorProtocolVersion - * - * @return (int|null) the major protocol version in use, or NULL if no - * minor version is specified - */ - public function getMinorProtocolVersion() - { - return $this->_minorProtocolVersion; - } - - /** - * Provides pre-processing for HTTP requests to APP services. - * - * 1. Checks the $data element and, if it's an entry, extracts the XML, - * multipart data, edit link (PUT,DELETE), etc. - * 2. If $data is a string, sets the default content-type header as - * 'application/atom+xml' if it's not already been set. - * 3. Adds a x-http-method override header and changes the HTTP method - * to 'POST' if necessary as per getHttpMethodOverride() - * - * @param string $method The HTTP method for the request - 'GET', 'POST', - * 'PUT', 'DELETE' - * @param string $url The URL to which this request is being performed, - * or null if found in $data - * @param array $headers An associative array of HTTP headers for this - * request - * @param mixed $data The Zend_Gdata_App_Entry or XML for the - * body of the request - * @param string $contentTypeOverride The override value for the - * content type of the request body - * - * @return array An associative array containing the determined - * 'method', 'url', 'data', 'headers', 'contentType' - */ - public function prepareRequest($method, - $url = null, - $headers = [], - $data = null, - $contentTypeOverride = null) - { - // As a convenience, if $headers is null, we'll convert it back to - // an empty array. - if (null === $headers) { - $headers = []; - } - - $rawData = null; - $finalContentType = null; - if (null == $url) { - $url = $this->_defaultPostUri; - } - - if (is_string($data)) { - $rawData = $data; - if (null === $contentTypeOverride) { - $finalContentType = 'application/atom+xml'; - } - } elseif ($data instanceof Zend_Gdata_App_MediaEntry) { - $rawData = $data->encode(); - if (null !== $data->getMediaSource()) { - $finalContentType = $rawData->getContentType(); - $headers['MIME-version'] = '1.0'; - $headers['Slug'] = $data->getMediaSource()->getSlug(); - } else { - $finalContentType = 'application/atom+xml'; - } - if ('PUT' == $method || 'DELETE' == $method) { - $editLink = $data->getEditLink(); - if (null != $editLink && null == $url) { - $url = $editLink->getHref(); - } - } - } elseif ($data instanceof Zend_Gdata_App_Entry) { - $rawData = $data->saveXML(); - $finalContentType = 'application/atom+xml'; - if ('PUT' == $method || 'DELETE' == $method) { - $editLink = $data->getEditLink(); - if (null != $editLink) { - $url = $editLink->getHref(); - } - } - } elseif ($data instanceof Zend_Gdata_App_MediaSource) { - $rawData = $data->encode(); - if (null !== $data->getSlug()) { - $headers['Slug'] = $data->getSlug(); - } - $finalContentType = $data->getContentType(); - } - - if ('DELETE' == $method) { - $rawData = null; - } - - // Set an If-Match header if: - // - This isn't a DELETE - // - If this isn't a GET, the Etag isn't weak - // - A similar header (If-Match/If-None-Match) hasn't already been - // set. - if ('DELETE' != $method && ( - !array_key_exists('If-Match', $headers) - && !array_key_exists('If-None-Match', $headers) - )) { - $allowWeak = 'GET' == $method; - if ($ifMatchHeader = $this->generateIfMatchHeaderData( - $data, $allowWeak)) { - $headers['If-Match'] = $ifMatchHeader; - } - } - - if ('POST' != $method && 'GET' != $method && Zend_Gdata_App::getHttpMethodOverride()) { - $headers['x-http-method-override'] = $method; - $method = 'POST'; - } else { - $headers['x-http-method-override'] = null; - } - - if (null != $contentTypeOverride) { - $finalContentType = $contentTypeOverride; - } - - return ['method' => $method, 'url' => $url, - 'data' => $rawData, 'headers' => $headers, - 'contentType' => $finalContentType]; - } - - /** - * Performs a HTTP request using the specified method. - * - * @param string $method The HTTP method for the request - 'GET', 'POST', - * 'PUT', 'DELETE' - * @param string $url The URL to which this request is being performed - * @param array $headers An associative array of HTTP headers - * for this request - * @param string $body The body of the HTTP request - * @param string $contentType The value for the content type - * of the request body - * @param int $remainingRedirects Number of redirects to follow if request - * s results in one - * - * @return Zend_Http_Response The response object - */ - public function performHttpRequest($method, $url, $headers = null, - $body = null, $contentType = null, $remainingRedirects = null) - { - // require_once 'Zend/Http/Client/Exception.php'; - if (null === $remainingRedirects) { - $remainingRedirects = self::getMaxRedirects(); - } - if (null === $headers) { - $headers = []; - } - // Append a Gdata version header if protocol v2 or higher is in use. - // (Protocol v1 does not use this header.) - $major = $this->getMajorProtocolVersion(); - $minor = $this->getMinorProtocolVersion(); - if ($major >= 2) { - $headers['GData-Version'] = $major. - ((null !== $minor) ? '.'.$minor : ''); - } - - // check the overridden method - if (('POST' == $method || 'PUT' == $method) && null === $body - && 'DELETE' != $headers['x-http-method-override']) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You must specify the data to post as either a string or a child of Zend_Gdata_App_Entry'); - } - if (null === $url) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI to which to post.'); - } - $headers['Content-Type'] = $contentType; - if (Zend_Gdata_App::getGzipEnabled()) { - // some services require the word 'gzip' to be in the user-agent - // header in addition to the accept-encoding header - if (false === strpos((string) $this->_httpClient->getHeader('User-Agent'), - 'gzip')) { - $headers['User-Agent'] = - $this->_httpClient->getHeader('User-Agent').' (gzip)'; - } - $headers['Accept-encoding'] = 'gzip, deflate'; - } else { - $headers['Accept-encoding'] = 'identity'; - } - - // Make sure the HTTP client object is 'clean' before making a request - // In addition to standard headers to reset via resetParameters(), - // also reset the Slug and If-Match headers - $this->_httpClient->resetParameters(); - $this->_httpClient->setHeaders(['Slug', 'If-Match']); - - // Set the params for the new request to be performed - $this->_httpClient->setHeaders($headers); - // require_once 'Zend/Uri/Http.php'; - $uri = Zend_Uri_Http::fromString($url); - preg_match("/^(.*?)(\?.*)?$/", $url, $matches); - $this->_httpClient->setUri($matches[1]); - $queryArray = $uri->getQueryAsArray(); - foreach ($queryArray as $name => $value) { - $this->_httpClient->setParameterGet($name, $value); - } - - $this->_httpClient->setConfig(['maxredirects' => 0]); - - // Set the proper adapter if we are handling a streaming upload - $usingMimeStream = false; - $oldHttpAdapter = null; - - if ($body instanceof Zend_Gdata_MediaMimeStream) { - $usingMimeStream = true; - $this->_httpClient->setRawDataStream($body, $contentType); - $oldHttpAdapter = $this->_httpClient->getAdapter(); - - if ($oldHttpAdapter instanceof Zend_Http_Client_Adapter_Proxy) { - // require_once 'Zend/Gdata/HttpAdapterStreamingProxy.php'; - $newAdapter = new Zend_Gdata_HttpAdapterStreamingProxy(); - } else { - // require_once 'Zend/Gdata/HttpAdapterStreamingSocket.php'; - $newAdapter = new Zend_Gdata_HttpAdapterStreamingSocket(); - } - $this->_httpClient->setAdapter($newAdapter); - } else { - $this->_httpClient->setRawData($body, $contentType); - } - - try { - $response = $this->_httpClient->request($method); - // reset adapter - if ($usingMimeStream) { - $this->_httpClient->setAdapter($oldHttpAdapter); - } - } catch (Zend_Http_Client_Exception $e) { - // reset adapter - if ($usingMimeStream) { - $this->_httpClient->setAdapter($oldHttpAdapter); - } - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); - } - if ($response->isRedirect() && '304' != $response->getStatus()) { - if ($remainingRedirects > 0) { - $newUrl = $response->getHeader('Location'); - $response = $this->performHttpRequest( - $method, $newUrl, $headers, $body, - $contentType, $remainingRedirects); - } else { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException('Number of redirects exceeds maximum', null, $response); - } - } - if (!$response->isSuccessful()) { - // require_once 'Zend/Gdata/App/HttpException.php'; - $exceptionMessage = 'Expected response code 200, got '. - $response->getStatus(); - if (self::getVerboseExceptionMessages()) { - $exceptionMessage .= "\n".$response->getBody(); - } - $exception = new Zend_Gdata_App_HttpException($exceptionMessage); - $exception->setResponse($response); - throw $exception; - } - - return $response; - } - - /** - * Imports a feed located at $uri. - * - * @param string $uri - * @param Zend_Http_Client $client The client used for communication - * @param string $className The class which is used as the return type - * @param bool $useObjectMapping enable/disable the use of XML to object mapping - * - * @return string|Zend_Gdata_App_Feed returns string only if the fourth - * parameter ($useObjectMapping) is set - * to false - * - * @throws Zend_Gdata_App_Exception - */ - public static function import($uri, $client = null, - $className = 'Zend_Gdata_App_Feed', $useObjectMapping = true) - { - $app = new Zend_Gdata_App($client); - $requestData = $app->prepareRequest('GET', $uri); - $response = $app->performHttpRequest( - $requestData['method'], $requestData['url']); - - $feedContent = $response->getBody(); - if (false === $useObjectMapping) { - return $feedContent; - } - $feed = self::importString($feedContent, $className); - if (null != $client) { - $feed->setHttpClient($client); - } - - return $feed; - } - - /** - * Imports the specified URL (non-statically). - * - * @param string $url The URL to import - * @param string $className The class which is used as the return type - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return string|Zend_Gdata_App_Feed returns string only if the object - * mapping has been disabled explicitly - * by passing false to the - * useObjectMapping() function - * - * @throws Zend_Gdata_App_Exception - */ - public function importUrl($url, $className = 'Zend_Gdata_App_Feed', - $extraHeaders = []) - { - $response = $this->get($url, $extraHeaders); - - $feedContent = $response->getBody(); - if (!$this->_useObjectMapping) { - return $feedContent; - } - - $protocolVersionStr = $response->getHeader('GData-Version'); - $majorProtocolVersion = null; - $minorProtocolVersion = null; - if (null !== $protocolVersionStr) { - // Extract protocol major and minor version from header - $delimiterPos = strpos((string) $protocolVersionStr, '.'); - $length = strlen((string) $protocolVersionStr); - $major = substr((string) $protocolVersionStr, 0, $delimiterPos); - $minor = substr((string) $protocolVersionStr, $delimiterPos + 1, $length); - $majorProtocolVersion = $major; - $minorProtocolVersion = $minor; - } - - $feed = self::importString($feedContent, $className, - $majorProtocolVersion, $minorProtocolVersion); - if (null != $this->getHttpClient()) { - $feed->setHttpClient($this->getHttpClient()); - } - $etag = $response->getHeader('ETag'); - if (null !== $etag) { - $feed->setEtag($etag); - } - - return $feed; - } - - /** - * Imports a feed represented by $string. - * - * @param string $string - * @param string $className The class which is used as the return type - * - * @return Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - */ - public static function importString($string, - $className = 'Zend_Gdata_App_Feed', $majorProtocolVersion = null, - $minorProtocolVersion = null) - { - if (!class_exists($className)) { - // require_once 'Zend/Loader.php'; - @Zend_Loader::loadClass($className); - } - - // Load the feed as an XML DOMDocument object - $doc = new DOMDocument(); - $doc = @Zend_Xml_Security::scan($string, $doc); - - if (!$doc) { - $err = error_get_last(); - $phpErrormsg = $err['message']; - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $phpErrormsg"); - } - - $feed = new $className(); - $feed->setMajorProtocolVersion($majorProtocolVersion); - $feed->setMinorProtocolVersion($minorProtocolVersion); - $feed->transferFromXML($string); - $feed->setHttpClient(self::getstaticHttpClient()); - - return $feed; - } - - /** - * Imports a feed from a file located at $filename. - * - * @param string $filename - * @param string $className The class which is used as the return type - * @param string $useIncludePath Whether the include_path should be searched - * - * @return Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - */ - public static function importFile($filename, $className = 'Zend_Gdata_App_Feed', $useIncludePath = false) - { - error_clear_last(); - $feed = @file_get_contents($filename, (bool) $useIncludePath); - if (false === $feed) { - $err = error_get_last(); - $phpErrormsg = isset($err['message'][0]) ? $err['message'] : null; - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("File could not be loaded: $phpErrormsg"); - } - - return self::importString($feed, $className); - } - - /** - * GET a URI using client object. - * - * @param string $uri GET URI - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Http_Response - * - * @throws Zend_Gdata_App_HttpException - */ - public function get($uri, $extraHeaders = []) - { - $requestData = $this->prepareRequest('GET', $uri, $extraHeaders); - - return $this->performHttpRequest( - $requestData['method'], $requestData['url'], - $requestData['headers']); - } - - /** - * POST data with client object. - * - * @param mixed $data The Zend_Gdata_App_Entry or XML to post - * @param string $uri POST URI - * @param string $contentType Content-type of the data - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Http_Response - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function post($data, $uri = null, $remainingRedirects = null, - $contentType = null, $extraHeaders = null) - { - $requestData = $this->prepareRequest( - 'POST', $uri, $extraHeaders, $data, $contentType); - - return $this->performHttpRequest( - $requestData['method'], $requestData['url'], - $requestData['headers'], $requestData['data'], - $requestData['contentType']); - } - - /** - * PUT data with client object. - * - * @param mixed $data The Zend_Gdata_App_Entry or XML to post - * @param string $uri PUT URI - * @param string $contentType Content-type of the data - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Http_Response - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function put($data, $uri = null, $remainingRedirects = null, - $contentType = null, $extraHeaders = null) - { - $requestData = $this->prepareRequest( - 'PUT', $uri, $extraHeaders, $data, $contentType); - - return $this->performHttpRequest( - $requestData['method'], $requestData['url'], - $requestData['headers'], $requestData['data'], - $requestData['contentType']); - } - - /** - * DELETE entry with client object. - * - * @param mixed $data The Zend_Gdata_App_Entry or URL to delete - * - * @return void - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function delete($data, $remainingRedirects = null) - { - if (is_string($data)) { - $requestData = $this->prepareRequest('DELETE', $data); - } else { - $headers = []; - - $requestData = $this->prepareRequest( - 'DELETE', null, $headers, $data); - } - - return $this->performHttpRequest($requestData['method'], - $requestData['url'], - $requestData['headers'], - '', - $requestData['contentType'], - $remainingRedirects); - } - - /** - * Inserts an entry to a given URI and returns the response as a - * fully formed Entry. - * - * @param mixed $data The Zend_Gdata_App_Entry or XML to post - * @param string $uri POST URI - * @param string $className the class of entry to be returned - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Gdata_App_Entry the entry returned by the service after - * insertion - */ - public function insertEntry($data, $uri, $className = 'Zend_Gdata_App_Entry', - $extraHeaders = []) - { - if (!class_exists($className)) { - // require_once 'Zend/Loader.php'; - @Zend_Loader::loadClass($className); - } - - $response = $this->post($data, $uri, null, null, $extraHeaders); - - $returnEntry = new $className($response->getBody()); - $returnEntry->setHttpClient(self::getstaticHttpClient()); - - $etag = $response->getHeader('ETag'); - if (null !== $etag) { - $returnEntry->setEtag($etag); - } - - return $returnEntry; - } - - /** - * Update an entry. - * - * @param mixed $data Zend_Gdata_App_Entry or XML (w/ID and link rel='edit') - * @param string|null the URI to send requests to, or null if $data - * contains the URI - * @param string|null The name of the class that should be deserialized - * from the server response. If null, then 'Zend_Gdata_App_Entry' - * will be used. - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Gdata_App_Entry The entry returned from the server - * - * @throws Zend_Gdata_App_Exception - */ - public function updateEntry($data, $uri = null, $className = null, - $extraHeaders = []) - { - if (null === $className && $data instanceof Zend_Gdata_App_Entry) { - $className = get_class($data); - } elseif (null === $className) { - $className = 'Zend_Gdata_App_Entry'; - } - - if (!class_exists($className)) { - // require_once 'Zend/Loader.php'; - @Zend_Loader::loadClass($className); - } - - $response = $this->put($data, $uri, null, null, $extraHeaders); - $returnEntry = new $className($response->getBody()); - $returnEntry->setHttpClient(self::getstaticHttpClient()); - - $etag = $response->getHeader('ETag'); - if (null !== $etag) { - $returnEntry->setEtag($etag); - } - - return $returnEntry; - } - - /** - * Provides a magic factory method to instantiate new objects with - * shorter syntax than would otherwise be required by the Zend Framework - * naming conventions. For instance, to construct a new - * Zend_Gdata_Calendar_Extension_Color, a developer simply needs to do - * $gCal->newColor(). For this magic constructor, packages are searched - * in the same order as which they appear in the $_registeredPackages - * array. - * - * @param string $method The method name being called - * @param array $args The arguments passed to the call - * - * @throws Zend_Gdata_App_Exception - */ - public function __call($method, $args) - { - if (preg_match('/^new(\w+)/', $method, $matches)) { - $class = $matches[1]; - $foundClassName = null; - foreach ($this->_registeredPackages as $name) { - try { - // Autoloading disabled on next line for compatibility - // with magic factories. See ZF-6660. - Zend_Loader_Autoloader::setDisabled(); - $found = class_exists($name.'_'.$class); - Zend_Loader_Autoloader::setDisabled(false); - if (!$found) { - // require_once 'Zend/Loader.php'; - @Zend_Loader::loadClass($name.'_'.$class); - } - $foundClassName = $name.'_'.$class; - break; - } catch (Zend_Exception $e) { - // package wasn't here- continue searching - } catch (ErrorException $e) { - // package wasn't here- continue searching - // @see ZF-7013 and ZF-11959 - } - } - if (null != $foundClassName) { - $reflectionObj = new ReflectionClass($foundClassName); - $instance = $reflectionObj->newInstanceArgs($args); - if ($instance instanceof Zend_Gdata_App_FeedEntryParent) { - $instance->setHttpClient($this->_httpClient); - - // Propogate version data - $instance->setMajorProtocolVersion( - $this->_majorProtocolVersion); - $instance->setMinorProtocolVersion( - $this->_minorProtocolVersion); - } - - return $instance; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("Unable to find '{$class}' in registered packages"); - } - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("No such method {$method}"); - } - } - - /** - * Retrieve all entries for a feed, iterating through pages as necessary. - * Be aware that calling this function on a large dataset will take a - * significant amount of time to complete. In some cases this may cause - * execution to timeout without proper precautions in place. - * - * @param object $feed the feed to iterate through - * - * @return object a new feed of the same type as the one originally - * passed in, containing all relevent entries - */ - public function retrieveAllEntriesForFeed($feed) - { - $feedClass = get_class($feed); - $reflectionObj = new ReflectionClass($feedClass); - $result = $reflectionObj->newInstance(); - do { - foreach ($feed as $entry) { - $result->addEntry($entry); - } - - $next = $feed->getLink('next'); - if (null !== $next) { - $feed = $this->getFeed($next->href, $feedClass); - } else { - $feed = null; - } - } while (null != $feed); - - return $result; - } - - /** - * This method enables logging of requests by changing the - * Zend_Http_Client_Adapter used for performing the requests. - * NOTE: This will not work if you have customized the adapter - * already to use a proxy server or other interface. - * - * @param string $logfile The logfile to use when logging the requests - */ - public function enableRequestDebugLogging($logfile) - { - $this->_httpClient->setConfig([ - 'adapter' => 'Zend_Gdata_App_LoggingHttpClientAdapterSocket', - 'logfile' => $logfile, - ]); - } - - /** - * Retrieve next set of results based on a given feed. - * - * @param Zend_Gdata_App_Feed $feed the feed from which to - * retreive the next set of results - * @param string $className (optional) The class of feed to be returned. - * If null, the next feed (if found) will be the same class as - * the feed that was given as the first argument. - * - * @return Zend_Gdata_App_Feed|null returns a - * Zend_Gdata_App_Feed or null if no next set of results - * exists - */ - public function getNextFeed($feed, $className = null) - { - $nextLink = $feed->getNextLink(); - if (!$nextLink) { - return null; - } - $nextLinkHref = $nextLink->getHref(); - - if (null === $className) { - $className = get_class($feed); - } - - return $this->getFeed($nextLinkHref, $className); - } - - /** - * Retrieve previous set of results based on a given feed. - * - * @param Zend_Gdata_App_Feed $feed the feed from which to - * retreive the previous set of results - * @param string $className (optional) The class of feed to be returned. - * If null, the previous feed (if found) will be the same class as - * the feed that was given as the first argument. - * - * @return Zend_Gdata_App_Feed|null returns a - * Zend_Gdata_App_Feed or null if no previous set of results - * exists - */ - public function getPreviousFeed($feed, $className = null) - { - $previousLink = $feed->getPreviousLink(); - if (!$previousLink) { - return null; - } - $previousLinkHref = $previousLink->getHref(); - - if (null === $className) { - $className = get_class($feed); - } - - return $this->getFeed($previousLinkHref, $className); - } - - /** - * Returns the data for an If-Match header based on the current Etag - * property. If Etags are not supported by the server or cannot be - * extracted from the data, then null will be returned. - * - * @return string|null $data - */ - public function generateIfMatchHeaderData($data, $allowWeek) - { - $result = ''; - // Set an If-Match header if an ETag has been set (version >= 2 only) - if ($this->_majorProtocolVersion >= 2 - && $data instanceof Zend_Gdata_App_Entry) { - $etag = $data->getEtag(); - if ((null !== $etag) - && ($allowWeek || 'W/' != substr((string) $etag, 0, 2))) { - $result = $data->getEtag(); - } - } - - return $result; - } - - /** - * Determine whether service object is using XML to object mapping. - * - * @return bool true if service object is using XML to object mapping, - * false otherwise - */ - public function usingObjectMapping() - { - return $this->_useObjectMapping; - } - - /** - * Enable/disable the use of XML to object mapping. - * - * @param bool $value Pass in true to use the XML to object mapping. - * Pass in false or null to disable it. - * - * @return void - */ - public function useObjectMapping($value) - { - if (true === $value) { - $this->_useObjectMapping = true; - } else { - $this->_useObjectMapping = false; - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/AuthException.php b/packages/zend-gdata/library/Zend/Gdata/App/AuthException.php deleted file mode 100644 index a09781cc3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/AuthException.php +++ /dev/null @@ -1,40 +0,0 @@ - [ - 1 => [ - 0 => 'http://www.w3.org/2005/Atom', - ], - ], - 'app' => [ - 1 => [ - 0 => 'http://purl.org/atom/app#', - ], - 2 => [ - 0 => 'http://www.w3.org/2007/app', - ], - ], - ]; - - public function __construct() - { - } - - /** - * Returns the child text node of this element - * This represents any raw text contained within the XML element. - * - * @return string Child text node - */ - public function getText($trim = true) - { - if ($trim) { - return \trim((string) $this->_text); - } else { - return $this->_text; - } - } - - /** - * Sets the child text node of this element - * This represents any raw text contained within the XML element. - * - * @param string $value Child text node - * - * @return Zend_Gdata_App_Base returns an object of the same type as 'this' to provide a fluent interface - */ - public function setText($value) - { - $this->_text = $value; - - return $this; - } - - /** - * Returns an array of all elements not matched to data model classes - * during the parsing of the XML. - * - * @return array All elements not matched to data model classes during parsing - */ - public function getExtensionElements() - { - return $this->_extensionElements; - } - - /** - * Sets an array of all elements not matched to data model classes - * during the parsing of the XML. This method can be used to add arbitrary - * child XML elements to any data model class. - * - * @param array $value All extension elements - * - * @return Zend_Gdata_App_Base returns an object of the same type as 'this' to provide a fluent interface - */ - public function setExtensionElements($value) - { - $this->_extensionElements = $value; - - return $this; - } - - /** - * Returns an array of all extension attributes not transformed into data - * model properties during parsing of the XML. Each element of the array - * is a hashed array of the format: - * array('namespaceUri' => string, 'name' => string, 'value' => string);. - * - * @return array All extension attributes - */ - public function getExtensionAttributes() - { - return $this->_extensionAttributes; - } - - /** - * Sets an array of all extension attributes not transformed into data - * model properties during parsing of the XML. Each element of the array - * is a hashed array of the format: - * array('namespaceUri' => string, 'name' => string, 'value' => string); - * This can be used to add arbitrary attributes to any data model element. - * - * @param array $value All extension attributes - * - * @return Zend_Gdata_App_Base returns an object of the same type as 'this' to provide a fluent interface - */ - public function setExtensionAttributes($value) - { - $this->_extensionAttributes = $value; - - return $this; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - if (null === $doc) { - $doc = new DOMDocument('1.0', 'utf-8'); - } - if (null != $this->_rootNamespaceURI) { - $element = $doc->createElementNS($this->_rootNamespaceURI, $this->_rootElement); - } elseif (null !== $this->_rootNamespace) { - if (false === strpos((string) $this->_rootElement, ':')) { - $elementName = $this->_rootNamespace.':'.$this->_rootElement; - } else { - $elementName = $this->_rootElement; - } - $element = $doc->createElementNS($this->lookupNamespace($this->_rootNamespace), $elementName); - } else { - $element = $doc->createElement($this->_rootElement); - } - if (null != $this->_text) { - $element->appendChild($element->ownerDocument->createTextNode($this->_text)); - } - foreach ($this->_extensionElements as $extensionElement) { - $element->appendChild($extensionElement->getDOM($element->ownerDocument)); - } - foreach ($this->_extensionAttributes as $attribute) { - $element->setAttribute($attribute['name'], $attribute['value']); - } - - return $element; - } - - /** - * Given a child DOMNode, tries to determine how to map the data into - * object instance members. If no mapping is defined, Extension_Element - * objects are created and stored in an array. - * - * @param DOMNode $child The DOMNode needed to be handled - */ - protected function takeChildFromDOM($child) - { - if (XML_TEXT_NODE == $child->nodeType) { - $this->_text = $child->nodeValue; - } else { - $extensionElement = new Zend_Gdata_App_Extension_Element(); - $extensionElement->transferFromDOM($child); - $this->_extensionElements[] = $extensionElement; - } - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - $arrayIndex = ('' != $attribute->namespaceURI) ? ( - $attribute->namespaceURI.':'.$attribute->name) : - $attribute->name; - $this->_extensionAttributes[$arrayIndex] = - ['namespaceUri' => $attribute->namespaceURI, - 'name' => $attribute->localName, - 'value' => $attribute->nodeValue]; - } - - /** - * Transfers each child and attribute into member variables. - * This is called when XML is received over the wire and the data - * model needs to be built to represent this XML. - * - * @param DOMNode $node The DOMNode that represents this object's data - */ - public function transferFromDOM($node) - { - foreach ($node->childNodes as $child) { - $this->takeChildFromDOM($child); - } - foreach ($node->attributes as $attribute) { - $this->takeAttributeFromDOM($attribute); - } - } - - /** - * Parses the provided XML text and generates data model classes for - * each know element by turning the XML text into a DOM tree and calling - * transferFromDOM($element). The first data model element with the same - * name as $this->_rootElement is used and the child elements are - * recursively parsed. - * - * @param string $xml The XML text to parse - */ - public function transferFromXML($xml) - { - if ($xml) { - error_clear_last(); - - // Load the feed as an XML DOMDocument object - $doc = new DOMDocument(); - $doc = @Zend_Xml_Security::scan($xml, $doc); - if (!$doc) { - $err = error_get_last(); - $phpErrormsg = isset($err['message'][0]) ? $err['message'] : null; - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $phpErrormsg"); - } - $element = $doc->getElementsByTagName($this->_rootElement)->item(0); - if (!$element) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('No root <'.$this->_rootElement.'> element'); - } - $this->transferFromDOM($element); - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null'); - } - } - - /** - * Converts this element and all children into XML text using getDOM(). - * - * @return string XML content - */ - public function saveXML() - { - $element = $this->getDOM(); - - return $element->ownerDocument->saveXML($element); - } - - /** - * Alias for saveXML() returns XML content for this element and all - * children. - * - * @return string XML content - */ - public function getXML() - { - return $this->saveXML(); - } - - /** - * Alias for saveXML(). - * - * Can be overridden by children to provide more complex representations - * of entries. - * - * @return string Encoded string content - */ - public function encode() - { - return $this->saveXML(); - } - - /** - * Get the full version of a namespace prefix. - * - * Looks up a prefix (atom:, etc.) in the list of registered - * namespaces and returns the full namespace URI if - * available. Returns the prefix, unmodified, if it's not - * registered. - * - * @param string $prefix the namespace prefix to lookup - * @param int $majorVersion The major protocol version in effect. - * Defaults to '1'. - * @param int $minorVersion The minor protocol version in effect. - * Defaults to null (use latest). - * - * @return string - */ - public function lookupNamespace($prefix, - $majorVersion = 1, - $minorVersion = null) - { - // Check for a memoized result - $key = $prefix.' '. - (null === $majorVersion ? 'NULL' : $majorVersion). - ' '.(null === $minorVersion ? 'NULL' : $minorVersion); - if (array_key_exists($key, self::$_namespaceLookupCache)) { - return self::$_namespaceLookupCache[$key]; - } - // If no match, return the prefix by default - $result = $prefix; - - // Find tuple of keys that correspond to the namespace we should use - if (isset($this->_namespaces[$prefix])) { - // Major version search - $nsData = $this->_namespaces[$prefix]; - $foundMajorV = Zend_Gdata_App_Util::findGreatestBoundedValue( - $majorVersion, $nsData); - // Minor version search - $nsData = $nsData[$foundMajorV]; - $foundMinorV = Zend_Gdata_App_Util::findGreatestBoundedValue( - $minorVersion, $nsData); - // Extract NS - $result = $nsData[$foundMinorV]; - } - - // Memoize result - self::$_namespaceLookupCache[$key] = $result; - - return $result; - } - - /** - * Add a namespace and prefix to the registered list. - * - * Takes a prefix and a full namespace URI and adds them to the - * list of registered namespaces for use by - * $this->lookupNamespace(). - * - * WARNING: Currently, registering a namespace will NOT invalidate any - * memoized data stored in $_namespaceLookupCache. Under normal - * use, this behavior is acceptable. If you are adding - * contradictory data to the namespace lookup table, you must - * call flushNamespaceLookupCache(). - * - * @param string $prefix The namespace prefix - * @param string $namespaceUri The full namespace URI - * @param int $majorVersion The major protocol version in effect. - * Defaults to '1'. - * @param int $minorVersion The minor protocol version in effect. - * Defaults to null (use latest). - * - * @return void - */ - public function registerNamespace($prefix, - $namespaceUri, - $majorVersion = 1, - $minorVersion = 0) - { - $this->_namespaces[$prefix][$majorVersion][$minorVersion] = - $namespaceUri; - } - - /** - * Flush namespace lookup cache. - * - * Empties the namespace lookup cache. Call this function if you have - * added data to the namespace lookup table that contradicts values that - * may have been cached during a previous call to lookupNamespace(). - */ - public static function flushNamespaceLookupCache() - { - self::$_namespaceLookupCache = []; - } - - /** - * Add an array of namespaces to the registered list. - * - * Takes an array in the format of: - * namespace prefix, namespace URI, major protocol version, - * minor protocol version and adds them with calls to ->registerNamespace() - * - * @param array $namespaceArray an array of namespaces - * - * @return void - */ - public function registerAllNamespaces($namespaceArray) - { - foreach ($namespaceArray as $namespace) { - $this->registerNamespace( - $namespace[0], $namespace[1], $namespace[2], $namespace[3]); - } - } - - /** - * Magic getter to allow access like $entry->foo to call $entry->getFoo() - * Alternatively, if no getFoo() is defined, but a $_foo protected variable - * is defined, this is returned. - * - * TODO Remove ability to bypass getFoo() methods?? - * - * @param string $name The variable name sought - */ - public function __get($name) - { - $method = 'get'.ucfirst($name); - if (method_exists($this, $method)) { - return call_user_func([&$this, $method]); - } elseif (property_exists($this, "_{$name}")) { - return $this->{'_'.$name}; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Property '.$name.' does not exist'); - } - } - - /** - * Magic setter to allow acces like $entry->foo='bar' to call - * $entry->setFoo('bar') automatically. - * - * Alternatively, if no setFoo() is defined, but a $_foo protected variable - * is defined, this is returned. - * - * TODO Remove ability to bypass getFoo() methods?? - * - * @param string $name - */ - public function __set($name, $val) - { - $method = 'set'.ucfirst($name); - if (method_exists($this, $method)) { - return call_user_func([&$this, $method], $val); - } elseif (isset($this->{'_'.$name}) || (null === $this->{'_'.$name})) { - $this->{'_'.$name} = $val; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Property '.$name.' does not exist'); - } - } - - /** - * Magic __isset method. - * - * @param string $name - */ - public function __isset($name) - { - $rc = new ReflectionClass(get_class($this)); - $privName = '_'.$name; - if (!$rc->hasProperty($privName)) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Property '.$name.' does not exist'); - } else { - if (isset($this->{$privName})) { - if (is_array($this->{$privName})) { - if (count($this->{$privName}) > 0) { - return true; - } else { - return false; - } - } else { - return true; - } - } else { - return false; - } - } - } - - /** - * Magic __unset method. - * - * @param string $name - */ - public function __unset($name) - { - if (isset($this->{'_'.$name})) { - if (is_array($this->{'_'.$name})) { - $this->{'_'.$name} = []; - } else { - $this->{'_'.$name} = null; - } - } - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - * - * @return string The text representation of this object - */ - public function __toString() - { - return $this->getText(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/BaseMediaSource.php b/packages/zend-gdata/library/Zend/Gdata/App/BaseMediaSource.php deleted file mode 100644 index 3aef98cfb..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/BaseMediaSource.php +++ /dev/null @@ -1,177 +0,0 @@ -_contentType; - } - - /** - * Set the content type for the file attached (example image/png). - * - * @param string $value The content type - * - * @return Zend_Gdata_App_MediaFileSource Provides a fluent interface - */ - public function setContentType($value) - { - $this->_contentType = $value; - - return $this; - } - - /** - * Returns the Slug header value. Used by some services to determine the - * title for the uploaded file. Returns null if no slug should be used. - * - * @return string - */ - public function getSlug() - { - return $this->_slug; - } - - /** - * Sets the Slug header value. Used by some services to determine the - * title for the uploaded file. A null value indicates no slug header. - * - * @var string The slug value - * - * @return Zend_Gdata_App_MediaSource Provides a fluent interface - */ - public function setSlug($value) - { - $this->_slug = $value; - - return $this; - } - - /** - * Magic getter to allow acces like $source->foo to call $source->getFoo() - * Alternatively, if no getFoo() is defined, but a $_foo protected variable - * is defined, this is returned. - * - * TODO Remove ability to bypass getFoo() methods?? - * - * @param string $name The variable name sought - */ - public function __get($name) - { - $method = 'get'.ucfirst($name); - if (method_exists($this, $method)) { - return call_user_func([&$this, $method]); - } elseif (property_exists($this, "_{$name}")) { - return $this->{'_'.$name}; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Property '.$name.' does not exist'); - } - } - - /** - * Magic setter to allow acces like $source->foo='bar' to call - * $source->setFoo('bar') automatically. - * - * Alternatively, if no setFoo() is defined, but a $_foo protected variable - * is defined, this is returned. - * - * @param string $name - */ - public function __set($name, $val) - { - $method = 'set'.ucfirst($name); - if (method_exists($this, $method)) { - return call_user_func([&$this, $method], $val); - } elseif (isset($this->{'_'.$name}) || (null === $this->{'_'.$name})) { - $this->{'_'.$name} = $val; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Property '.$name.' does not exist'); - } - } - - /** - * Magic __isset method. - * - * @param string $name - */ - public function __isset($name) - { - $rc = new ReflectionClass(get_class($this)); - $privName = '_'.$name; - if (!$rc->hasProperty($privName)) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Property '.$name.' does not exist'); - } else { - if (isset($this->{$privName})) { - if (is_array($this->{$privName})) { - if (count($this->{$privName}) > 0) { - return true; - } else { - return false; - } - } else { - return true; - } - } else { - return false; - } - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/CaptchaRequiredException.php b/packages/zend-gdata/library/Zend/Gdata/App/CaptchaRequiredException.php deleted file mode 100644 index f2e81913c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/CaptchaRequiredException.php +++ /dev/null @@ -1,95 +0,0 @@ -captchaToken = $captchaToken; - $this->captchaUrl = Zend_Gdata_App_CaptchaRequiredException::ACCOUNTS_URL.$captchaUrl; - parent::__construct('CAPTCHA challenge issued by server'); - } - - /** - * Retrieves the token identifier as provided by the server. - * - * @return string - */ - public function getCaptchaToken() - { - return $this->captchaToken; - } - - /** - * Retrieves the URL CAPTCHA image as provided by the server. - * - * @return string - */ - public function getCaptchaUrl() - { - return $this->captchaUrl; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Entry.php b/packages/zend-gdata/library/Zend/Gdata/App/Entry.php deleted file mode 100644 index 0b53089ad..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Entry.php +++ /dev/null @@ -1,403 +0,0 @@ -_content) { - $element->appendChild($this->_content->getDOM($element->ownerDocument)); - } - if (null != $this->_published) { - $element->appendChild($this->_published->getDOM($element->ownerDocument)); - } - if (null != $this->_source) { - $element->appendChild($this->_source->getDOM($element->ownerDocument)); - } - if (null != $this->_summary) { - $element->appendChild($this->_summary->getDOM($element->ownerDocument)); - } - if (null != $this->_control) { - $element->appendChild($this->_control->getDOM($element->ownerDocument)); - } - if (null != $this->_edited) { - $element->appendChild($this->_edited->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':content': - $content = new Zend_Gdata_App_Extension_Content(); - $content->transferFromDOM($child); - $this->_content = $content; - break; - case $this->lookupNamespace('atom').':published': - $published = new Zend_Gdata_App_Extension_Published(); - $published->transferFromDOM($child); - $this->_published = $published; - break; - case $this->lookupNamespace('atom').':source': - $source = new Zend_Gdata_App_Extension_Source(); - $source->transferFromDOM($child); - $this->_source = $source; - break; - case $this->lookupNamespace('atom').':summary': - $summary = new Zend_Gdata_App_Extension_Summary(); - $summary->transferFromDOM($child); - $this->_summary = $summary; - break; - case $this->lookupNamespace('app').':control': - $control = new Zend_Gdata_App_Extension_Control(); - $control->transferFromDOM($child); - $this->_control = $control; - break; - case $this->lookupNamespace('app').':edited': - $edited = new Zend_Gdata_App_Extension_Edited(); - $edited->transferFromDOM($child); - $this->_edited = $edited; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Uploads changes in this entry to the server using Zend_Gdata_App. - * - * @param string|null $uri the URI to send requests to, or null if $data - * contains the URI - * @param string|null $className The name of the class that should we - * deserializing the server response. If null, then - * 'Zend_Gdata_App_Entry' will be used. - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Gdata_App_Entry the updated entry - * - * @throws Zend_Gdata_App_Exception - */ - public function save($uri = null, $className = null, $extraHeaders = []) - { - return $this->getService()->updateEntry($this, - $uri, - $className, - $extraHeaders); - } - - /** - * Deletes this entry to the server using the referenced - * Zend_Http_Client to do a HTTP DELETE to the edit link stored in this - * entry's link collection. - * - * @return void - * - * @throws Zend_Gdata_App_Exception - */ - public function delete() - { - $this->getService()->delete($this); - } - - /** - * Reload the current entry. Returns a new copy of the entry as returned - * by the server, or null if no changes exist. This does not - * modify the current entry instance. - * - * @param string|null the URI to send requests to, or null if $data - * contains the URI - * @param string|null The name of the class that should we deserializing - * the server response. If null, then 'Zend_Gdata_App_Entry' will - * be used. - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return mixed a new instance of the current entry with updated data, or - * null if the server reports that no changes have been made - * - * @throws Zend_Gdata_App_Exception - */ - public function reload($uri = null, $className = null, $extraHeaders = []) - { - // Get URI - $editLink = $this->getEditLink(); - if ((null === $uri) && null != $editLink) { - $uri = $editLink->getHref(); - } - - // Set classname to current class, if not otherwise set - if (null === $className) { - $className = get_class($this); - } - - // Append ETag, if present (Gdata v2 and above, only) and doesn't - // conflict with existing headers - if (null != $this->_etag - && !array_key_exists('If-Match', $extraHeaders) - && !array_key_exists('If-None-Match', $extraHeaders)) { - $extraHeaders['If-None-Match'] = $this->_etag; - } - - // If an HTTP 304 status (Not Modified)is returned, then we return - // null. - $result = null; - try { - $result = $this->service->importUrl($uri, $className, $extraHeaders); - } catch (Zend_Gdata_App_HttpException $e) { - if ('304' != $e->getResponse()->getStatus()) { - throw $e; - } - } - - return $result; - } - - /** - * Gets the value of the atom:content element. - * - * @return Zend_Gdata_App_Extension_Content - */ - public function getContent() - { - return $this->_content; - } - - /** - * Sets the value of the atom:content element. - * - * @param Zend_Gdata_App_Extension_Content $value - * - * @return Zend_Gdata_App_Entry Provides a fluent interface - */ - public function setContent($value) - { - $this->_content = $value; - - return $this; - } - - /** - * Sets the value of the atom:published element - * This represents the publishing date for an entry. - * - * @return Zend_Gdata_App_Extension_Published - */ - public function getPublished() - { - return $this->_published; - } - - /** - * Sets the value of the atom:published element - * This represents the publishing date for an entry. - * - * @param Zend_Gdata_App_Extension_Published $value - * - * @return Zend_Gdata_App_Entry Provides a fluent interface - */ - public function setPublished($value) - { - $this->_published = $value; - - return $this; - } - - /** - * Gets the value of the atom:source element. - * - * @return Zend_Gdata_App_Extension_Source - */ - public function getSource() - { - return $this->_source; - } - - /** - * Sets the value of the atom:source element. - * - * @param Zend_Gdata_App_Extension_Source $value - * - * @return Zend_Gdata_App_Entry Provides a fluent interface - */ - public function setSource($value) - { - $this->_source = $value; - - return $this; - } - - /** - * Gets the value of the atom:summary element - * This represents a textual summary of this entry's content. - * - * @return Zend_Gdata_App_Extension_Summary - */ - public function getSummary() - { - return $this->_summary; - } - - /** - * Sets the value of the atom:summary element - * This represents a textual summary of this entry's content. - * - * @param Zend_Gdata_App_Extension_Summary $value - * - * @return Zend_Gdata_App_Entry Provides a fluent interface - */ - public function setSummary($value) - { - $this->_summary = $value; - - return $this; - } - - /** - * Gets the value of the app:control element. - * - * @return Zend_Gdata_App_Extension_Control - */ - public function getControl() - { - return $this->_control; - } - - /** - * Sets the value of the app:control element. - * - * @param Zend_Gdata_App_Extension_Control $value - * - * @return Zend_Gdata_App_Entry Provides a fluent interface - */ - public function setControl($value) - { - $this->_control = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Exception.php b/packages/zend-gdata/library/Zend/Gdata/App/Exception.php deleted file mode 100644 index cd5214ca2..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Exception.php +++ /dev/null @@ -1,41 +0,0 @@ -_term = $term; - $this->_scheme = $scheme; - $this->_label = $label; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_term) { - $element->setAttribute('term', $this->_term); - } - if (null !== $this->_scheme) { - $element->setAttribute('scheme', $this->_scheme); - } - if (null !== $this->_label) { - $element->setAttribute('label', $this->_label); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'term': - $this->_term = $attribute->nodeValue; - break; - case 'scheme': - $this->_scheme = $attribute->nodeValue; - break; - case 'label': - $this->_label = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string|null - */ - public function getTerm() - { - return $this->_term; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Category Provides a fluent interface - */ - public function setTerm($value) - { - $this->_term = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getScheme() - { - return $this->_scheme; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Category Provides a fluent interface - */ - public function setScheme($value) - { - $this->_scheme = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getLabel() - { - return $this->_label; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Category Provides a fluent interface - */ - public function setLabel($value) - { - $this->_label = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Content.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Content.php deleted file mode 100644 index 4d09c3bc5..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Content.php +++ /dev/null @@ -1,88 +0,0 @@ -_src = $src; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_src) { - $element->setAttribute('src', $this->_src); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'src': - $this->_src = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getSrc() - { - return $this->_src; - } - - /** - * @param string $value - * - * @return Zend_Gdata_App_Extension_Content Provides a fluent interface - */ - public function setSrc($value) - { - $this->_src = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Contributor.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Contributor.php deleted file mode 100644 index 0a32ca320..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Contributor.php +++ /dev/null @@ -1,40 +0,0 @@ -_draft = $draft; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_draft) { - $element->appendChild($this->_draft->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('app').':draft': - $draft = new Zend_Gdata_App_Extension_Draft(); - $draft->transferFromDOM($child); - $this->_draft = $draft; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * @return Zend_Gdata_App_Extension_Draft - */ - public function getDraft() - { - return $this->_draft; - } - - /** - * @param Zend_Gdata_App_Extension_Draft $value - * - * @return Zend_Gdata_App_Extension_Control Provides a fluent interface - */ - public function setDraft($value) - { - $this->_draft = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Draft.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Draft.php deleted file mode 100644 index 874bb46c3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Draft.php +++ /dev/null @@ -1,47 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Edited.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Edited.php deleted file mode 100644 index 0ec07bc77..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Edited.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Element.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Element.php deleted file mode 100644 index 1a44ab22b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Element.php +++ /dev/null @@ -1,56 +0,0 @@ -_rootElement = $rootElement; - $this->_rootNamespace = $rootNamespace; - $this->_rootNamespaceURI = $rootNamespaceURI; - $this->_text = $text; - } - - public function transferFromDOM($node) - { - parent::transferFromDOM($node); - $this->_rootNamespace = null; - $this->_rootNamespaceURI = $node->namespaceURI; - $this->_rootElement = $node->localName; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Email.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Email.php deleted file mode 100644 index ad35bc63f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Email.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Generator.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Generator.php deleted file mode 100644 index 39ecc93f5..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Generator.php +++ /dev/null @@ -1,117 +0,0 @@ -_text = $text; - $this->_uri = $uri; - $this->_version = $version; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_uri) { - $element->setAttribute('uri', $this->_uri); - } - if (null !== $this->_version) { - $element->setAttribute('version', $this->_version); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'uri': - $this->_uri = $attribute->nodeValue; - break; - case 'version': - $this->_version = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return Zend_Gdata_App_Extension_Uri - */ - public function getUri() - { - return $this->_uri; - } - - /** - * @param Zend_Gdata_App_Extension_Uri $value - * - * @return Zend_Gdata_App_Extension_Generator Provides a fluent interface - */ - public function setUri($value) - { - $this->_uri = $value; - - return $this; - } - - /** - * @return Zend_Gdata_App_Extension_Version - */ - public function getVersion() - { - return $this->_version; - } - - /** - * @param Zend_Gdata_App_Extension_Version $value - * - * @return Zend_Gdata_App_Extension_Generator Provides a fluent interface - */ - public function setVersion($value) - { - $this->_version = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Icon.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Icon.php deleted file mode 100644 index 10b2fd3c0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Icon.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Id.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Id.php deleted file mode 100644 index 395e1600e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Id.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Link.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Link.php deleted file mode 100644 index 03323e3bc..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Link.php +++ /dev/null @@ -1,229 +0,0 @@ -_href = $href; - $this->_rel = $rel; - $this->_type = $type; - $this->_hrefLang = $hrefLang; - $this->_title = $title; - $this->_length = $length; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_href) { - $element->setAttribute('href', $this->_href); - } - if (null !== $this->_rel) { - $element->setAttribute('rel', $this->_rel); - } - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - if (null !== $this->_hrefLang) { - $element->setAttribute('hreflang', $this->_hrefLang); - } - if (null !== $this->_title) { - $element->setAttribute('title', $this->_title); - } - if (null !== $this->_length) { - $element->setAttribute('length', $this->_length); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'href': - $this->_href = $attribute->nodeValue; - break; - case 'rel': - $this->_rel = $attribute->nodeValue; - break; - case 'type': - $this->_type = $attribute->nodeValue; - break; - case 'hreflang': - $this->_hrefLang = $attribute->nodeValue; - break; - case 'title': - $this->_title = $attribute->nodeValue; - break; - case 'length': - $this->_length = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string|null - */ - public function getHref() - { - return $this->_href; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Link Provides a fluent interface - */ - public function setHref($value) - { - $this->_href = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getRel() - { - return $this->_rel; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Link Provides a fluent interface - */ - public function setRel($value) - { - $this->_rel = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getType() - { - return $this->_type; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Link Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getHrefLang() - { - return $this->_hrefLang; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Link Provides a fluent interface - */ - public function setHrefLang($value) - { - $this->_hrefLang = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getTitle() - { - return $this->_title; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Link Provides a fluent interface - */ - public function setTitle($value) - { - $this->_title = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getLength() - { - return $this->_length; - } - - /** - * @param string|null $value - * - * @return Zend_Gdata_App_Extension_Link Provides a fluent interface - */ - public function setLength($value) - { - $this->_length = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Logo.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Logo.php deleted file mode 100644 index 90795b262..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Logo.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Name.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Name.php deleted file mode 100644 index 144a8c00c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Name.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Person.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Person.php deleted file mode 100644 index cd4caa755..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Person.php +++ /dev/null @@ -1,167 +0,0 @@ -_name = $name; - $this->_email = $email; - $this->_uri = $uri; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_name) { - $element->appendChild($this->_name->getDOM($element->ownerDocument)); - } - if (null != $this->_email) { - $element->appendChild($this->_email->getDOM($element->ownerDocument)); - } - if (null != $this->_uri) { - $element->appendChild($this->_uri->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':name': - $name = new Zend_Gdata_App_Extension_Name(); - $name->transferFromDOM($child); - $this->_name = $name; - break; - case $this->lookupNamespace('atom').':email': - $email = new Zend_Gdata_App_Extension_Email(); - $email->transferFromDOM($child); - $this->_email = $email; - break; - case $this->lookupNamespace('atom').':uri': - $uri = new Zend_Gdata_App_Extension_Uri(); - $uri->transferFromDOM($child); - $this->_uri = $uri; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * @return Zend_Gdata_App_Extension_Name - */ - public function getName() - { - return $this->_name; - } - - /** - * @param Zend_Gdata_App_Extension_Name $value - * - * @return Zend_Gdata_App_Extension_Person Provides a fluent interface - */ - public function setName($value) - { - $this->_name = $value; - - return $this; - } - - /** - * @return Zend_Gdata_App_Extension_Email - */ - public function getEmail() - { - return $this->_email; - } - - /** - * @param Zend_Gdata_App_Extension_Email $value - * - * @return Zend_Gdata_App_Extension_Person Provides a fluent interface - */ - public function setEmail($value) - { - $this->_email = $value; - - return $this; - } - - /** - * @return Zend_Gdata_App_Extension_Uri - */ - public function getUri() - { - return $this->_uri; - } - - /** - * @param Zend_Gdata_App_Extension_Uri $value - * - * @return Zend_Gdata_App_Extension_Person Provides a fluent interface - */ - public function setUri($value) - { - $this->_uri = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Published.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Published.php deleted file mode 100644 index ada99209b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Published.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Rights.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Rights.php deleted file mode 100644 index f8596398b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Rights.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Source.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Source.php deleted file mode 100644 index e11afb5d0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Source.php +++ /dev/null @@ -1,43 +0,0 @@ -_text = $text; - $this->_type = $type; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'type': - $this->_type = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /* - * @return Zend_Gdata_App_Extension_Type - */ - public function getType() - { - return $this->_type; - } - - /* - * @param string $value - * @return Zend_Gdata_App_Extension_Text Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Title.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Title.php deleted file mode 100644 index 3e68e513d..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Title.php +++ /dev/null @@ -1,40 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Uri.php b/packages/zend-gdata/library/Zend/Gdata/App/Extension/Uri.php deleted file mode 100644 index 8bb4b9df4..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Extension/Uri.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/Feed.php b/packages/zend-gdata/library/Zend/Gdata/App/Feed.php deleted file mode 100644 index cb155a190..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/Feed.php +++ /dev/null @@ -1,367 +0,0 @@ -entries as $entry) or foreach - * ($feed->entry as $entry). - * - * @param string $var the property to get - */ - public function __get($var) - { - switch ($var) { - case 'entries': - return $this; - default: - return parent::__get($var); - } - } - - /** - * Retrieves the DOM model representing this object and all children. - * - * @param DOMDocument $doc - * - * @return DOMElement - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - foreach ($this->_entry as $entry) { - $element->appendChild($entry->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':entry': - $newEntry = new $this->_entryClassName($child); - $newEntry->setHttpClient($this->getHttpClient()); - $newEntry->setMajorProtocolVersion($this->getMajorProtocolVersion()); - $newEntry->setMinorProtocolVersion($this->getMinorProtocolVersion()); - $this->_entry[] = $newEntry; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the number of entries in this feed object. - * - * @return int entry count - */ - #[ReturnTypeWillChange] - public function count() - { - return count($this->_entry); - } - - /** - * Required by the Iterator interface. - * - * @return void - */ - #[ReturnTypeWillChange] - public function rewind() - { - $this->_entryIndex = 0; - } - - /** - * Required by the Iterator interface. - * - * @return mixed the current row, or null if no rows - */ - #[ReturnTypeWillChange] - public function current() - { - return $this->_entry[$this->_entryIndex]; - } - - /** - * Required by the Iterator interface. - * - * @return int The current row number (starts at 0), or NULL if no rows - */ - #[ReturnTypeWillChange] - public function key() - { - return $this->_entryIndex; - } - - /** - * Required by the Iterator interface. - * - * @return void the next row, or null if no more rows - */ - #[ReturnTypeWillChange] - public function next() - { - ++$this->_entryIndex; - } - - /** - * Required by the Iterator interface. - * - * @return bool Whether the iteration is valid - */ - #[ReturnTypeWillChange] - public function valid() - { - return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); - } - - /** - * Gets the array of atom:entry elements contained within this - * atom:feed representation. - * - * @return array Zend_Gdata_App_Entry array - */ - public function getEntry() - { - return $this->_entry; - } - - /** - * Sets the array of atom:entry elements contained within this - * atom:feed representation. - * - * @param array $value The array of Zend_Gdata_App_Entry elements - * - * @return Zend_Gdata_App_Feed Provides a fluent interface - */ - public function setEntry($value) - { - $this->_entry = $value; - - return $this; - } - - /** - * Adds an entry representation to the array of entries - * contained within this feed. - * - * @param Zend_Gdata_App_Entry an individual entry to add - * - * @return Zend_Gdata_App_Feed Provides a fluent interface - */ - public function addEntry($value) - { - $this->_entry[] = $value; - - return $this; - } - - /** - * Required by the ArrayAccess interface. - * - * @param int $key The index to set - * @param Zend_Gdata_App_Entry $value The value to set - * - * @return void - */ - #[ReturnTypeWillChange] - public function offsetSet($key, $value) - { - $this->_entry[$key] = $value; - } - - /** - * Required by the ArrayAccess interface. - * - * @param int $key The index to get - */ - #[ReturnTypeWillChange] - public function offsetGet($key) - { - if (array_key_exists($key, $this->_entry)) { - return $this->_entry[$key]; - } - } - - /** - * Required by the ArrayAccess interface. - * - * @param int $key The index to set - */ - #[ReturnTypeWillChange] - public function offsetUnset($key) - { - if (array_key_exists($key, $this->_entry)) { - unset($this->_entry[$key]); - } - } - - /** - * Required by the ArrayAccess interface. - * - * @param int $key The index to check for existence - * - * @return bool - */ - #[ReturnTypeWillChange] - public function offsetExists($key) - { - return array_key_exists($key, $this->_entry); - } - - /** - * Retrieve the next set of results from this feed. - * - * @return string|Zend_Gdata_App_Feed returns the next set of results as a feed of the same - * class as this feed, or null if no results exist - * - * @throws Zend_Gdata_App_Exception - */ - public function getNextFeed() - { - $nextLink = $this->getNextLink(); - if (!$nextLink) { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_Exception('No link to next set of results found.'); - } - $nextLinkHref = $nextLink->getHref(); - $service = new Zend_Gdata_App($this->getHttpClient()); - - return $service->getFeed($nextLinkHref, get_class($this)); - } - - /** - * Retrieve the previous set of results from this feed. - * - * @return string|Zend_Gdata_App_Feed returns the previous set of results as a feed of - * the same class as this feed, or null if no results exist - * - * @throws Zend_Gdata_App_Exception - */ - public function getPreviousFeed() - { - $previousLink = $this->getPreviousLink(); - if (!$previousLink) { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_Exception('No link to previous set of results found.'); - } - $previousLinkHref = $previousLink->getHref(); - $service = new Zend_Gdata_App($this->getHttpClient()); - - return $service->getFeed($previousLinkHref, get_class($this)); - } - - /** - * Set the major protocol version that should be used. Values < 1 will - * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. - * - * This value will be propogated to all child entries. - * - * @see _majorProtocolVersion - * - * @param (int|null) $value the major protocol version to use - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setMajorProtocolVersion($value) - { - parent::setMajorProtocolVersion($value); - foreach ($this->entries as $entry) { - $entry->setMajorProtocolVersion($value); - } - } - - /** - * Set the minor protocol version that should be used. If set to NULL, no - * minor protocol version will be sent to the server. Values < 0 will - * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. - * - * This value will be propogated to all child entries. - * - * @see _minorProtocolVersion - * - * @param (int|null) $value the minor protocol version to use - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setMinorProtocolVersion($value) - { - parent::setMinorProtocolVersion($value); - foreach ($this->entries as $entry) { - $entry->setMinorProtocolVersion($value); - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/FeedEntryParent.php b/packages/zend-gdata/library/Zend/Gdata/App/FeedEntryParent.php deleted file mode 100644 index 2e2fa33e3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/FeedEntryParent.php +++ /dev/null @@ -1,712 +0,0 @@ -= 1 is considered valid. - * - * @see setMajorProtocolVersion() - * @see getMajorProtocolVersion() - */ - protected $_majorProtocolVersion = 1; - - /** - * Indicates the minor protocol version that should be used. Can be set - * to either an integer >= 0, or NULL if no minor version should be sent - * to the server. - * - * @see setMinorProtocolVersion() - * @see getMinorProtocolVersion() - */ - protected $_minorProtocolVersion; - - /** - * Constructs a Feed or Entry. - */ - public function __construct($element = null) - { - if (!($element instanceof DOMElement)) { - if ($element) { - $this->transferFromXML($element); - } - } else { - $this->transferFromDOM($element); - } - } - - /** - * Set the HTTP client instance. - * - * Sets the HTTP client object to use for retrieving the feed. - * - * @deprecated Deprecated as of Zend Framework 1.7. Use - * setService() instead. - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setHttpClient(Zend_Http_Client $httpClient) - { - if (!$this->_service) { - $this->_service = new Zend_Gdata_App(); - } - $this->_service->setHttpClient($httpClient); - - return $this; - } - - /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client - * will be used. - * - * @return Zend_Http_Client - * - *@deprecated Deprecated as of Zend Framework 1.7. Use - * getService() instead. - */ - public function getHttpClient() - { - if (!$this->_service) { - $this->_service = new Zend_Gdata_App(); - } - $client = $this->_service->getHttpClient(); - - return $client; - } - - /** - * Set the active service instance for this object. This will be used to - * perform network requests, such as when calling save() and delete(). - * - * @param Zend_Gdata_App $instance the new service instance - * - * @return Zend_Gdata_App_FeedEntryParent provides a fluent interface - */ - public function setService($instance) - { - $this->_service = $instance; - - return $this; - } - - /** - * Get the active service instance for this object. This will be used to - * perform network requests, such as when calling save() and delete(). - * - * @return Zend_Gdata_App|null the current service instance, or null if - * not set - */ - public function getService() - { - return $this->_service; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - foreach ($this->_author as $author) { - $element->appendChild($author->getDOM($element->ownerDocument)); - } - foreach ($this->_category as $category) { - $element->appendChild($category->getDOM($element->ownerDocument)); - } - foreach ($this->_contributor as $contributor) { - $element->appendChild($contributor->getDOM($element->ownerDocument)); - } - if (null != $this->_id) { - $element->appendChild($this->_id->getDOM($element->ownerDocument)); - } - foreach ($this->_link as $link) { - $element->appendChild($link->getDOM($element->ownerDocument)); - } - if (null != $this->_rights) { - $element->appendChild($this->_rights->getDOM($element->ownerDocument)); - } - if (null != $this->_title) { - $element->appendChild($this->_title->getDOM($element->ownerDocument)); - } - if (null != $this->_updated) { - $element->appendChild($this->_updated->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':author': - $author = new Zend_Gdata_App_Extension_Author(); - $author->transferFromDOM($child); - $this->_author[] = $author; - break; - case $this->lookupNamespace('atom').':category': - $category = new Zend_Gdata_App_Extension_Category(); - $category->transferFromDOM($child); - $this->_category[] = $category; - break; - case $this->lookupNamespace('atom').':contributor': - $contributor = new Zend_Gdata_App_Extension_Contributor(); - $contributor->transferFromDOM($child); - $this->_contributor[] = $contributor; - break; - case $this->lookupNamespace('atom').':id': - $id = new Zend_Gdata_App_Extension_Id(); - $id->transferFromDOM($child); - $this->_id = $id; - break; - case $this->lookupNamespace('atom').':link': - $link = new Zend_Gdata_App_Extension_Link(); - $link->transferFromDOM($child); - $this->_link[] = $link; - break; - case $this->lookupNamespace('atom').':rights': - $rights = new Zend_Gdata_App_Extension_Rights(); - $rights->transferFromDOM($child); - $this->_rights = $rights; - break; - case $this->lookupNamespace('atom').':title': - $title = new Zend_Gdata_App_Extension_Title(); - $title->transferFromDOM($child); - $this->_title = $title; - break; - case $this->lookupNamespace('atom').':updated': - $updated = new Zend_Gdata_App_Extension_Updated(); - $updated->transferFromDOM($child); - $this->_updated = $updated; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * @return array - */ - public function getAuthor() - { - return $this->_author; - } - - /** - * Sets the list of the authors of this feed/entry. In an atom feed, each - * author is represented by an atom:author element. - * - * @param array $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setAuthor($value) - { - $this->_author = $value; - - return $this; - } - - /** - * Returns the array of categories that classify this feed/entry. Each - * category is represented in an atom feed by an atom:category element. - * - * @return array Array of Zend_Gdata_App_Extension_Category - */ - public function getCategory() - { - return $this->_category; - } - - /** - * Sets the array of categories that classify this feed/entry. Each - * category is represented in an atom feed by an atom:category element. - * - * @param array $value Array of Zend_Gdata_App_Extension_Category - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setCategory($value) - { - $this->_category = $value; - - return $this; - } - - /** - * Returns the array of contributors to this feed/entry. Each contributor - * is represented in an atom feed by an atom:contributor XML element. - * - * @return array An array of Zend_Gdata_App_Extension_Contributor - */ - public function getContributor() - { - return $this->_contributor; - } - - /** - * Sets the array of contributors to this feed/entry. Each contributor - * is represented in an atom feed by an atom:contributor XML element. - * - * @param array $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setContributor($value) - { - $this->_contributor = $value; - - return $this; - } - - /** - * @return Zend_Gdata_App_Extension_Id|null - */ - public function getId() - { - return $this->_id; - } - - /** - * @param Zend_Gdata_App_Extension_Id $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setId($value) - { - $this->_id = $value; - - return $this; - } - - /** - * Given a particular 'rel' value, this method returns a matching - * Zend_Gdata_App_Extension_Link element. If the 'rel' value - * is not provided, the full array of Zend_Gdata_App_Extension_Link - * elements is returned. In an atom feed, each link is represented - * by an atom:link element. The 'rel' value passed to this function - * is the atom:link/@rel attribute. Example rel values include 'self', - * 'edit', and 'alternate'. - * - * @param string $rel The rel value of the link to be found. If null, - * the array of Zend_Gdata_App_Extension_link elements is returned - * - * @return mixed Either a single Zend_Gdata_App_Extension_link element, - * an array of the same or null is returned depending on the rel value - * supplied as the argument to this function - */ - public function getLink($rel = null) - { - if (null == $rel) { - return $this->_link; - } else { - foreach ($this->_link as $link) { - if ($link->rel == $rel) { - return $link; - } - } - - return null; - } - } - - /** - * Returns the Zend_Gdata_App_Extension_Link element which represents - * the URL used to edit this resource. This link is in the atom feed/entry - * as an atom:link with a rel attribute value of 'edit'. - * - * @return Zend_Gdata_App_Extension_Link The link, or null if not found - */ - public function getEditLink() - { - return $this->getLink('edit'); - } - - /** - * Returns the Zend_Gdata_App_Extension_Link element which represents - * the URL used to retrieve the next chunk of results when paging through - * a feed. This link is in the atom feed as an atom:link with a - * rel attribute value of 'next'. - * - * @return Zend_Gdata_App_Extension_Link The link, or null if not found - */ - public function getNextLink() - { - return $this->getLink('next'); - } - - /** - * Returns the Zend_Gdata_App_Extension_Link element which represents - * the URL used to retrieve the previous chunk of results when paging - * through a feed. This link is in the atom feed as an atom:link with a - * rel attribute value of 'previous'. - * - * @return Zend_Gdata_App_Extension_Link The link, or null if not found - */ - public function getPreviousLink() - { - return $this->getLink('previous'); - } - - /** - * @return Zend_Gdata_App_Extension_Link - */ - public function getLicenseLink() - { - return $this->getLink('license'); - } - - /** - * Returns the Zend_Gdata_App_Extension_Link element which represents - * the URL used to retrieve the entry or feed represented by this object - * This link is in the atom feed/entry as an atom:link with a - * rel attribute value of 'self'. - * - * @return Zend_Gdata_App_Extension_Link The link, or null if not found - */ - public function getSelfLink() - { - return $this->getLink('self'); - } - - /** - * Returns the Zend_Gdata_App_Extension_Link element which represents - * the URL for an alternate view of the data represented by this feed or - * entry. This alternate view is commonly a user-facing webpage, blog - * post, etc. The MIME type for the data at the URL is available from the - * returned Zend_Gdata_App_Extension_Link element. - * This link is in the atom feed/entry as an atom:link with a - * rel attribute value of 'self'. - * - * @return Zend_Gdata_App_Extension_Link The link, or null if not found - */ - public function getAlternateLink() - { - return $this->getLink('alternate'); - } - - /** - * @param array $value The array of Zend_Gdata_App_Extension_Link elements - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setLink($value) - { - $this->_link = $value; - - return $this; - } - - /** - * @return Zend_Gdata_AppExtension_Rights|null - */ - public function getRights() - { - return $this->_rights; - } - - /** - * @param Zend_Gdata_App_Extension_Rights $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setRights($value) - { - $this->_rights = $value; - - return $this; - } - - /** - * Returns the title of this feed or entry. The title is an extremely - * short textual representation of this resource and is found as - * an atom:title element in a feed or entry. - * - * @return Zend_Gdata_App_Extension_Title|null - */ - public function getTitle() - { - return $this->_title; - } - - /** - * Returns a string representation of the title of this feed or entry. - * The title is an extremely short textual representation of this - * resource and is found as an atom:title element in a feed or entry. - * - * @return string - */ - public function getTitleValue() - { - if (($titleObj = $this->getTitle()) != null) { - return $titleObj->getText(); - } else { - return null; - } - } - - /** - * Returns the title of this feed or entry. The title is an extremely - * short textual representation of this resource and is found as - * an atom:title element in a feed or entry. - * - * @param Zend_Gdata_App_Extension_Title $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setTitle($value) - { - $this->_title = $value; - - return $this; - } - - /** - * @return Zend_Gdata_App_Extension_Updated|null - */ - public function getUpdated() - { - return $this->_updated; - } - - /** - * @param Zend_Gdata_App_Extension_Updated $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setUpdated($value) - { - $this->_updated = $value; - - return $this; - } - - /** - * Set the Etag for the current entry to $value. Setting $value to null - * unsets the Etag. - * - * @param string|null $value - * - * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface - */ - public function setEtag($value) - { - $this->_etag = $value; - - return $this; - } - - /** - * Return the Etag for the current entry, or null if not set. - * - * @return string|null - */ - public function getEtag() - { - return $this->_etag; - } - - /** - * Set the major protocol version that should be used. Values < 1 - * (excluding NULL) will cause a Zend_Gdata_App_InvalidArgumentException - * to be thrown. - * - * @see _majorProtocolVersion - * - * @param (int|null) $value the major protocol version to use - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setMajorProtocolVersion($value) - { - if (!($value >= 1) && (null !== $value)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Major protocol version must be >= 1'); - } - $this->_majorProtocolVersion = $value; - } - - /** - * Get the major protocol version that is in use. - * - * @see _majorProtocolVersion - * - * @return (int|null) the major protocol version in use - */ - public function getMajorProtocolVersion() - { - return $this->_majorProtocolVersion; - } - - /** - * Set the minor protocol version that should be used. If set to NULL, no - * minor protocol version will be sent to the server. Values < 0 will - * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. - * - * @see _minorProtocolVersion - * - * @param (int|null) $value the minor protocol version to use - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setMinorProtocolVersion($value) - { - if (!($value >= 0)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Minor protocol version must be >= 0 or null'); - } - $this->_minorProtocolVersion = $value; - } - - /** - * Get the minor protocol version that is in use. - * - * @see _minorProtocolVersion - * - * @return (int|null) the major protocol version in use, or NULL if no - * minor version is specified - */ - public function getMinorProtocolVersion() - { - return $this->_minorProtocolVersion; - } - - /** - * Get the full version of a namespace prefix. - * - * Looks up a prefix (atom:, etc.) in the list of registered - * namespaces and returns the full namespace URI if - * available. Returns the prefix, unmodified, if it's not - * registered. - * - * The current entry or feed's version will be used when performing the - * namespace lookup unless overridden using $majorVersion and - * $minorVersion. If the entry/fee has a null version, then the latest - * protocol version will be used by default. - * - * @param string $prefix the namespace prefix to lookup - * @param int $majorVersion The major protocol version in effect. - * Defaults to null (auto-select). - * @param int $minorVersion The minor protocol version in effect. - * Defaults to null (auto-select). - * - * @return string - */ - public function lookupNamespace($prefix, - $majorVersion = null, - $minorVersion = null) - { - // Auto-select current version - if (null === $majorVersion) { - $majorVersion = $this->getMajorProtocolVersion(); - } - if (null === $minorVersion) { - $minorVersion = $this->getMinorProtocolVersion(); - } - - // Perform lookup - return parent::lookupNamespace($prefix, $majorVersion, $minorVersion); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/FeedSourceParent.php b/packages/zend-gdata/library/Zend/Gdata/App/FeedSourceParent.php deleted file mode 100644 index 3c42d2b46..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/FeedSourceParent.php +++ /dev/null @@ -1,274 +0,0 @@ -_entry as $entry) { - $entry->setHttpClient($httpClient); - } - - return $this; - } - - /** - * Set the active service instance for this feed and all enclosed entries. - * This will be used to perform network requests, such as when calling - * save() and delete(). - * - * @param Zend_Gdata_App $instance the new service instance - * - * @return Zend_Gdata_App_FeedEntryParent provides a fluent interface - */ - public function setService($instance) - { - parent::setService($instance); - foreach ($this->_entry as $entry) { - $entry->setService($instance); - } - - return $this; - } - - /** - * Make accessing some individual elements of the feed easier. - * - * Special accessors 'entry' and 'entries' are provided so that if - * you wish to iterate over an Atom feed's entries, you can do so - * using foreach ($feed->entries as $entry) or foreach - * ($feed->entry as $entry). - * - * @param string $var the property to access - */ - public function __get($var) - { - switch ($var) { - default: - return parent::__get($var); - } - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_generator) { - $element->appendChild($this->_generator->getDOM($element->ownerDocument)); - } - if (null != $this->_icon) { - $element->appendChild($this->_icon->getDOM($element->ownerDocument)); - } - if (null != $this->_logo) { - $element->appendChild($this->_logo->getDOM($element->ownerDocument)); - } - if (null != $this->_subtitle) { - $element->appendChild($this->_subtitle->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':generator': - $generator = new Zend_Gdata_App_Extension_Generator(); - $generator->transferFromDOM($child); - $this->_generator = $generator; - break; - case $this->lookupNamespace('atom').':icon': - $icon = new Zend_Gdata_App_Extension_Icon(); - $icon->transferFromDOM($child); - $this->_icon = $icon; - break; - case $this->lookupNamespace('atom').':logo': - $logo = new Zend_Gdata_App_Extension_Logo(); - $logo->transferFromDOM($child); - $this->_logo = $logo; - break; - case $this->lookupNamespace('atom').':subtitle': - $subtitle = new Zend_Gdata_App_Extension_Subtitle(); - $subtitle->transferFromDOM($child); - $this->_subtitle = $subtitle; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * @return Zend_Gdata_AppExtension_Generator|null - */ - public function getGenerator() - { - return $this->_generator; - } - - /** - * @param Zend_Gdata_App_Extension_Generator $value - * - * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface - */ - public function setGenerator($value) - { - $this->_generator = $value; - - return $this; - } - - /** - * @return Zend_Gdata_AppExtension_Icon|null - */ - public function getIcon() - { - return $this->_icon; - } - - /** - * @param Zend_Gdata_App_Extension_Icon $value - * - * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface - */ - public function setIcon($value) - { - $this->_icon = $value; - - return $this; - } - - /** - * @return Zend_Gdata_AppExtension_logo|null - */ - public function getlogo() - { - return $this->_logo; - } - - /** - * @param Zend_Gdata_App_Extension_logo $value - * - * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface - */ - public function setlogo($value) - { - $this->_logo = $value; - - return $this; - } - - /** - * @return Zend_Gdata_AppExtension_Subtitle|null - */ - public function getSubtitle() - { - return $this->_subtitle; - } - - /** - * @param Zend_Gdata_App_Extension_Subtitle $value - * - * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface - */ - public function setSubtitle($value) - { - $this->_subtitle = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/HttpException.php b/packages/zend-gdata/library/Zend/Gdata/App/HttpException.php deleted file mode 100644 index 811a62ce0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/HttpException.php +++ /dev/null @@ -1,122 +0,0 @@ -_httpClientException = $e; - $this->_response = $response; - parent::__construct($message); - } - - /** - * Get the Zend_Http_Client_Exception. - * - * @return Zend_Http_Client_Exception - */ - public function getHttpClientException() - { - return $this->_httpClientException; - } - - /** - * Set the Zend_Http_Client_Exception. - * - * @param Zend_Http_Client_Exception $value - */ - public function setHttpClientException($value) - { - $this->_httpClientException = $value; - - return $this; - } - - /** - * Set the Zend_Http_Response. - * - * @param Zend_Http_Response $response - */ - public function setResponse($response) - { - $this->_response = $response; - - return $this; - } - - /** - * Get the Zend_Http_Response. - * - * @return Zend_Http_Response - */ - public function getResponse() - { - return $this->_response; - } - - /** - * Get the body of the Zend_Http_Response. - * - * @return string - */ - public function getRawResponseBody() - { - if ($this->getResponse()) { - $response = $this->getResponse(); - - return $response->getRawBody(); - } - - return null; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/IOException.php b/packages/zend-gdata/library/Zend/Gdata/App/IOException.php deleted file mode 100644 index 8d4eb2d73..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/IOException.php +++ /dev/null @@ -1,41 +0,0 @@ -log_handle) { - $this->log_handle = fopen($this->config['logfile'], 'a'); - } - fwrite($this->log_handle, $message); - } - - /** - * Connect to the remote server. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - $this->log("Connecting to: {$host}:{$port}"); - - return parent::connect($host, $port, $secure); - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') - { - $request = parent::write($method, $uri, $http_ver, $headers, $body); - $this->log("\n\n".$request); - - return $request; - } - - /** - * Read response from server. - * - * @return string - */ - public function read() - { - $response = parent::read(); - $this->log("{$response}\n\n"); - - return $response; - } - - /** - * Close the connection to the server. - */ - public function close() - { - $this->log("Closing socket\n\n"); - parent::close(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/MediaEntry.php b/packages/zend-gdata/library/Zend/Gdata/App/MediaEntry.php deleted file mode 100644 index ab230a666..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/MediaEntry.php +++ /dev/null @@ -1,118 +0,0 @@ -_mediaSource = $mediaSource; - } - - /** - * Return the MIME multipart representation of this MediaEntry. - * - * @return string|Zend_Gdata_MediaMimeStream The MIME multipart - * representation of this MediaEntry. If the entry consisted only - * of XML, a string is returned. - */ - public function encode() - { - $xmlData = $this->saveXML(); - $mediaSource = $this->getMediaSource(); - if (null === $mediaSource) { - // No attachment, just send XML for entry - return $xmlData; - } else { - return new Zend_Gdata_MediaMimeStream($xmlData, - $mediaSource->getFilename(), $mediaSource->getContentType()); - } - } - - /** - * Return the MediaSource object representing the file attached to this - * MediaEntry. - * - * @return Zend_Gdata_App_MediaSource The attached MediaSource/file - */ - public function getMediaSource() - { - return $this->_mediaSource; - } - - /** - * Set the MediaSource object (file) for this MediaEntry. - * - * @param Zend_Gdata_App_MediaSource $value The attached MediaSource/file - * - * @return Zend_Gdata_App_MediaEntry Provides a fluent interface - */ - public function setMediaSource($value) - { - if ($value instanceof Zend_Gdata_App_MediaSource) { - $this->_mediaSource = $value; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.'); - } - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/MediaFileSource.php b/packages/zend-gdata/library/Zend/Gdata/App/MediaFileSource.php deleted file mode 100644 index 6826e72a5..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/MediaFileSource.php +++ /dev/null @@ -1,147 +0,0 @@ -setFilename($filename); - } - - /** - * Return the MIME multipart representation of this MediaEntry. - * - * @return string - * - * @throws Zend_Gdata_App_IOException - */ - public function encode() - { - if (null !== $this->getFilename() - && is_readable($this->getFilename())) { - // Retrieves the file, using the include path - $fileHandle = fopen($this->getFilename(), 'r', true); - $result = fread($fileHandle, filesize($this->getFilename())); - if (false === $result) { - // require_once 'Zend/Gdata/App/IOException.php'; - throw new Zend_Gdata_App_IOException('Error reading file - '.$this->getFilename().'. Read failed.'); - } - fclose($fileHandle); - - return $result; - } else { - // require_once 'Zend/Gdata/App/IOException.php'; - throw new Zend_Gdata_App_IOException('Error reading file - '.$this->getFilename().'. File is not readable.'); - } - } - - /** - * Get the filename associated with this reader. - * - * @return string - */ - public function getFilename() - { - return $this->_filename; - } - - /** - * Set the filename which is to be read. - * - * @param string $value the desired file handle - * - * @return Zend_Gdata_App_MediaFileSource provides a fluent interface - */ - public function setFilename($value) - { - $this->_filename = $value; - - return $this; - } - - /** - * The content type for the file attached (example image/png). - * - * @return string The content type - */ - public function getContentType() - { - return $this->_contentType; - } - - /** - * Set the content type for the file attached (example image/png). - * - * @param string $value The content type - * - * @return Zend_Gdata_App_MediaFileSource Provides a fluent interface - */ - public function setContentType($value) - { - $this->_contentType = $value; - - return $this; - } - - /** - * Alias for getFilename(). - * - * @return string - */ - public function __toString() - { - return $this->getFilename(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/MediaSource.php b/packages/zend-gdata/library/Zend/Gdata/App/MediaSource.php deleted file mode 100644 index f1bce54f3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/MediaSource.php +++ /dev/null @@ -1,74 +0,0 @@ - 0) { - // timestamp is already properly formatted - return $timestamp; - } else { - $ts = strtotime($timestamp); - if (false === $ts) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException("Invalid timestamp: $timestamp."); - } - - return date('Y-m-d\TH:i:s', $ts); - } - } - - /** Find the greatest key that is less than or equal to a given upper - * bound, and return the value associated with that key. - * - * @param int|null $maximumKey The upper bound for keys. If null, the - * maxiumum valued key will be found. - * @param array $collection an two-dimensional array of key/value pairs - * to search through - * - * @returns mixed The value corresponding to the located key. - * - * @throws Zend_Gdata_App_Exception thrown if $collection is empty - */ - public static function findGreatestBoundedValue($maximumKey, $collection) - { - $found = false; - $foundKey = $maximumKey; - - // Sanity check: Make sure that the collection isn't empty - if (0 == sizeof($collection)) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Empty namespace collection encountered.'); - } - - if (null === $maximumKey) { - // If the key is null, then we return the maximum available - $keys = array_keys($collection); - sort($keys); - $found = true; - $foundKey = end($keys); - } else { - // Otherwise, we optimistically guess that the current version - // will have a matching namespce. If that fails, we decrement the - // version until we find a match. - while (!$found && $foundKey >= 0) { - if (array_key_exists($foundKey, $collection)) { - $found = true; - } else { - --$foundKey; - } - } - } - - // Guard: A namespace wasn't found. Either none were registered, or - // the current protcol version is lower than the maximum namespace. - if (!$found) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Namespace compatible with current protocol not found.'); - } - - return $foundKey; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/App/VersionException.php b/packages/zend-gdata/library/Zend/Gdata/App/VersionException.php deleted file mode 100644 index 82a7fca3c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/App/VersionException.php +++ /dev/null @@ -1,41 +0,0 @@ -filterHttpRequest('GET', $request_uri); - $url = $filterResult['url']; - $headers = $filterResult['headers']; - $client->setHeaders($headers); - $client->setUri($url); - } else { - $client->setUri($request_uri); - } - - try { - $response = $client->request('GET'); - } catch (Zend_Http_Client_Exception $e) { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); - } - - // Parse Google's response - if ($response->isSuccessful()) { - $goog_resp = []; - foreach (explode("\n", $response->getBody()) as $l) { - $l = chop($l); - if ($l) { - list($key, $val) = explode('=', chop($l), 2); - $goog_resp[$key] = $val; - } - } - - return $goog_resp['Token']; - } else { - // require_once 'Zend/Gdata/App/AuthException.php'; - throw new Zend_Gdata_App_AuthException('Token upgrade failed. Reason: '.$response->getBody()); - } - } - - /** - * Revoke a token. - * - * @param string $token The token to revoke - * @param Zend_Http_Client $client (optional) HTTP client to use to make the request - * @param string $request_uri (optional) URI to which to direct the revokation request - * - * @return bool Whether the revokation was successful - * - * @throws Zend_Gdata_App_HttpException - */ - public static function AuthSubRevokeToken($token, $client = null, - $request_uri = self::AUTHSUB_REVOKE_TOKEN_URI) - { - $client = self::getHttpClient($token, $client); - - if ($client instanceof Zend_Gdata_HttpClient) { - $filterResult = $client->filterHttpRequest('GET', $request_uri); - $url = $filterResult['url']; - $headers = $filterResult['headers']; - $client->setHeaders($headers); - $client->setUri($url); - $client->resetParameters(); - } else { - $client->setUri($request_uri); - } - - ob_start(); - try { - $response = $client->request('GET'); - } catch (Zend_Http_Client_Exception $e) { - ob_end_clean(); - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); - } - ob_end_clean(); - // Parse Google's response - if ($response->isSuccessful()) { - return true; - } else { - return false; - } - } - - /** - * get token information. - * - * @param string $token The token to retrieve information about - * @param Zend_Http_Client $client (optional) HTTP client to use to - * make the request - * @param string $request_uri (optional) URI to which to direct - * the information request - */ - public static function getAuthSubTokenInfo( - $token, $client = null, $request_uri = self::AUTHSUB_TOKEN_INFO_URI) - { - $client = self::getHttpClient($token, $client); - - if ($client instanceof Zend_Gdata_HttpClient) { - $filterResult = $client->filterHttpRequest('GET', $request_uri); - $url = $filterResult['url']; - $headers = $filterResult['headers']; - $client->setHeaders($headers); - $client->setUri($url); - } else { - $client->setUri($request_uri); - } - - ob_start(); - try { - $response = $client->request('GET'); - } catch (Zend_Http_Client_Exception $e) { - ob_end_clean(); - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); - } - ob_end_clean(); - - return $response->getBody(); - } - - /** - * Retrieve a HTTP client object with AuthSub credentials attached - * as the Authorization header. - * - * @param string $token The token to retrieve information about - * @param Zend_Gdata_HttpClient $client (optional) HTTP client to use to make the request - */ - public static function getHttpClient($token, $client = null) - { - if (null == $client) { - $client = new Zend_Gdata_HttpClient(); - } - if (!$client instanceof Zend_Gdata_HttpClient) { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Gdata_HttpClient.'); - } - $useragent = 'Zend_Framework_Gdata/'.Zend_Version::VERSION; - $client->setConfig([ - 'strictredirects' => true, - 'useragent' => $useragent, - ] - ); - $client->setAuthSubToken($token); - - return $client; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books.php b/packages/zend-gdata/library/Zend/Gdata/Books.php deleted file mode 100644 index 087399517..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books.php +++ /dev/null @@ -1,213 +0,0 @@ -registerPackage('Zend_Gdata_Books'); - $this->registerPackage('Zend_Gdata_Books_Extension'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - } - - /** - * Retrieves a feed of volumes. - * - * @param zend_Gdata_Query|string|null $location (optional) The URL to - * query or a Zend_Gdata_Query object from which a URL can be - * determined - * - * @return string|Zend_Gdata_App_Feed the feed of volumes found at the - * specified URL - */ - public function getVolumeFeed($location = null) - { - if (null == $location) { - $uri = self::VOLUME_FEED_URI; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); - } - - /** - * Retrieves a specific volume entry. - * - * @param string|null $volumeId the volumeId of interest - * @param zend_Gdata_Query|string|null $location (optional) The URL to - * query or a Zend_Gdata_Query object from which a URL can be - * determined - * - * @return string|Zend_Gdata_App_Entry the feed of volumes found at the - * specified URL - */ - public function getVolumeEntry($volumeId = null, $location = null) - { - if (null !== $volumeId) { - $uri = self::VOLUME_FEED_URI.'/'.$volumeId; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry'); - } - - /** - * Retrieves a feed of volumes, by default the User library feed. - * - * @param zend_Gdata_Query|string|null $location (optional) The URL to - * query - * - * @return string|Zend_Gdata_App_Feed the feed of volumes found at the - * specified URL - */ - public function getUserLibraryFeed($location = null) - { - if (null == $location) { - $uri = self::MY_LIBRARY_FEED_URI; - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); - } - - /** - * Retrieves a feed of volumes, by default the User annotation feed. - * - * @param zend_Gdata_Query|string|null $location (optional) The URL to - * query - * - * @return string|Zend_Gdata_App_Feed the feed of volumes found at the - * specified URL - */ - public function getUserAnnotationFeed($location = null) - { - if (null == $location) { - $uri = self::MY_ANNOTATION_FEED_URI; - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); - } - - /** - * Insert a Volume / Annotation. - * - * @param Zend_Gdata_Books_VolumeEntry $entry - * @param Zend_Gdata_Query|string|null $location (optional) The URL to - * query - * - * @return Zend_Gdata_App_Entry the inserted volume entry - */ - public function insertVolume($entry, $location = null) - { - if (null == $location) { - $uri = self::MY_LIBRARY_FEED_URI; - } else { - $uri = $location; - } - - return parent::insertEntry( - $entry, $uri, 'Zend_Gdata_Books_VolumeEntry'); - } - - /** - * Delete a Volume. - * - * @param Zend_Gdata_Books_VolumeEntry $entry - * - * @return void - */ - public function deleteVolume($entry) - { - $entry->delete(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/CollectionEntry.php b/packages/zend-gdata/library/Zend/Gdata/Books/CollectionEntry.php deleted file mode 100644 index d008a7b0f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/CollectionEntry.php +++ /dev/null @@ -1,51 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/CollectionFeed.php b/packages/zend-gdata/library/Zend/Gdata/Books/CollectionFeed.php deleted file mode 100644 index 9f30eb575..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/CollectionFeed.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($element); - } - - /** - * The classname for individual feed elements. - * - * @var string - */ - protected $_entryClassName = 'Zend_Gdata_Books_CollectionEntry'; -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/AnnotationLink.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/AnnotationLink.php deleted file mode 100644 index ab3a1a10f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/AnnotationLink.php +++ /dev/null @@ -1,56 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($href, $rel, $type, $hrefLang, $title, $length); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/BooksCategory.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/BooksCategory.php deleted file mode 100644 index d04d225d0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/BooksCategory.php +++ /dev/null @@ -1,55 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($term, $scheme, $label); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/BooksLink.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/BooksLink.php deleted file mode 100644 index 1759c56ca..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/BooksLink.php +++ /dev/null @@ -1,56 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($href, $rel, $type, $hrefLang, $title, $length); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Embeddability.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Embeddability.php deleted file mode 100644 index 1a270bef7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Embeddability.php +++ /dev/null @@ -1,122 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves DOMElement which corresponds to this element and all - * child properties. This is used to build this object back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistance. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Extracts XML attributes from the DOM and converts them to the - * appropriate object members. - * - * @param DOMNode $attribute the DOMNode attribute to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Returns the programmatic value that describes the embeddability of a - * volume in Google Book Search. - * - * @return string|null The value - */ - public function getValue() - { - return $this->_value; - } - - /** - * Sets the programmatic value that describes the embeddability of a - * volume in Google Book Search. - * - * @param string|null $value Programmatic value that describes the - * embeddability of a volume in Google Book Search - * - * @return Zend_Gdata_Books_Extension_Embeddability Provides a fluent - * interface - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/InfoLink.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/InfoLink.php deleted file mode 100644 index b2ad11e0a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/InfoLink.php +++ /dev/null @@ -1,55 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($href, $rel, $type, $hrefLang, $title, $length); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/PreviewLink.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/PreviewLink.php deleted file mode 100644 index 57ca31581..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/PreviewLink.php +++ /dev/null @@ -1,56 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($href, $rel, $type, $hrefLang, $title, $length); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Review.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Review.php deleted file mode 100644 index 9dfa2e514..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Review.php +++ /dev/null @@ -1,153 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct(); - $this->_lang = $lang; - $this->_type = $type; - $this->_text = $value; - } - - /** - * Retrieves DOMElement which corresponds to this element and all - * child properties. This is used to build this object back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistance. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc); - if (null !== $this->_lang) { - $element->setAttribute('lang', $this->_lang); - } - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - - return $element; - } - - /** - * Extracts XML attributes from the DOM and converts them to the - * appropriate object members. - * - * @param DOMNode $attribute the DOMNode attribute to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'lang': - $this->_lang = $attribute->nodeValue; - break; - case 'type': - $this->_type = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Returns the language of link title. - * - * @return string The lang - */ - public function getLang() - { - return $this->_lang; - } - - /** - * Returns the type of text construct (typically 'text', 'html' or 'xhtml'). - * - * @return string The type - */ - public function getType() - { - return $this->_type; - } - - /** - * Sets the language of link title. - * - * @param string $lang language of link title - * - * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface - */ - public function setLang($lang) - { - $this->_lang = $lang; - - return $this; - } - - /** - * Sets the type of text construct (typically 'text', 'html' or 'xhtml'). - * - * @param string $type type of text construct (typically 'text', 'html' or 'xhtml') - * - * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface - */ - public function setType($type) - { - $this->_type = $type; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/ThumbnailLink.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/ThumbnailLink.php deleted file mode 100644 index d022167f5..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/ThumbnailLink.php +++ /dev/null @@ -1,56 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($href, $rel, $type, $hrefLang, $title, $length); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Viewability.php b/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Viewability.php deleted file mode 100644 index dad39afb9..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/Extension/Viewability.php +++ /dev/null @@ -1,122 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves DOMElement which corresponds to this element and all - * child properties. This is used to build this object back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistance. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Extracts XML attributes from the DOM and converts them to the - * appropriate object members. - * - * @param DOMNode $attribute the DOMNode attribute to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Returns the programmatic value that describes the viewability of a volume - * in Google Book Search. - * - * @return string The value - */ - public function getValue() - { - return $this->_value; - } - - /** - * Sets the programmatic value that describes the viewability of a volume in - * Google Book Search. - * - * @param string $value programmatic value that describes the viewability - * of a volume in Googl eBook Search - * - * @return Zend_Gdata_Books_Extension_Viewability Provides a fluent - * interface - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/VolumeEntry.php b/packages/zend-gdata/library/Zend/Gdata/Books/VolumeEntry.php deleted file mode 100644 index f07267c13..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/VolumeEntry.php +++ /dev/null @@ -1,714 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves DOMElement which corresponds to this element and all - * child properties. This is used to build this object back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistance. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc); - if (null !== $this->_creators) { - foreach ($this->_creators as $creators) { - $element->appendChild($creators->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_dates) { - foreach ($this->_dates as $dates) { - $element->appendChild($dates->getDOM($element->ownerDocument)); - } - } - if (null !== $this->_descriptions) { - foreach ($this->_descriptions as $descriptions) { - $element->appendChild($descriptions->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_formats) { - foreach ($this->_formats as $formats) { - $element->appendChild($formats->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_identifiers) { - foreach ($this->_identifiers as $identifiers) { - $element->appendChild($identifiers->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_languages) { - foreach ($this->_languages as $languages) { - $element->appendChild($languages->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_publishers) { - foreach ($this->_publishers as $publishers) { - $element->appendChild($publishers->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_subjects) { - foreach ($this->_subjects as $subjects) { - $element->appendChild($subjects->getDOM( - $element->ownerDocument)); - } - } - if (null !== $this->_titles) { - foreach ($this->_titles as $titles) { - $element->appendChild($titles->getDOM($element->ownerDocument)); - } - } - if (null !== $this->_comments) { - $element->appendChild($this->_comments->getDOM( - $element->ownerDocument)); - } - if (null !== $this->_embeddability) { - $element->appendChild($this->_embeddability->getDOM( - $element->ownerDocument)); - } - if (null !== $this->_rating) { - $element->appendChild($this->_rating->getDOM( - $element->ownerDocument)); - } - if (null !== $this->_review) { - $element->appendChild($this->_review->getDOM( - $element->ownerDocument)); - } - if (null !== $this->_viewability) { - $element->appendChild($this->_viewability->getDOM( - $element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual objects of the appropriate type and stores - * them in this object based upon DOM data. - * - * @param DOMNode $child the DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('dc').':creator': - $creators = new Zend_Gdata_DublinCore_Extension_Creator(); - $creators->transferFromDOM($child); - $this->_creators[] = $creators; - break; - case $this->lookupNamespace('dc').':date': - $dates = new Zend_Gdata_DublinCore_Extension_Date(); - $dates->transferFromDOM($child); - $this->_dates[] = $dates; - break; - case $this->lookupNamespace('dc').':description': - $descriptions = new Zend_Gdata_DublinCore_Extension_Description(); - $descriptions->transferFromDOM($child); - $this->_descriptions[] = $descriptions; - break; - case $this->lookupNamespace('dc').':format': - $formats = new Zend_Gdata_DublinCore_Extension_Format(); - $formats->transferFromDOM($child); - $this->_formats[] = $formats; - break; - case $this->lookupNamespace('dc').':identifier': - $identifiers = new Zend_Gdata_DublinCore_Extension_Identifier(); - $identifiers->transferFromDOM($child); - $this->_identifiers[] = $identifiers; - break; - case $this->lookupNamespace('dc').':language': - $languages = new Zend_Gdata_DublinCore_Extension_Language(); - $languages->transferFromDOM($child); - $this->_languages[] = $languages; - break; - case $this->lookupNamespace('dc').':publisher': - $publishers = new Zend_Gdata_DublinCore_Extension_Publisher(); - $publishers->transferFromDOM($child); - $this->_publishers[] = $publishers; - break; - case $this->lookupNamespace('dc').':subject': - $subjects = new Zend_Gdata_DublinCore_Extension_Subject(); - $subjects->transferFromDOM($child); - $this->_subjects[] = $subjects; - break; - case $this->lookupNamespace('dc').':title': - $titles = new Zend_Gdata_DublinCore_Extension_Title(); - $titles->transferFromDOM($child); - $this->_titles[] = $titles; - break; - case $this->lookupNamespace('gd').':comments': - $comments = new Zend_Gdata_Extension_Comments(); - $comments->transferFromDOM($child); - $this->_comments = $comments; - break; - case $this->lookupNamespace('gbs').':embeddability': - $embeddability = new Zend_Gdata_Books_Extension_Embeddability(); - $embeddability->transferFromDOM($child); - $this->_embeddability = $embeddability; - break; - case $this->lookupNamespace('gd').':rating': - $rating = new Zend_Gdata_Extension_Rating(); - $rating->transferFromDOM($child); - $this->_rating = $rating; - break; - case $this->lookupNamespace('gbs').':review': - $review = new Zend_Gdata_Books_Extension_Review(); - $review->transferFromDOM($child); - $this->_review = $review; - break; - case $this->lookupNamespace('gbs').':viewability': - $viewability = new Zend_Gdata_Books_Extension_Viewability(); - $viewability->transferFromDOM($child); - $this->_viewability = $viewability; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Returns the Comments class. - * - * @return Zend_Gdata_Extension_Comments|null The comments - */ - public function getComments() - { - return $this->_comments; - } - - /** - * Returns the creators. - * - * @return array The creators - */ - public function getCreators() - { - return $this->_creators; - } - - /** - * Returns the dates. - * - * @return array The dates - */ - public function getDates() - { - return $this->_dates; - } - - /** - * Returns the descriptions. - * - * @return array The descriptions - */ - public function getDescriptions() - { - return $this->_descriptions; - } - - /** - * Returns the embeddability. - * - * @return Zend_Gdata_Books_Extension_Embeddability|null The embeddability - */ - public function getEmbeddability() - { - return $this->_embeddability; - } - - /** - * Returns the formats. - * - * @return array The formats - */ - public function getFormats() - { - return $this->_formats; - } - - /** - * Returns the identifiers. - * - * @return array The identifiers - */ - public function getIdentifiers() - { - return $this->_identifiers; - } - - /** - * Returns the languages. - * - * @return array The languages - */ - public function getLanguages() - { - return $this->_languages; - } - - /** - * Returns the publishers. - * - * @return array The publishers - */ - public function getPublishers() - { - return $this->_publishers; - } - - /** - * Returns the rating. - * - * @return Zend_Gdata_Extension_Rating|null The rating - */ - public function getRating() - { - return $this->_rating; - } - - /** - * Returns the review. - * - * @return Zend_Gdata_Books_Extension_Review|null The review - */ - public function getReview() - { - return $this->_review; - } - - /** - * Returns the subjects. - * - * @return array The subjects - */ - public function getSubjects() - { - return $this->_subjects; - } - - /** - * Returns the titles. - * - * @return array The titles - */ - public function getTitles() - { - return $this->_titles; - } - - /** - * Returns the viewability. - * - * @return Zend_Gdata_Books_Extension_Viewability|null The viewability - */ - public function getViewability() - { - return $this->_viewability; - } - - /** - * Sets the Comments class. - * - * @param Zend_Gdata_Extension_Comments|null $comments Comments class - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setComments($comments) - { - $this->_comments = $comments; - - return $this; - } - - /** - * Sets the creators. - * - * @param array $creators Creators|null - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setCreators($creators) - { - $this->_creators = $creators; - - return $this; - } - - /** - * Sets the dates. - * - * @param array $dates dates - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setDates($dates) - { - $this->_dates = $dates; - - return $this; - } - - /** - * Sets the descriptions. - * - * @param array $descriptions descriptions - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setDescriptions($descriptions) - { - $this->_descriptions = $descriptions; - - return $this; - } - - /** - * Sets the embeddability. - * - * @param Zend_Gdata_Books_Extension_Embeddability|null $embeddability - * embeddability - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setEmbeddability($embeddability) - { - $this->_embeddability = $embeddability; - - return $this; - } - - /** - * Sets the formats. - * - * @param array $formats formats - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setFormats($formats) - { - $this->_formats = $formats; - - return $this; - } - - /** - * Sets the identifiers. - * - * @param array $identifiers identifiers - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setIdentifiers($identifiers) - { - $this->_identifiers = $identifiers; - - return $this; - } - - /** - * Sets the languages. - * - * @param array $languages languages - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setLanguages($languages) - { - $this->_languages = $languages; - - return $this; - } - - /** - * Sets the publishers. - * - * @param array $publishers publishers - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setPublishers($publishers) - { - $this->_publishers = $publishers; - - return $this; - } - - /** - * Sets the rating. - * - * @param Zend_Gdata_Extension_Rating|null $rating rating - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setRating($rating) - { - $this->_rating = $rating; - - return $this; - } - - /** - * Sets the review. - * - * @param Zend_Gdata_Books_Extension_Review|null $review review - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setReview($review) - { - $this->_review = $review; - - return $this; - } - - /** - * Sets the subjects. - * - * @param array $subjects subjects - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setSubjects($subjects) - { - $this->_subjects = $subjects; - - return $this; - } - - /** - * Sets the titles. - * - * @param array $titles titles - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setTitles($titles) - { - $this->_titles = $titles; - - return $this; - } - - /** - * Sets the viewability. - * - * @param Zend_Gdata_Books_Extension_Viewability|null $viewability - * viewability - * - * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface - */ - public function setViewability($viewability) - { - $this->_viewability = $viewability; - - return $this; - } - - /** - * Gets the volume ID based upon the atom:id value. - * - * @return string The volume ID - * - * @throws Zend_Gdata_App_Exception - */ - public function getVolumeId() - { - $fullId = $this->getId()->getText(); - $position = strrpos($fullId, '/'); - if (false === $position) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Slash not found in atom:id'); - } else { - return substr((string) $fullId, strrpos($fullId, '/') + 1); - } - } - - /** - * Gets the thumbnail link. - * - * @return Zend_Gdata_App_Extension_link|null The thumbnail link - */ - public function getThumbnailLink() - { - return $this->getLink(self::THUMBNAIL_LINK_REL); - } - - /** - * Gets the preview link. - * - * @return Zend_Gdata_App_Extension_Link|null The preview link - */ - public function getPreviewLink() - { - return $this->getLink(self::PREVIEW_LINK_REL); - } - - /** - * Gets the info link. - * - * @return Zend_Gdata_App_Extension_Link|null The info link - */ - public function getInfoLink() - { - return $this->getLink(self::INFO_LINK_REL); - } - - /** - * Gets the annotations link. - * - * @return Zend_Gdata_App_Extension_Link|null The annotations link - */ - public function getAnnotationLink() - { - return $this->getLink(self::ANNOTATION_LINK_REL); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/VolumeFeed.php b/packages/zend-gdata/library/Zend/Gdata/Books/VolumeFeed.php deleted file mode 100644 index 77d320a23..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/VolumeFeed.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Books::$namespaces); - parent::__construct($element); - } - - /** - * The classname for individual feed elements. - * - * @var string - */ - protected $_entryClassName = 'Zend_Gdata_Books_VolumeEntry'; -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Books/VolumeQuery.php b/packages/zend-gdata/library/Zend/Gdata/Books/VolumeQuery.php deleted file mode 100644 index 17dd46e09..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Books/VolumeQuery.php +++ /dev/null @@ -1,112 +0,0 @@ -_params['min-viewability'] = 'full'; - break; - case 'partial_view': - $this->_params['min-viewability'] = 'partial'; - break; - case null: - unset($this->_params['min-viewability']); - break; - } - - return $this; - } - - /** - * Minimum viewability of volumes to include in search results. - * - * @return string|null min-viewability - */ - public function getMinViewability() - { - if (array_key_exists('min-viewability', $this->_params)) { - return $this->_params['min-viewability']; - } else { - return null; - } - } - - /** - * Returns the generated full query URL. - * - * @return string The URL - */ - public function getQueryUrl() - { - if (isset($this->_url)) { - $url = $this->_url; - } else { - $url = Zend_Gdata_Books::VOLUME_FEED_URI; - } - if (null !== $this->getCategory()) { - $url .= '/-/'.$this->getCategory(); - } - $url = $url.$this->getQueryString(); - - return $url; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar.php b/packages/zend-gdata/library/Zend/Gdata/Calendar.php deleted file mode 100644 index b81524b66..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar.php +++ /dev/null @@ -1,170 +0,0 @@ -registerPackage('Zend_Gdata_Calendar'); - $this->registerPackage('Zend_Gdata_Calendar_Extension'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - } - - /** - * Retreive feed object. - * - * @param mixed $location The location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Feed - */ - public function getCalendarEventFeed($location = null) - { - if (null == $location) { - $uri = self::CALENDAR_EVENT_FEED_URI; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Calendar_EventFeed'); - } - - /** - * Retreive entry object. - * - * @return string|Zend_Gdata_App_Entry - */ - public function getCalendarEventEntry($location = null) - { - if (null == $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Calendar_EventEntry'); - } - - /** - * Retrieve feed object. - * - * @return string|Zend_Gdata_App_Feed - */ - public function getCalendarListFeed() - { - $uri = self::CALENDAR_FEED_URI.'/default'; - - return parent::getFeed($uri, 'Zend_Gdata_Calendar_ListFeed'); - } - - /** - * Retreive entryobject. - * - * @return string|Zend_Gdata_App_Entry - */ - public function getCalendarListEntry($location = null) - { - if (null == $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Calendar_ListEntry'); - } - - public function insertEvent($event, $uri = null) - { - if (null == $uri) { - $uri = $this->_defaultPostUri; - } - $newEvent = $this->insertEntry($event, $uri, 'Zend_Gdata_Calendar_EventEntry'); - - return $newEvent; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/EventEntry.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/EventEntry.php deleted file mode 100644 index 2b3835c1e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/EventEntry.php +++ /dev/null @@ -1,167 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_sendEventNotifications) { - $element->appendChild($this->_sendEventNotifications->getDOM($element->ownerDocument)); - } - if (null != $this->_timezone) { - $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); - } - if (null != $this->_quickadd) { - $element->appendChild($this->_quickadd->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gCal').':sendEventNotifications': - $sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); - $sendEventNotifications->transferFromDOM($child); - $this->_sendEventNotifications = $sendEventNotifications; - break; - case $this->lookupNamespace('gCal').':timezone': - $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $timezone->transferFromDOM($child); - $this->_timezone = $timezone; - break; - case $this->lookupNamespace('atom').':link': - $link = new Zend_Gdata_Calendar_Extension_Link(); - $link->transferFromDOM($child); - $this->_link[] = $link; - break; - case $this->lookupNamespace('gCal').':quickadd': - $quickadd = new Zend_Gdata_Calendar_Extension_QuickAdd(); - $quickadd->transferFromDOM($child); - $this->_quickadd = $quickadd; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getSendEventNotifications() - { - return $this->_sendEventNotifications; - } - - public function setSendEventNotifications($value) - { - $this->_sendEventNotifications = $value; - - return $this; - } - - public function getTimezone() - { - return $this->_timezone; - } - - /** - * @param Zend_Gdata_Calendar_Extension_Timezone $value - * - * @return Zend_Gdata_Calendar_EventEntry Provides a fluent interface - */ - public function setTimezone($value) - { - $this->_timezone = $value; - - return $this; - } - - public function getQuickAdd() - { - return $this->_quickadd; - } - - /** - * @param Zend_Gdata_Calendar_Extension_QuickAdd $value - * - * @return Zend_Gdata_Calendar_EventEntry Provides a fluent interface - */ - public function setQuickAdd($value) - { - $this->_quickadd = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/EventFeed.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/EventFeed.php deleted file mode 100644 index 1694b04ab..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/EventFeed.php +++ /dev/null @@ -1,104 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_timezone) { - $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gCal').':timezone': - $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $timezone->transferFromDOM($child); - $this->_timezone = $timezone; - break; - - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getTimezone() - { - return $this->_timezone; - } - - public function setTimezone($value) - { - $this->_timezone = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/EventQuery.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/EventQuery.php deleted file mode 100644 index 8a18775cd..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/EventQuery.php +++ /dev/null @@ -1,512 +0,0 @@ -_comments = $value; - - return $this; - } - - /** - * @see $_event - * - * @param string $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setEvent($value) - { - $this->_event = $value; - - return $this; - } - - /** - * @see $_projection - * - * @param string $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setProjection($value) - { - $this->_projection = $value; - - return $this; - } - - /** - * @see $_user - * - * @param string $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setUser($value) - { - $this->_user = $value; - - return $this; - } - - /** - * @see $_visibility - * - * @param bool $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setVisibility($value) - { - $this->_visibility = $value; - - return $this; - } - - /** - * @return string|null comments - * - *@see $_comments; - */ - public function getComments() - { - return $this->_comments; - } - - /** - * @return string|null event - * - *@see $_event; - */ - public function getEvent() - { - return $this->_event; - } - - /** - * @see $_projection - * - * @return string projection - */ - public function getProjection() - { - return $this->_projection; - } - - /** - * @see $_user - * - * @return string user - */ - public function getUser() - { - return $this->_user; - } - - /** - * @see $_visibility - * - * @return string visibility - */ - public function getVisibility() - { - return $this->_visibility; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setStartMax($value) - { - if (null != $value) { - $this->_params['start-max'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['start-max']); - } - - return $this; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setStartMin($value) - { - if (null != $value) { - $this->_params['start-min'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['start-min']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setOrderBy($value) - { - if (null != $value) { - $this->_params['orderby'] = $value; - } else { - unset($this->_params['orderby']); - } - - return $this; - } - - /** - * @return int start-max - */ - public function getStartMax() - { - if (array_key_exists('start-max', $this->_params)) { - return $this->_params['start-max']; - } else { - return null; - } - } - - /** - * @return int start-min - */ - public function getStartMin() - { - if (array_key_exists('start-min', $this->_params)) { - return $this->_params['start-min']; - } else { - return null; - } - } - - /** - * @return string orderby - */ - public function getOrderBy() - { - if (array_key_exists('orderby', $this->_params)) { - return $this->_params['orderby']; - } else { - return null; - } - } - - /** - * @return string sortorder - */ - public function getSortOrder() - { - if (array_key_exists('sortorder', $this->_params)) { - return $this->_params['sortorder']; - } else { - return null; - } - } - - /** - * @return Zend_Gdata_Calendar_EventQuery sortorder - */ - public function setSortOrder($value) - { - if (null != $value) { - $this->_params['sortorder'] = $value; - } else { - unset($this->_params['sortorder']); - } - - return $this; - } - - /** - * @return string recurrence-expansion-start - */ - public function getRecurrenceExpansionStart() - { - if (array_key_exists('recurrence-expansion-start', $this->_params)) { - return $this->_params['recurrence-expansion-start']; - } else { - return null; - } - } - - /** - * @return Zend_Gdata_Calendar_EventQuery recurrence-expansion-start - */ - public function setRecurrenceExpansionStart($value) - { - if (null != $value) { - $this->_params['recurrence-expansion-start'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['recurrence-expansion-start']); - } - - return $this; - } - - /** - * @return string recurrence-expansion-end - */ - public function getRecurrenceExpansionEnd() - { - if (array_key_exists('recurrence-expansion-end', $this->_params)) { - return $this->_params['recurrence-expansion-end']; - } else { - return null; - } - } - - /** - * @return Zend_Gdata_Calendar_EventQuery recurrence-expansion-end - */ - public function setRecurrenceExpansionEnd($value) - { - if (null != $value) { - $this->_params['recurrence-expansion-end'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['recurrence-expansion-end']); - } - - return $this; - } - - /** - * @return bool|null Provides a fluent interface - */ - public function getSingleEvents() - { - if (array_key_exists('singleevents', $this->_params)) { - $value = $this->_params['singleevents']; - switch ($value) { - case 'true': - return true; - break; - case 'false': - return false; - break; - default: - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Invalid query param value for futureevents: '.$value.' It must be a boolean.'); - } - } else { - return null; - } - } - - /** - * @param string $value Also accepts bools. If using a string, must be either "true" or "false". - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setSingleEvents($value) - { - if (null !== $value) { - if (is_bool($value)) { - $this->_params['singleevents'] = ($value ? 'true' : 'false'); - } elseif ('true' == $value | 'false' == $value) { - $this->_params['singleevents'] = $value; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Invalid query param value for futureevents: '.$value.' It must be a boolean.'); - } - } else { - unset($this->_params['singleevents']); - } - - return $this; - } - - /** - * @return bool|null futureevents - */ - public function getFutureEvents() - { - if (array_key_exists('futureevents', $this->_params)) { - $value = $this->_params['futureevents']; - switch ($value) { - case 'true': - return true; - break; - case 'false': - return false; - break; - default: - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Invalid query param value for futureevents: '.$value.' It must be a boolean.'); - } - } else { - return null; - } - } - - /** - * @param string $value Also accepts bools. If using a string, must be either "true" or "false" or - * an exception will be thrown on retrieval. - * - * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface - */ - public function setFutureEvents($value) - { - if (null !== $value) { - if (is_bool($value)) { - $this->_params['futureevents'] = ($value ? 'true' : 'false'); - } elseif ('true' == $value | 'false' == $value) { - $this->_params['futureevents'] = $value; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Invalid query param value for futureevents: '.$value.' It must be a boolean.'); - } - } else { - unset($this->_params['futureevents']); - } - - return $this; - } - - /** - * @return string url - */ - public function getQueryUrl() - { - if (isset($this->_url)) { - $uri = $this->_url; - } else { - $uri = $this->_defaultFeedUri; - } - if (null != $this->getUser()) { - $uri .= '/'.$this->getUser(); - } - if (null != $this->getVisibility()) { - $uri .= '/'.$this->getVisibility(); - } - if (null != $this->getProjection()) { - $uri .= '/'.$this->getProjection(); - } - if (null != $this->getEvent()) { - $uri .= '/'.$this->getEvent(); - if (null != $this->getComments()) { - $uri .= '/comments/'.$this->getComments(); - } - } - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/AccessLevel.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/AccessLevel.php deleted file mode 100644 index 393fffd52..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/AccessLevel.php +++ /dev/null @@ -1,126 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return string the attribute being modified - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_AccessLevel the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Color.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Color.php deleted file mode 100644 index d9e2d9c2c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Color.php +++ /dev/null @@ -1,127 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return string the value associated with this attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_Color the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->_value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Hidden.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Hidden.php deleted file mode 100644 index 9b7959aae..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Hidden.php +++ /dev/null @@ -1,133 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value ? 'true' : 'false'); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - if ('true' == $attribute->nodeValue) { - $this->_value = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_value = false; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return bool|null the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_Hidden the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->_value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Link.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Link.php deleted file mode 100644 index 961c90f4b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Link.php +++ /dev/null @@ -1,125 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct($href, $rel, $type, $hrefLang, $title, $length); - $this->_webContent = $webContent; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_webContent) { - $element->appendChild($this->_webContent->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gCal').':webContent': - $webContent = new Zend_Gdata_Calendar_Extension_WebContent(); - $webContent->transferFromDOM($child); - $this->_webContent = $webContent; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's WebContent attribute. - * - * @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value - */ - public function getWebContent() - { - return $this->_webContent; - } - - /** - * Set the value for this element's WebContent attribute. - * - * @param Zend_Gdata_Calendar_Extension_WebContent $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_Link The element being modified. Provides a fluent interface. - */ - public function setWebContent($value) - { - $this->_webContent = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/QuickAdd.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/QuickAdd.php deleted file mode 100644 index d650befb6..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/QuickAdd.php +++ /dev/null @@ -1,132 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value ? 'true' : 'false'); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - if ('true' == $attribute->nodeValue) { - $this->_value = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_value = false; - } else { - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return string the value associated with this attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_QuickAdd the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Selected.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Selected.php deleted file mode 100644 index 2e9c30bd7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Selected.php +++ /dev/null @@ -1,133 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value ? 'true' : 'false'); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - if ('true' == $attribute->nodeValue) { - $this->_value = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_value = false; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return bool the value associated with this attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_Selected the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->_value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php deleted file mode 100644 index 8199e89ec..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php +++ /dev/null @@ -1,132 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value ? 'true' : 'false'); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - if ('true' == $attribute->nodeValue) { - $this->_value = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_value = false; - } else { - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's Value attribute. - * - * @return bool|null the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's Value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_SendEventNotifications the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Timezone.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Timezone.php deleted file mode 100644 index a49798ba0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/Timezone.php +++ /dev/null @@ -1,126 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's value attribute. - * - * @return string the value associated with this attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_Timezone the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/WebContent.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/WebContent.php deleted file mode 100644 index d60017469..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/Extension/WebContent.php +++ /dev/null @@ -1,183 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct(); - $this->_url = $url; - $this->_height = $height; - $this->_width = $width; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->url) { - $element->setAttribute('url', $this->_url); - } - if (null != $this->height) { - $element->setAttribute('height', $this->_height); - } - if (null != $this->width) { - $element->setAttribute('width', $this->_width); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'url': - $this->_url = $attribute->nodeValue; - break; - case 'height': - $this->_height = $attribute->nodeValue; - break; - case 'width': - $this->_width = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's URL attribute. - * - * @return string the desired value for this attribute - */ - public function getURL() - { - return $this->_url; - } - - /** - * Set the value for this element's URL attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_WebContent the element being modified - */ - public function setURL($value) - { - $this->_url = $value; - - return $this; - } - - /** - * Get the value for this element's height attribute. - * - * @return string|null the desired value for this attribute - */ - public function getHeight() - { - return $this->_height; - } - - /** - * Set the value for this element's height attribute. - * - * @param int $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_WebContent the element being modified - */ - public function setHeight($value) - { - $this->_height = $value; - - return $this; - } - - /** - * Get the value for this element's height attribute. - * - * @return string|null the desired value for this attribute - */ - public function getWidth() - { - return $this->_width; - } - - /** - * Set the value for this element's height attribute. - * - * @param int $value the desired value for this attribute - * - * @return Zend_Gdata_Calendar_Extension_WebContent the element being modified - */ - public function setWidth($value) - { - $this->_width = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/ListEntry.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/ListEntry.php deleted file mode 100644 index 6d9cbe321..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/ListEntry.php +++ /dev/null @@ -1,256 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_accessLevel) { - $element->appendChild($this->_accessLevel->getDOM($element->ownerDocument)); - } - if (null != $this->_color) { - $element->appendChild($this->_color->getDOM($element->ownerDocument)); - } - if (null != $this->_hidden) { - $element->appendChild($this->_hidden->getDOM($element->ownerDocument)); - } - if (null != $this->_selected) { - $element->appendChild($this->_selected->getDOM($element->ownerDocument)); - } - if (null != $this->_timezone) { - $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); - } - if (null != $this->_where) { - foreach ($this->_where as $where) { - $element->appendChild($where->getDOM($element->ownerDocument)); - } - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gCal').':accesslevel': - $accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); - $accessLevel->transferFromDOM($child); - $this->_accessLevel = $accessLevel; - break; - case $this->lookupNamespace('gCal').':color': - $color = new Zend_Gdata_Calendar_Extension_Color(); - $color->transferFromDOM($child); - $this->_color = $color; - break; - case $this->lookupNamespace('gCal').':hidden': - $hidden = new Zend_Gdata_Calendar_Extension_Hidden(); - $hidden->transferFromDOM($child); - $this->_hidden = $hidden; - break; - case $this->lookupNamespace('gCal').':selected': - $selected = new Zend_Gdata_Calendar_Extension_Selected(); - $selected->transferFromDOM($child); - $this->_selected = $selected; - break; - case $this->lookupNamespace('gCal').':timezone': - $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $timezone->transferFromDOM($child); - $this->_timezone = $timezone; - break; - case $this->lookupNamespace('gd').':where': - $where = new Zend_Gdata_Extension_Where(); - $where->transferFromDOM($child); - $this->_where[] = $where; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getAccessLevel() - { - return $this->_accessLevel; - } - - /** - * @param Zend_Gdata_Calendar_Extension_AccessLevel $value - * - * @return Zend_Gdata_Calendar_ListEntry Provides a fluent interface - */ - public function setAccessLevel($value) - { - $this->_accessLevel = $value; - - return $this; - } - - public function getColor() - { - return $this->_color; - } - - /** - * @param Zend_Gdata_Calendar_Extension_Color $value - * - * @return Zend_Gdata_Calendar_ListEntry Provides a fluent interface - */ - public function setColor($value) - { - $this->_color = $value; - - return $this; - } - - public function getHidden() - { - return $this->_hidden; - } - - /** - * @param Zend_Gdata_Calendar_Extension_Hidden $value - * - * @return Zend_Gdata_Calendar_ListEntry Provides a fluent interface - */ - public function setHidden($value) - { - $this->_hidden = $value; - - return $this; - } - - public function getSelected() - { - return $this->_selected; - } - - /** - * @param Zend_Gdata_Calendar_Extension_Selected $value - * - * @return Zend_Gdata_Calendar_ListEntry Provides a fluent interface - */ - public function setSelected($value) - { - $this->_selected = $value; - - return $this; - } - - public function getTimezone() - { - return $this->_timezone; - } - - /** - * @param Zend_Gdata_Calendar_Extension_Timezone $value - * - * @return Zend_Gdata_Calendar_ListEntry Provides a fluent interface - */ - public function setTimezone($value) - { - $this->_timezone = $value; - - return $this; - } - - public function getWhere() - { - return $this->_where; - } - - /** - * @param Zend_Gdata_Extension_Where $value - * - * @return Zend_Gdata_Calendar_ListEntry Provides a fluent interface - */ - public function setWhere($value) - { - $this->_where = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Calendar/ListFeed.php b/packages/zend-gdata/library/Zend/Gdata/Calendar/ListFeed.php deleted file mode 100644 index 9cf879c3d..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Calendar/ListFeed.php +++ /dev/null @@ -1,107 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_timezone) { - $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gCal').':timezone': - $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $timezone->transferFromDOM($child); - $this->_timezone = $timezone; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getTimezone() - { - return $this->_timezone; - } - - /** - * @param Zend_Gdata_Calendar_Extension_Timezone $value - * - * @return Zend_Gdata_Calendar_ListFeed Provides a fluent interface - */ - public function setTimezone($value) - { - $this->_timezone = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/ClientLogin.php b/packages/zend-gdata/library/Zend/Gdata/ClientLogin.php deleted file mode 100644 index ff85f7a1f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/ClientLogin.php +++ /dev/null @@ -1,170 +0,0 @@ -setUri($loginUri); - $useragent = $source.' Zend_Framework_Gdata/'.Zend_Version::VERSION; - $client->setConfig([ - 'maxredirects' => 0, - 'strictredirects' => true, - 'useragent' => $useragent, - ] - ); - $client->setParameterPost('accountType', $accountType); - $client->setParameterPost('Email', (string) $email); - $client->setParameterPost('Passwd', (string) $password); - $client->setParameterPost('service', (string) $service); - $client->setParameterPost('source', (string) $source); - if ($loginToken || $loginCaptcha) { - if ($loginToken && $loginCaptcha) { - $client->setParameterPost('logintoken', (string) $loginToken); - $client->setParameterPost('logincaptcha', - (string) $loginCaptcha); - } else { - // require_once 'Zend/Gdata/App/AuthException.php'; - throw new Zend_Gdata_App_AuthException('Please provide both a token ID and a user\'s response to the CAPTCHA challenge.'); - } - } - - // Send the authentication request - // For some reason Google's server causes an SSL error. We use the - // output buffer to supress an error from being shown. Ugly - but works! - ob_start(); - try { - $response = $client->request('POST'); - } catch (Zend_Http_Client_Exception $e) { - // require_once 'Zend/Gdata/App/HttpException.php'; - throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); - } - ob_end_clean(); - - // Parse Google's response - $goog_resp = []; - foreach (explode("\n", $response->getBody()) as $l) { - $l = chop($l); - if ($l) { - list($key, $val) = explode('=', chop($l), 2); - $goog_resp[$key] = $val; - } - } - - if (200 == $response->getStatus()) { - $client->setClientLoginToken($goog_resp['Auth']); - $useragent = $source.' Zend_Framework_Gdata/'.Zend_Version::VERSION; - $client->setConfig([ - 'strictredirects' => true, - 'useragent' => $useragent, - ] - ); - - return $client; - } elseif (403 == $response->getStatus()) { - // Check if the server asked for a CAPTCHA - if (array_key_exists('Error', $goog_resp) - && 'CaptchaRequired' == $goog_resp['Error']) { - // require_once 'Zend/Gdata/App/CaptchaRequiredException.php'; - throw new Zend_Gdata_App_CaptchaRequiredException($goog_resp['CaptchaToken'], $goog_resp['CaptchaUrl']); - } else { - // require_once 'Zend/Gdata/App/AuthException.php'; - throw new Zend_Gdata_App_AuthException('Authentication with Google failed. Reason: '.(isset($goog_resp['Error']) ? $goog_resp['Error'] : 'Unspecified.')); - } - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Docs.php b/packages/zend-gdata/library/Zend/Gdata/Docs.php deleted file mode 100644 index 5a09cdc9c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Docs.php +++ /dev/null @@ -1,333 +0,0 @@ - 'text/plain', - 'CSV' => 'text/csv', - 'TSV' => 'text/tab-separated-values', - 'TAB' => 'text/tab-separated-values', - 'HTML' => 'text/html', - 'HTM' => 'text/html', - 'DOC' => 'application/msword', - 'DOCX' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'ODS' => 'application/vnd.oasis.opendocument.spreadsheet', - 'ODT' => 'application/vnd.oasis.opendocument.text', - 'RTF' => 'application/rtf', - 'SXW' => 'application/vnd.sun.xml.writer', - 'XLS' => 'application/vnd.ms-excel', - 'XLSX' => 'application/vnd.ms-excel', - 'PPT' => 'application/vnd.ms-powerpoint', - 'PPS' => 'application/vnd.ms-powerpoint', - ]; - - /** - * Create Gdata_Docs object. - * - * @param zend_Http_Client $client (optional) The HTTP client to use when - * when communicating with the Google servers - * @param string $applicationId The identity of the app in the form of Company-AppName-Version - */ - public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0') - { - $this->registerPackage('Zend_Gdata_Docs'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - } - - /** - * Looks up the mime type based on the file name extension. For example, - * calling this method with 'csv' would return - * 'text/comma-separated-values'. The Mime type is sent as a header in - * the upload HTTP POST request. - * - * @param string $fileExtension - * - * @return string the mime type to be sent to the server to tell it how the - * multipart mime data should be interpreted - */ - public static function lookupMimeType($fileExtension) - { - return self::$SUPPORTED_FILETYPES[strtoupper((string) $fileExtension)]; - } - - /** - * Retreive feed object containing entries for the user's documents. - * - * @param mixed $location The location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Feed - */ - public function getDocumentListFeed($location = null) - { - if (null === $location) { - $uri = self::DOCUMENTS_LIST_FEED_URI; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Docs_DocumentListFeed'); - } - - /** - * Retreive entry object representing a single document. - * - * @param mixed $location The location for the entry, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getDocumentListEntry($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Docs_DocumentListEntry'); - } - - /** - * Retreive entry object representing a single document. - * - * This method builds the URL where this item is stored using the type - * and the id of the document. - * - * @param string $docId The URL key for the document. Examples: - * dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg - * @param string $docType The type of the document as used in the Google - * Document List URLs. Examples: document, spreadsheet, presentation - * - * @return string|Zend_Gdata_App_Entry - */ - public function getDoc($docId, $docType) - { - $location = 'https://docs.google.com/feeds/documents/private/full/'. - $docType.'%3A'.$docId; - - return $this->getDocumentListEntry($location); - } - - /** - * Retreive entry object for the desired word processing document. - * - * @param string $id The URL id for the document. Example: dcmg89gw_62hfjj8m - * - * @return string|Zend_Gdata_App_Entry - */ - public function getDocument($id) - { - return $this->getDoc($id, 'document'); - } - - /** - * Retreive entry object for the desired spreadsheet. - * - * @param string $id The URL id for the document. Example: pKq0CzjiF3YmGd0AIlHKqeg - * - * @return string|Zend_Gdata_App_Entry - */ - public function getSpreadsheet($id) - { - return $this->getDoc($id, 'spreadsheet'); - } - - /** - * Retreive entry object for the desired presentation. - * - * @param string $id The URL id for the document. Example: dcmg89gw_21gtrjcn - * - * @return string|Zend_Gdata_App_Entry - */ - public function getPresentation($id) - { - return $this->getDoc($id, 'presentation'); - } - - /** - * Upload a local file to create a new Google Document entry. - * - * @param string $fileLocation the full or relative path of the file to - * be uploaded - * @param string $title The name that this document should have on the - * server. If set, the title is used as the slug header in the - * POST request. If no title is provided, the location of the - * file will be used as the slug header in the request. If no - * mimeType is provided, this method attempts to determine the - * mime type based on the slugHeader by looking for .doc, - * .csv, .txt, etc. at the end of the file name. - * Example value: 'test.doc'. - * @param string $mimeType Describes the type of data which is being sent - * to the server. This must be one of the accepted mime types - * which are enumerated in SUPPORTED_FILETYPES. - * @param string $uri (optional) The URL to which the upload should be - * made. - * Example: 'https://docs.google.com/feeds/documents/private/full'. - * - * @return Zend_Gdata_App_Entry the entry for the newly - * created Google Document - */ - public function uploadFile($fileLocation, $title = null, $mimeType = null, - $uri = null - ) { - // Set the URI to which the file will be uploaded. - if (null === $uri) { - $uri = $this->_defaultPostUri; - } - - // Create the media source which describes the file. - $fs = $this->newMediaFileSource($fileLocation); - if (null !== $title) { - $slugHeader = $title; - } else { - $slugHeader = $fileLocation; - } - - // Set the slug header to tell the Google Documents server what the - // title of the document should be and what the file extension was - // for the original file. - $fs->setSlug($slugHeader); - - // Set the mime type of the data. - if (null === $mimeType) { - $filenameParts = explode('.', $fileLocation); - $fileExtension = end($filenameParts); - $mimeType = self::lookupMimeType($fileExtension); - } - - // Set the mime type for the upload request. - $fs->setContentType($mimeType); - - // Send the data to the server. - return $this->insertDocument($fs, $uri); - } - - /** - * Creates a new folder in Google Docs. - * - * @param string $folderName The folder name to create - * @param string|null $folderResourceId The parent folder to create it in - * ("folder%3Amy_parent_folder") - * - * @return Zend_Gdata_App_Entry the folder entry created - * - * @todo ZF-8732: This should return a *subclass* of Zend_Gdata_Entry, but - * the appropriate type doesn't exist yet. - */ - public function createFolder($folderName, $folderResourceId = null) - { - $category = new Zend_Gdata_App_Extension_Category( - self::DOCUMENTS_CATEGORY_TERM, - self::DOCUMENTS_CATEGORY_SCHEMA - ); - $title = new Zend_Gdata_App_Extension_Title($folderName); - $entry = new Zend_Gdata_Entry(); - - $entry->setCategory([$category]); - $entry->setTitle($title); - - $uri = self::DOCUMENTS_LIST_FEED_URI; - if (null != $folderResourceId) { - $uri = self::DOCUMENTS_FOLDER_FEED_URI.'/'.$folderResourceId; - } - - return $this->insertEntry($entry, $uri); - } - - /** - * Inserts an entry to a given URI and returns the response as an Entry. - * - * @param mixed $data The Zend_Gdata_Docs_DocumentListEntry or media - * source to post. If it is a DocumentListEntry, the mediaSource - * should already have been set. If $data is a mediaSource, it - * should have the correct slug header and mime type. - * @param string $uri POST URI - * @param string $className (optional) The class of entry to be returned. - * The default is a 'Zend_Gdata_Docs_DocumentListEntry'. - * - * @return Zend_Gdata_App_Entry the entry returned by the - * service after insertion - */ - public function insertDocument($data, $uri, - $className = 'Zend_Gdata_Docs_DocumentListEntry') - { - return $this->insertEntry($data, $uri, $className); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Docs/DocumentListEntry.php b/packages/zend-gdata/library/Zend/Gdata/Docs/DocumentListEntry.php deleted file mode 100644 index 2c04c08bb..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Docs/DocumentListEntry.php +++ /dev/null @@ -1,51 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Docs::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Docs/DocumentListFeed.php b/packages/zend-gdata/library/Zend/Gdata/Docs/DocumentListFeed.php deleted file mode 100644 index f1d51bce9..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Docs/DocumentListFeed.php +++ /dev/null @@ -1,64 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Docs::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Docs/Query.php b/packages/zend-gdata/library/Zend/Gdata/Docs/Query.php deleted file mode 100644 index 0cab78e35..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Docs/Query.php +++ /dev/null @@ -1,225 +0,0 @@ -_projection = $value; - - return $this; - } - - /** - * Sets the visibility for this query. Common values for visibility - * include 'private'. - * - * @return Zend_Gdata_Docs_Query Provides a fluent interface - */ - public function setVisibility($value) - { - $this->_visibility = $value; - - return $this; - } - - /** - * Gets the projection for this query. - * - * @return string projection - */ - public function getProjection() - { - return $this->_projection; - } - - /** - * Gets the visibility for this query. - * - * @return string visibility - */ - public function getVisibility() - { - return $this->_visibility; - } - - /** - * Sets the title attribute for this query. The title parameter is used - * to restrict the results to documents whose titles either contain or - * completely match the title. - * - * @param string $value - * - * @return Zend_Gdata_Docs_Query Provides a fluent interface - */ - public function setTitle($value) - { - if (null !== $value) { - $this->_params['title'] = $value; - } else { - unset($this->_params['title']); - } - - return $this; - } - - /** - * Gets the title attribute for this query. - * - * @return string title - */ - public function getTitle() - { - if (array_key_exists('title', $this->_params)) { - return $this->_params['title']; - } else { - return null; - } - } - - /** - * Sets the title-exact attribute for this query. - * If title-exact is set to true, the title query parameter will be used - * in an exact match. Only documents with a title identical to the - * title parameter will be returned. - * - * @param bool $value Use either true or false - * - * @return Zend_Gdata_Docs_Query Provides a fluent interface - */ - public function setTitleExact($value) - { - if ($value) { - $this->_params['title-exact'] = $value; - } else { - unset($this->_params['title-exact']); - } - - return $this; - } - - /** - * Gets the title-exact attribute for this query. - * - * @return string title-exact - */ - public function getTitleExact() - { - if (array_key_exists('title-exact', $this->_params)) { - return $this->_params['title-exact']; - } else { - return false; - } - } - - /** - * Gets the full query URL for this query. - * - * @return string url - */ - public function getQueryUrl() - { - $uri = $this->_defaultFeedUri; - - if (null !== $this->_visibility) { - $uri .= '/'.$this->_visibility; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A visibility must be provided for cell queries.'); - } - - if (null !== $this->_projection) { - $uri .= '/'.$this->_projection; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A projection must be provided for cell queries.'); - } - - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore.php deleted file mode 100644 index 5307f30ec..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore.php +++ /dev/null @@ -1,62 +0,0 @@ -registerPackage('Zend_Gdata_DublinCore'); - $this->registerPackage('Zend_Gdata_DublinCore_Extension'); - parent::__construct($client, $applicationId); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Creator.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Creator.php deleted file mode 100644 index f1b8ffcd1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Creator.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Date.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Date.php deleted file mode 100644 index 86d89a4dd..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Date.php +++ /dev/null @@ -1,54 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Description.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Description.php deleted file mode 100644 index 88254e981..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Description.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Format.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Format.php deleted file mode 100644 index 618df2fe1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Format.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Identifier.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Identifier.php deleted file mode 100644 index b12fd548b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Identifier.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Language.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Language.php deleted file mode 100644 index 48dc9bc09..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Language.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Publisher.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Publisher.php deleted file mode 100644 index 7d4ba065e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Publisher.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Rights.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Rights.php deleted file mode 100644 index 94a532551..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Rights.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Subject.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Subject.php deleted file mode 100644 index 8b1e03a26..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Subject.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Title.php b/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Title.php deleted file mode 100644 index 3d235ca43..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/DublinCore/Extension/Title.php +++ /dev/null @@ -1,52 +0,0 @@ -registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); - parent::__construct(); - $this->_text = $value; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Entry.php b/packages/zend-gdata/library/Zend/Gdata/Entry.php deleted file mode 100644 index 873ffc81a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Entry.php +++ /dev/null @@ -1,129 +0,0 @@ -registerAllNamespaces(Zend_Gdata::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - // ETags are special. We only support them in protocol >= 2.X. - // This will be duplicated by the HTTP ETag header. - if ($majorVersion >= 2) { - if (null != $this->_etag) { - $element->setAttributeNS($this->lookupNamespace('gd'), - 'gd:etag', - $this->_etag); - } - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':content': - $content = new Zend_Gdata_App_Extension_Content(); - $content->transferFromDOM($child); - $this->_content = $content; - break; - case $this->lookupNamespace('atom').':published': - $published = new Zend_Gdata_App_Extension_Published(); - $published->transferFromDOM($child); - $this->_published = $published; - break; - case $this->lookupNamespace('atom').':source': - $source = new Zend_Gdata_App_Extension_Source(); - $source->transferFromDOM($child); - $this->_source = $source; - break; - case $this->lookupNamespace('atom').':summary': - $summary = new Zend_Gdata_App_Extension_Summary(); - $summary->transferFromDOM($child); - $this->_summary = $summary; - break; - case $this->lookupNamespace('app').':control': - $control = new Zend_Gdata_App_Extension_Control(); - $control->transferFromDOM($child); - $this->_control = $control; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'etag': - // ETags are special, since they can be conveyed by either the - // HTTP ETag header or as an XML attribute. - $etag = $attribute->nodeValue; - if (null === $this->_etag) { - $this->_etag = $etag; - } elseif ($this->_etag != $etag) { - // require_once('Zend/Gdata/App/IOException.php'); - throw new Zend_Gdata_App_IOException('ETag mismatch'); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - break; - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif.php b/packages/zend-gdata/library/Zend/Gdata/Exif.php deleted file mode 100644 index e5cee012f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif.php +++ /dev/null @@ -1,63 +0,0 @@ -registerPackage('Zend_Gdata_Exif'); - $this->registerPackage('Zend_Gdata_Exif_Extension'); - parent::__construct($client, $applicationId); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Entry.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Entry.php deleted file mode 100644 index 96f09ab39..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Entry.php +++ /dev/null @@ -1,148 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_tags) { - $element->appendChild($this->_tags->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('exif').':tags': - $tags = new Zend_Gdata_Exif_Extension_Tags(); - $tags->transferFromDOM($child); - $this->_tags = $tags; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Retrieve the tags for this entry. - * - * @see setTags - * - * @return string|null the requested object - * or null if not set - */ - public function getTags() - { - return $this->_tags; - } - - /** - * Set the tags property for this entry. This property contains - * various Exif data. - * - * This corresponds to the property in the Google Data - * protocol. - * - * @param Zend_Gdata_Exif_Extension_Tags $value the desired value - * this element, or null to unset - * - * @return Zend_Gdata_Exif_Entry Provides a fluent interface - */ - public function setTags($value) - { - $this->_tags = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Distance.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Distance.php deleted file mode 100644 index e4dc4329c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Distance.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Exposure.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Exposure.php deleted file mode 100644 index 79905d377..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Exposure.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/FStop.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/FStop.php deleted file mode 100644 index 2a0e251f3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/FStop.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Flash.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Flash.php deleted file mode 100644 index 11ecb6819..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Flash.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/FocalLength.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/FocalLength.php deleted file mode 100644 index ab6ed1d7c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/FocalLength.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/ImageUniqueId.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/ImageUniqueId.php deleted file mode 100644 index 6feaa6d95..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/ImageUniqueId.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Iso.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Iso.php deleted file mode 100644 index 534f02e9a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Iso.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Make.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Make.php deleted file mode 100644 index 07b121011..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Make.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Model.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Model.php deleted file mode 100644 index ef4427d99..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Model.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Tags.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Tags.php deleted file mode 100644 index 49f5115b2..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Tags.php +++ /dev/null @@ -1,579 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setDistance($distance); - $this->setExposure($exposure); - $this->setFlash($flash); - $this->setFocalLength($focalLength); - $this->setFStop($fStop); - $this->setImageUniqueId($imageUniqueId); - $this->setIso($iso); - $this->setMake($make); - $this->setModel($model); - $this->setTime($time); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_distance) { - $element->appendChild($this->_distance->getDOM($element->ownerDocument)); - } - if (null !== $this->_exposure) { - $element->appendChild($this->_exposure->getDOM($element->ownerDocument)); - } - if (null !== $this->_flash) { - $element->appendChild($this->_flash->getDOM($element->ownerDocument)); - } - if (null !== $this->_focalLength) { - $element->appendChild($this->_focalLength->getDOM($element->ownerDocument)); - } - if (null !== $this->_fStop) { - $element->appendChild($this->_fStop->getDOM($element->ownerDocument)); - } - if (null !== $this->_imageUniqueId) { - $element->appendChild($this->_imageUniqueId->getDOM($element->ownerDocument)); - } - if (null !== $this->_iso) { - $element->appendChild($this->_iso->getDOM($element->ownerDocument)); - } - if (null !== $this->_make) { - $element->appendChild($this->_make->getDOM($element->ownerDocument)); - } - if (null !== $this->_model) { - $element->appendChild($this->_model->getDOM($element->ownerDocument)); - } - if (null !== $this->_time) { - $element->appendChild($this->_time->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('exif').':distance': - $distance = new Zend_Gdata_Exif_Extension_Distance(); - $distance->transferFromDOM($child); - $this->_distance = $distance; - break; - case $this->lookupNamespace('exif').':exposure': - $exposure = new Zend_Gdata_Exif_Extension_Exposure(); - $exposure->transferFromDOM($child); - $this->_exposure = $exposure; - break; - case $this->lookupNamespace('exif').':flash': - $flash = new Zend_Gdata_Exif_Extension_Flash(); - $flash->transferFromDOM($child); - $this->_flash = $flash; - break; - case $this->lookupNamespace('exif').':focallength': - $focalLength = new Zend_Gdata_Exif_Extension_FocalLength(); - $focalLength->transferFromDOM($child); - $this->_focalLength = $focalLength; - break; - case $this->lookupNamespace('exif').':fstop': - $fStop = new Zend_Gdata_Exif_Extension_FStop(); - $fStop->transferFromDOM($child); - $this->_fStop = $fStop; - break; - case $this->lookupNamespace('exif').':imageUniqueID': - $imageUniqueId = new Zend_Gdata_Exif_Extension_ImageUniqueId(); - $imageUniqueId->transferFromDOM($child); - $this->_imageUniqueId = $imageUniqueId; - break; - case $this->lookupNamespace('exif').':iso': - $iso = new Zend_Gdata_Exif_Extension_Iso(); - $iso->transferFromDOM($child); - $this->_iso = $iso; - break; - case $this->lookupNamespace('exif').':make': - $make = new Zend_Gdata_Exif_Extension_Make(); - $make->transferFromDOM($child); - $this->_make = $make; - break; - case $this->lookupNamespace('exif').':model': - $model = new Zend_Gdata_Exif_Extension_Model(); - $model->transferFromDOM($child); - $this->_model = $model; - break; - case $this->lookupNamespace('exif').':time': - $time = new Zend_Gdata_Exif_Extension_Time(); - $time->transferFromDOM($child); - $this->_time = $time; - break; - } - } - - /** - * Get the value for this element's distance attribute. - * - * @see setDistance - * - * @return Zend_Gdata_Exif_Extension_Distance the requested attribute - */ - public function getDistance() - { - return $this->_distance; - } - - /** - * Set the value for this element's distance attribute. - * - * @param Zend_Gdata_Exif_Extension_Distance $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setDistance($value) - { - $this->_distance = $value; - - return $this; - } - - /** - * Get the value for this element's exposure attribute. - * - * @see setExposure - * - * @return Zend_Gdata_Exif_Extension_Exposure the requested attribute - */ - public function getExposure() - { - return $this->_exposure; - } - - /** - * Set the value for this element's exposure attribute. - * - * @param Zend_Gdata_Exif_Extension_Exposure $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setExposure($value) - { - $this->_exposure = $value; - - return $this; - } - - /** - * Get the value for this element's flash attribute. - * - * @see setFlash - * - * @return Zend_Gdata_Exif_Extension_Flash the requested attribute - */ - public function getFlash() - { - return $this->_flash; - } - - /** - * Set the value for this element's flash attribute. - * - * @param Zend_Gdata_Exif_Extension_Flash $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setFlash($value) - { - $this->_flash = $value; - - return $this; - } - - /** - * Get the value for this element's name attribute. - * - * @see setFocalLength - * - * @return Zend_Gdata_Exif_Extension_FocalLength the requested attribute - */ - public function getFocalLength() - { - return $this->_focalLength; - } - - /** - * Set the value for this element's focalLength attribute. - * - * @param Zend_Gdata_Exif_Extension_FocalLength $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setFocalLength($value) - { - $this->_focalLength = $value; - - return $this; - } - - /** - * Get the value for this element's fStop attribute. - * - * @see setFStop - * - * @return Zend_Gdata_Exif_Extension_FStop the requested attribute - */ - public function getFStop() - { - return $this->_fStop; - } - - /** - * Set the value for this element's fStop attribute. - * - * @param Zend_Gdata_Exif_Extension_FStop $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setFStop($value) - { - $this->_fStop = $value; - - return $this; - } - - /** - * Get the value for this element's imageUniqueId attribute. - * - * @see setImageUniqueId - * - * @return Zend_Gdata_Exif_Extension_ImageUniqueId the requested attribute - */ - public function getImageUniqueId() - { - return $this->_imageUniqueId; - } - - /** - * Set the value for this element's imageUniqueId attribute. - * - * @param Zend_Gdata_Exif_Extension_ImageUniqueId $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setImageUniqueId($value) - { - $this->_imageUniqueId = $value; - - return $this; - } - - /** - * Get the value for this element's iso attribute. - * - * @see setIso - * - * @return Zend_Gdata_Exif_Extension_Iso the requested attribute - */ - public function getIso() - { - return $this->_iso; - } - - /** - * Set the value for this element's iso attribute. - * - * @param Zend_Gdata_Exif_Extension_Iso $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setIso($value) - { - $this->_iso = $value; - - return $this; - } - - /** - * Get the value for this element's make attribute. - * - * @see setMake - * - * @return Zend_Gdata_Exif_Extension_Make the requested attribute - */ - public function getMake() - { - return $this->_make; - } - - /** - * Set the value for this element's make attribute. - * - * @param Zend_Gdata_Exif_Extension_Make $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setMake($value) - { - $this->_make = $value; - - return $this; - } - - /** - * Get the value for this element's model attribute. - * - * @see setModel - * - * @return Zend_Gdata_Exif_Extension_Model the requested attribute - */ - public function getModel() - { - return $this->_model; - } - - /** - * Set the value for this element's model attribute. - * - * @param Zend_Gdata_Exif_Extension_Model $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setModel($value) - { - $this->_model = $value; - - return $this; - } - - /** - * Get the value for this element's time attribute. - * - * @see setTime - * - * @return Zend_Gdata_Exif_Extension_Time the requested attribute - */ - public function getTime() - { - return $this->_time; - } - - /** - * Set the value for this element's time attribute. - * - * @param Zend_Gdata_Exif_Extension_Time $value the desired value for this attribute - * - * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface - */ - public function setTime($value) - { - $this->_time = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Time.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Time.php deleted file mode 100644 index c92263429..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Extension/Time.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Exif/Feed.php b/packages/zend-gdata/library/Zend/Gdata/Exif/Feed.php deleted file mode 100644 index c5566272a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Exif/Feed.php +++ /dev/null @@ -1,67 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Exif::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension.php b/packages/zend-gdata/library/Zend/Gdata/Extension.php deleted file mode 100644 index d1585095c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension.php +++ /dev/null @@ -1,55 +0,0 @@ -registerNamespace('gd', - 'http://schemas.google.com/g/2005'); - $this->registerNamespace('openSearch', - 'http://a9.com/-/spec/opensearchrss/1.0/', 1, 0); - $this->registerNamespace('openSearch', - 'http://a9.com/-/spec/opensearch/1.1/', 2, 0); - $this->registerNamespace('rss', - 'http://blogs.law.harvard.edu/tech/rss'); - - parent::__construct(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/AttendeeStatus.php b/packages/zend-gdata/library/Zend/Gdata/Extension/AttendeeStatus.php deleted file mode 100644 index 2998f8a1c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/AttendeeStatus.php +++ /dev/null @@ -1,124 +0,0 @@ -_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's Value attribute. - * - * @return string the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's Value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_AttendeeStatus the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/AttendeeType.php b/packages/zend-gdata/library/Zend/Gdata/Extension/AttendeeType.php deleted file mode 100644 index 2660ef826..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/AttendeeType.php +++ /dev/null @@ -1,124 +0,0 @@ -_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's Value attribute. - * - * @return string the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's Value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_AttendeeType the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Comments.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Comments.php deleted file mode 100644 index c2bd9b6f0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Comments.php +++ /dev/null @@ -1,117 +0,0 @@ -_rel = $rel; - $this->_feedLink = $feedLink; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_rel) { - $element->setAttribute('rel', $this->_rel); - } - if (null !== $this->_feedLink) { - $element->appendChild($this->_feedLink->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':feedLink': - $feedLink = new Zend_Gdata_Extension_FeedLink(); - $feedLink->transferFromDOM($child); - $this->_feedLink = $feedLink; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'rel': - $this->_rel = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - public function getRel() - { - return $this->_rel; - } - - public function setRel($value) - { - $this->_rel = $value; - - return $this; - } - - public function getFeedLink() - { - return $this->_feedLink; - } - - public function setFeedLink($value) - { - $this->_feedLink = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/EntryLink.php b/packages/zend-gdata/library/Zend/Gdata/Extension/EntryLink.php deleted file mode 100644 index a16f14796..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/EntryLink.php +++ /dev/null @@ -1,167 +0,0 @@ -_href = $href; - $this->_readOnly = $readOnly; - $this->_rel = $rel; - $this->_entry = $entry; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_href) { - $element->setAttribute('href', $this->_href); - } - if (null !== $this->_readOnly) { - $element->setAttribute('readOnly', $this->_readOnly ? 'true' : 'false'); - } - if (null !== $this->_rel) { - $element->setAttribute('rel', $this->_rel); - } - if (null !== $this->_entry) { - $element->appendChild($this->_entry->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':entry': - $entry = new Zend_Gdata_Entry(); - $entry->transferFromDOM($child); - $this->_entry = $entry; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'href': - $this->_href = $attribute->nodeValue; - break; - case 'readOnly': - if ('true' == $attribute->nodeValue) { - $this->_readOnly = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_readOnly = false; - } else { - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - case 'rel': - $this->_rel = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getHref() - { - return $this->_href; - } - - public function setHref($value) - { - $this->_href = $value; - - return $this; - } - - public function getReadOnly() - { - return $this->_readOnly; - } - - public function setReadOnly($value) - { - $this->_readOnly = $value; - - return $this; - } - - public function getRel() - { - return $this->_rel; - } - - public function setRel($value) - { - $this->_rel = $value; - - return $this; - } - - public function getEntry() - { - return $this->_entry; - } - - public function setEntry($value) - { - $this->_entry = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/EventStatus.php b/packages/zend-gdata/library/Zend/Gdata/Extension/EventStatus.php deleted file mode 100644 index 4011559aa..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/EventStatus.php +++ /dev/null @@ -1,101 +0,0 @@ -_value = $value; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's Value attribute. - * - * @return string the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's Value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_EventStatus the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/ExtendedProperty.php b/packages/zend-gdata/library/Zend/Gdata/Extension/ExtendedProperty.php deleted file mode 100644 index aeadf57c7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/ExtendedProperty.php +++ /dev/null @@ -1,106 +0,0 @@ -_name = $name; - $this->_value = $value; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_name) { - $element->setAttribute('name', $this->_name); - } - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'name': - $this->_name = $attribute->nodeValue; - break; - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - public function __toString() - { - return $this->getName().'='.$this->getValue(); - } - - public function getName() - { - return $this->_name; - } - - public function setName($value) - { - $this->_name = $value; - - return $this; - } - - public function getValue() - { - return $this->_value; - } - - public function setValue($value) - { - $this->_value = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/FeedLink.php b/packages/zend-gdata/library/Zend/Gdata/Extension/FeedLink.php deleted file mode 100644 index 28a117e50..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/FeedLink.php +++ /dev/null @@ -1,175 +0,0 @@ -_countHint = $countHint; - $this->_href = $href; - $this->_readOnly = $readOnly; - $this->_rel = $rel; - $this->_feed = $feed; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_countHint) { - $element->setAttribute('countHint', $this->_countHint); - } - if (null !== $this->_href) { - $element->setAttribute('href', $this->_href); - } - if (null !== $this->_readOnly) { - $element->setAttribute('readOnly', $this->_readOnly ? 'true' : 'false'); - } - if (null !== $this->_rel) { - $element->setAttribute('rel', $this->_rel); - } - if (null !== $this->_feed) { - $element->appendChild($this->_feed->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('atom').':feed': - $feed = new Zend_Gdata_Feed(); - $feed->transferFromDOM($child); - $this->_feed = $feed; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'countHint': - $this->_countHint = $attribute->nodeValue; - break; - case 'href': - $this->_href = $attribute->nodeValue; - break; - case 'readOnly': - if ('true' == $attribute->nodeValue) { - $this->_readOnly = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_readOnly = false; - } else { - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - case 'rel': - $this->_rel = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getHref() - { - return $this->_href; - } - - public function setHref($value) - { - $this->_href = $value; - - return $this; - } - - public function getReadOnly() - { - return $this->_readOnly; - } - - public function setReadOnly($value) - { - $this->_readOnly = $value; - - return $this; - } - - public function getRel() - { - return $this->_rel; - } - - public function setRel($value) - { - $this->_rel = $value; - - return $this; - } - - public function getFeed() - { - return $this->_feed; - } - - public function setFeed($value) - { - $this->_feed = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchItemsPerPage.php b/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchItemsPerPage.php deleted file mode 100644 index 5563119fc..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchItemsPerPage.php +++ /dev/null @@ -1,47 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchStartIndex.php b/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchStartIndex.php deleted file mode 100644 index dea835c26..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchStartIndex.php +++ /dev/null @@ -1,47 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchTotalResults.php b/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchTotalResults.php deleted file mode 100644 index 3e0dd9dfe..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/OpenSearchTotalResults.php +++ /dev/null @@ -1,47 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/OriginalEvent.php b/packages/zend-gdata/library/Zend/Gdata/Extension/OriginalEvent.php deleted file mode 100644 index 4d82be607..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/OriginalEvent.php +++ /dev/null @@ -1,142 +0,0 @@ -_id = $id; - $this->_href = $href; - $this->_when = $when; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_id) { - $element->setAttribute('id', $this->_id); - } - if (null !== $this->_href) { - $element->setAttribute('href', $this->_href); - } - if (null !== $this->_when) { - $element->appendChild($this->_when->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'id': - $this->_id = $attribute->nodeValue; - break; - case 'href': - $this->_href = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':when': - $when = new Zend_Gdata_Extension_When(); - $when->transferFromDOM($child); - $this->_when = $when; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getId() - { - return $this->_id; - } - - public function setId($value) - { - $this->_id = $value; - - return $this; - } - - public function getHref() - { - return $this->_href; - } - - public function setHref($value) - { - $this->_href = $value; - - return $this; - } - - public function getWhen() - { - return $this->_when; - } - - public function setWhen($value) - { - $this->_when = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Rating.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Rating.php deleted file mode 100644 index cf9f42334..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Rating.php +++ /dev/null @@ -1,248 +0,0 @@ -_average = $average; - $this->_min = $min; - $this->_max = $max; - $this->_numRaters = $numRaters; - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_min) { - $element->setAttribute('min', $this->_min); - } - if (null !== $this->_max) { - $element->setAttribute('max', $this->_max); - } - if (null !== $this->_numRaters) { - $element->setAttribute('numRaters', $this->_numRaters); - } - if (null !== $this->_average) { - $element->setAttribute('average', $this->_average); - } - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'min': - $this->_min = $attribute->nodeValue; - break; - case 'max': - $this->_max = $attribute->nodeValue; - break; - case 'numRaters': - $this->_numRaters = $attribute->nodeValue; - break; - case 'average': - $this->_average = $attribute->nodeValue; - break; - case 'value': - $this->_value = $attribute->nodeValue; - // no break - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's min attribute. - * - * @return int the requested attribute - */ - public function getMin() - { - return $this->_min; - } - - /** - * Set the value for this element's min attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Rating the element being modified - */ - public function setMin($value) - { - $this->_min = $value; - - return $this; - } - - /** - * Get the value for this element's numRaters attribute. - * - * @return int the requested attribute - */ - public function getNumRaters() - { - return $this->_numRaters; - } - - /** - * Set the value for this element's numRaters attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Rating the element being modified - */ - public function setNumRaters($value) - { - $this->_numRaters = $value; - - return $this; - } - - /** - * Get the value for this element's average attribute. - * - * @return int the requested attribute - */ - public function getAverage() - { - return $this->_average; - } - - /** - * Set the value for this element's average attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Rating the element being modified - */ - public function setAverage($value) - { - $this->_average = $value; - - return $this; - } - - /** - * Get the value for this element's max attribute. - * - * @return int the requested attribute - */ - public function getMax() - { - return $this->_max; - } - - /** - * Set the value for this element's max attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Rating the element being modified - */ - public function setMax($value) - { - $this->_max = $value; - - return $this; - } - - /** - * Get the value for this element's value attribute. - * - * @return int the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Rating the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Recurrence.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Recurrence.php deleted file mode 100644 index 1f3f6091c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Recurrence.php +++ /dev/null @@ -1,46 +0,0 @@ -_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/RecurrenceException.php b/packages/zend-gdata/library/Zend/Gdata/Extension/RecurrenceException.php deleted file mode 100644 index 8f155c3a5..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/RecurrenceException.php +++ /dev/null @@ -1,218 +0,0 @@ -_specialized = $specialized; - $this->_entryLink = $entryLink; - $this->_originalEvent = $originalEvent; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_specialized) { - $element->setAttribute('specialized', $this->_specialized ? 'true' : 'false'); - } - if (null !== $this->_entryLink) { - $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); - } - if (null !== $this->_originalEvent) { - $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'specialized': - if ('true' == $attribute->nodeValue) { - $this->_specialized = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_specialized = false; - } else { - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':entryLink': - $entryLink = new Zend_Gdata_Extension_EntryLink(); - $entryLink->transferFromDOM($child); - $this->_entryLink = $entryLink; - break; - case $this->lookupNamespace('gd').':originalEvent': - $originalEvent = new Zend_Gdata_Extension_OriginalEvent(); - $originalEvent->transferFromDOM($child); - $this->_originalEvent = $originalEvent; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's Specialized attribute. - * - * @return bool the requested attribute - */ - public function getSpecialized() - { - return $this->_specialized; - } - - /** - * Set the value for this element's Specialized attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_RecurrenceException the element being modified - */ - public function setSpecialized($value) - { - $this->_specialized = $value; - - return $this; - } - - /** - * Get the value for this element's EntryLink attribute. - * - * @return Zend_Gdata_Extension_EntryLink the requested attribute - */ - public function getEntryLink() - { - return $this->_entryLink; - } - - /** - * Set the value for this element's EntryLink attribute. - * - * @param Zend_Gdata_Extension_EntryLink $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_RecurrenceException the element being modified - */ - public function setEntryLink($value) - { - $this->_entryLink = $value; - - return $this; - } - - /** - * Get the value for this element's Specialized attribute. - * - * @return Zend_Gdata_Extension_OriginalEvent the requested attribute - */ - public function getOriginalEvent() - { - return $this->_originalEvent; - } - - /** - * Set the value for this element's Specialized attribute. - * - * @param Zend_Gdata_Extension_OriginalEvent $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_RecurrenceException the element being modified - */ - public function setOriginalEvent($value) - { - $this->_originalEvent = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Reminder.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Reminder.php deleted file mode 100644 index 135e85ddc..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Reminder.php +++ /dev/null @@ -1,177 +0,0 @@ -_absoluteTime = $absoluteTime; - $this->_method = $method; - $this->_days = $days; - $this->_hours = $hours; - $this->_minutes = $minutes; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_absoluteTime) { - $element->setAttribute('absoluteTime', $this->_absoluteTime); - } - if (null !== $this->_method) { - $element->setAttribute('method', $this->_method); - } - if (null !== $this->_days) { - $element->setAttribute('days', $this->_days); - } - if (null !== $this->_hours) { - $element->setAttribute('hours', $this->_hours); - } - if (null !== $this->_minutes) { - $element->setAttribute('minutes', $this->_minutes); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'absoluteTime': - $this->_absoluteTime = $attribute->nodeValue; - break; - case 'method': - $this->_method = $attribute->nodeValue; - break; - case 'days': - $this->_days = $attribute->nodeValue; - break; - case 'hours': - $this->_hours = $attribute->nodeValue; - break; - case 'minutes': - $this->_minutes = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - public function __toString() - { - $s = ''; - if ($this->_absoluteTime) { - $s = ' at '.$this->_absoluteTime; - } elseif ($this->_days) { - $s = ' in '.$this->_days.' days'; - } elseif ($this->_hours) { - $s = ' in '.$this->_hours.' hours'; - } elseif ($this->_minutes) { - $s = ' in '.$this->_minutes.' minutes'; - } - - return $this->_method.$s; - } - - public function getAbsoluteTime() - { - return $this->_absoluteTime; - } - - public function setAbsoluteTime($value) - { - $this->_absoluteTime = $value; - - return $this; - } - - public function getDays() - { - return $this->_days; - } - - public function setDays($value) - { - $this->_days = $value; - - return $this; - } - - public function getHours() - { - return $this->_hours; - } - - public function setHours($value) - { - $this->_hours = $value; - - return $this; - } - - public function getMinutes() - { - return $this->_minutes; - } - - public function setMinutes($value) - { - $this->_minutes = $value; - - return $this; - } - - public function getMethod() - { - return $this->_method; - } - - public function setMethod($value) - { - $this->_method = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Transparency.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Transparency.php deleted file mode 100644 index 147e1b5cf..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Transparency.php +++ /dev/null @@ -1,124 +0,0 @@ -_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's Value attribute. - * - * @return bool the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's Value attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Transparency the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Visibility.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Visibility.php deleted file mode 100644 index 784ec0e69..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Visibility.php +++ /dev/null @@ -1,124 +0,0 @@ -_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's Value attribute. - * - * @return bool the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's Value attribute. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Visibility the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/When.php b/packages/zend-gdata/library/Zend/Gdata/Extension/When.php deleted file mode 100644 index 3a6b59a21..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/When.php +++ /dev/null @@ -1,171 +0,0 @@ -_startTime = $startTime; - $this->_endTime = $endTime; - $this->_valueString = $valueString; - $this->_reminders = $reminders; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_startTime) { - $element->setAttribute('startTime', $this->_startTime); - } - if (null !== $this->_endTime) { - $element->setAttribute('endTime', $this->_endTime); - } - if (null !== $this->_valueString) { - $element->setAttribute('valueString', $this->_valueString); - } - if (null !== $this->_reminders) { - foreach ($this->_reminders as $reminder) { - $element->appendChild( - $reminder->getDOM($element->ownerDocument)); - } - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':reminder': - $reminder = new Zend_Gdata_Extension_Reminder(); - $reminder->transferFromDOM($child); - $this->_reminders[] = $reminder; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'startTime': - $this->_startTime = $attribute->nodeValue; - break; - case 'endTime': - $this->_endTime = $attribute->nodeValue; - break; - case 'valueString': - $this->_valueString = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - public function __toString() - { - if ($this->_valueString) { - return $this->_valueString; - } else { - return 'Starts: '.$this->getStartTime().' '. - 'Ends: '.$this->getEndTime(); - } - } - - public function getStartTime() - { - return $this->_startTime; - } - - public function setStartTime($value) - { - $this->_startTime = $value; - - return $this; - } - - public function getEndTime() - { - return $this->_endTime; - } - - public function setEndTime($value) - { - $this->_endTime = $value; - - return $this; - } - - public function getValueString() - { - return $this->_valueString; - } - - public function setValueString($value) - { - $this->_valueString = $value; - - return $this; - } - - public function getReminders() - { - return $this->_reminders; - } - - public function setReminders($value) - { - $this->_reminders = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Where.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Where.php deleted file mode 100644 index 02b8f09a0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Where.php +++ /dev/null @@ -1,172 +0,0 @@ -_valueString = $valueString; - $this->_label = $label; - $this->_rel = $rel; - $this->_entryLink = $entryLink; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_label) { - $element->setAttribute('label', $this->_label); - } - if (null !== $this->_rel) { - $element->setAttribute('rel', $this->_rel); - } - if (null !== $this->_valueString) { - $element->setAttribute('valueString', $this->_valueString); - } - if (null !== $this->entryLink) { - $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'label': - $this->_label = $attribute->nodeValue; - break; - case 'rel': - $this->_rel = $attribute->nodeValue; - break; - case 'valueString': - $this->_valueString = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':entryLink': - $entryLink = new Zend_Gdata_Extension_EntryLink(); - $entryLink->transferFromDOM($child); - $this->_entryLink = $entryLink; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function __toString() - { - if (null != $this->_valueString) { - return $this->_valueString; - } else { - return parent::__toString(); - } - } - - public function getLabel() - { - return $this->_label; - } - - public function setLabel($value) - { - $this->_label = $value; - - return $this; - } - - public function getRel() - { - return $this->_rel; - } - - public function setRel($value) - { - $this->_rel = $value; - - return $this; - } - - public function getValueString() - { - return $this->_valueString; - } - - public function setValueString($value) - { - $this->_valueString = $value; - - return $this; - } - - public function getEntryLink() - { - return $this->_entryLink; - } - - public function setEntryLink($value) - { - $this->_entryLink = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Extension/Who.php b/packages/zend-gdata/library/Zend/Gdata/Extension/Who.php deleted file mode 100644 index 8276bf931..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Extension/Who.php +++ /dev/null @@ -1,308 +0,0 @@ -_email = $email; - $this->_rel = $rel; - $this->_valueString = $valueString; - $this->_attendeeStatus = $attendeeStatus; - $this->_attendeeType = $attendeeType; - $this->_entryLink = $entryLink; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_email) { - $element->setAttribute('email', $this->_email); - } - if (null !== $this->_rel) { - $element->setAttribute('rel', $this->_rel); - } - if (null !== $this->_valueString) { - $element->setAttribute('valueString', $this->_valueString); - } - if (null !== $this->_attendeeStatus) { - $element->appendChild($this->_attendeeStatus->getDOM($element->ownerDocument)); - } - if (null !== $this->_attendeeType) { - $element->appendChild($this->_attendeeType->getDOM($element->ownerDocument)); - } - if (null !== $this->_entryLink) { - $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'email': - $this->_email = $attribute->nodeValue; - break; - case 'rel': - $this->_rel = $attribute->nodeValue; - break; - case 'valueString': - $this->_valueString = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':attendeeStatus': - $attendeeStatus = new Zend_Gdata_Extension_AttendeeStatus(); - $attendeeStatus->transferFromDOM($child); - $this->_attendeeStatus = $attendeeStatus; - break; - case $this->lookupNamespace('gd').':attendeeType': - $attendeeType = new Zend_Gdata_Extension_AttendeeType(); - $attendeeType->transferFromDOM($child); - $this->_attendeeType = $attendeeType; - break; - case $this->lookupNamespace('gd').':entryLink': - $entryLink = new Zend_Gdata_Extension_EntryLink(); - $entryLink->transferFromDOM($child); - $this->_entryLink = $entryLink; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Retrieves a human readable string describing this attribute's value. - * - * @return string the attribute value - */ - public function __toString() - { - if (null != $this->_valueString) { - return $this->_valueString; - } else { - return parent::__toString(); - } - } - - /** - * Get the value for this element's ValueString attribute. - * - * @return string the requested attribute - */ - public function getValueString() - { - return $this->_valueString; - } - - /** - * Set the value for this element's ValueString attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Who the element being modified - */ - public function setValueString($value) - { - $this->_valueString = $value; - - return $this; - } - - /** - * Get the value for this element's Email attribute. - * - * @return string the requested attribute - */ - public function getEmail() - { - return $this->_email; - } - - /** - * Set the value for this element's Email attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Who the element being modified - */ - public function setEmail($value) - { - $this->_email = $value; - - return $this; - } - - /** - * Get the value for this element's Rel attribute. - * - * @return string the requested attribute - */ - public function getRel() - { - return $this->_rel; - } - - /** - * Set the value for this element's Rel attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Who the element being modified - */ - public function setRel($value) - { - $this->_rel = $value; - - return $this; - } - - /** - * Get this entry's AttendeeStatus element. - * - * @return Zend_Gdata_Extension_AttendeeStatus the requested entry - */ - public function getAttendeeStatus() - { - return $this->_attendeeStatus; - } - - /** - * Set the child's AttendeeStatus element. - * - * @param Zend_Gdata_Extension_AttendeeStatus $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Who the element being modified - */ - public function setAttendeeStatus($value) - { - $this->_attendeeStatus = $value; - - return $this; - } - - /** - * Get this entry's AttendeeType element. - * - * @return Zend_Gdata_Extension_AttendeeType the requested entry - */ - public function getAttendeeType() - { - return $this->_attendeeType; - } - - /** - * Set the child's AttendeeType element. - * - * @param Zend_Gdata_Extension_AttendeeType $value the desired value for this attribute - * - * @return Zend_Gdata_Extension_Who the element being modified - */ - public function setAttendeeType($value) - { - $this->_attendeeType = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Feed.php b/packages/zend-gdata/library/Zend/Gdata/Feed.php deleted file mode 100644 index c9bdef203..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Feed.php +++ /dev/null @@ -1,259 +0,0 @@ -registerAllNamespaces(Zend_Gdata::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_totalResults) { - $element->appendChild($this->_totalResults->getDOM($element->ownerDocument)); - } - if (null != $this->_startIndex) { - $element->appendChild($this->_startIndex->getDOM($element->ownerDocument)); - } - if (null != $this->_itemsPerPage) { - $element->appendChild($this->_itemsPerPage->getDOM($element->ownerDocument)); - } - - // ETags are special. We only support them in protocol >= 2.X. - // This will be duplicated by the HTTP ETag header. - if ($majorVersion >= 2) { - if (null != $this->_etag) { - $element->setAttributeNS($this->lookupNamespace('gd'), - 'gd:etag', - $this->_etag); - } - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('openSearch').':totalResults': - $totalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); - $totalResults->transferFromDOM($child); - $this->_totalResults = $totalResults; - break; - case $this->lookupNamespace('openSearch').':startIndex': - $startIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); - $startIndex->transferFromDOM($child); - $this->_startIndex = $startIndex; - break; - case $this->lookupNamespace('openSearch').':itemsPerPage': - $itemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); - $itemsPerPage->transferFromDOM($child); - $this->_itemsPerPage = $itemsPerPage; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'etag': - // ETags are special, since they can be conveyed by either the - // HTTP ETag header or as an XML attribute. - $etag = $attribute->nodeValue; - if (null === $this->_etag) { - $this->_etag = $etag; - } elseif ($this->_etag != $etag) { - // require_once('Zend/Gdata/App/IOException.php'); - throw new Zend_Gdata_App_IOException('ETag mismatch'); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - break; - } - } - - /** - * Set the value of the totalResults property. - * - * @param Zend_Gdata_Extension_OpenSearchTotalResults|null $value The - * value of the totalResults property. Use null to unset. - * - * @return Zend_Gdata_Feed provides a fluent interface - */ - public function setTotalResults($value) - { - $this->_totalResults = $value; - - return $this; - } - - /** - * Get the value of the totalResults property. - * - * @return Zend_Gdata_Extension_OpenSearchTotalResults|null the value of - * the totalResults property, or null if unset - */ - public function getTotalResults() - { - return $this->_totalResults; - } - - /** - * Set the start index property for feed paging. - * - * @param Zend_Gdata_Extension_OpenSearchStartIndex|null $value The value - * for the startIndex property. Use null to unset. - * - * @return Zend_Gdata_Feed provides a fluent interface - */ - public function setStartIndex($value) - { - $this->_startIndex = $value; - - return $this; - } - - /** - * Get the value of the startIndex property. - * - * @return Zend_Gdata_Extension_OpenSearchStartIndex|null the value of the - * startIndex property, or null if unset - */ - public function getStartIndex() - { - return $this->_startIndex; - } - - /** - * Set the itemsPerPage property. - * - * @param Zend_Gdata_Extension_OpenSearchItemsPerPage|null $value The - * value for the itemsPerPage property. Use nul to unset. - * - * @return Zend_Gdata_Feed provides a fluent interface - */ - public function setItemsPerPage($value) - { - $this->_itemsPerPage = $value; - - return $this; - } - - /** - * Get the value of the itemsPerPage property. - * - * @return Zend_Gdata_Extension_OpenSearchItemsPerPage|null the value of - * the itemsPerPage property, or null if unset - */ - public function getItemsPerPage() - { - return $this->_itemsPerPage; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps.php b/packages/zend-gdata/library/Zend/Gdata/Gapps.php deleted file mode 100644 index cf4911428..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps.php +++ /dev/null @@ -1,1828 +0,0 @@ -registerPackage('Zend_Gdata_Gapps'); - $this->registerPackage('Zend_Gdata_Gapps_Extension'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - $this->_domain = $domain; - } - - /** - * Convert an exception to an ServiceException if an AppsForYourDomain - * XML document is contained within the original exception's HTTP - * response. If conversion fails, throw the original error. - * - * @param Zend_Gdata_Exception $e the exception to convert - * - * @throws Zend_Gdata_Gapps_ServiceException - * @throws mixed - */ - public static function throwServiceExceptionIfDetected($e) - { - // Check to make sure that there actually response! - // This can happen if the connection dies before the request - // completes. (See ZF-5949) - $response = $e->getResponse(); - if (!$response) { - // require_once('Zend/Gdata/App/IOException.php'); - throw new Zend_Gdata_App_IOException('No HTTP response received (possible connection failure)'); - } - - try { - // Check to see if there is an AppsForYourDomainErrors - // datastructure in the response. If so, convert it to - // an exception and throw it. - // require_once 'Zend/Gdata/Gapps/ServiceException.php'; - $error = new Zend_Gdata_Gapps_ServiceException(); - $error->importFromString($response->getBody()); - throw $error; - } catch (Zend_Gdata_App_Exception $e2) { - // Unable to convert the response to a ServiceException, - // most likely because the server didn't return an - // AppsForYourDomainErrors document. Throw the original - // exception. - throw $e; - } - } - - /** - * Imports a feed located at $uri. - * This method overrides the default behavior of Zend_Gdata_App, - * providing support for Zend_Gdata_Gapps_ServiceException. - * - * @param string $uri - * @param Zend_Http_Client $client (optional) The client used for - * communication - * @param string $className (optional) The class which is used as the - * return type - * - * @return Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public static function import($uri, $client = null, $className = 'Zend_Gdata_App_Feed', $useObjectMapping = true) - { - try { - return parent::import($uri, $client, $className, $useObjectMapping); - } catch (Zend_Gdata_App_HttpException $e) { - self::throwServiceExceptionIfDetected($e); - } - } - - /** - * GET a URI using client object. - * This method overrides the default behavior of Zend_Gdata_App, - * providing support for Zend_Gdata_Gapps_ServiceException. - * - * @param string $uri GET URI - * @param array $extraHeaders extra headers to add to the request, as an - * array of string-based key/value pairs - * - * @return Zend_Http_Response - * - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function get($uri, $extraHeaders = []) - { - try { - return parent::get($uri, $extraHeaders); - } catch (Zend_Gdata_App_HttpException $e) { - self::throwServiceExceptionIfDetected($e); - } - } - - /** - * POST data with client object. - * This method overrides the default behavior of Zend_Gdata_App, - * providing support for Zend_Gdata_Gapps_ServiceException. - * - * @param mixed $data The Zend_Gdata_App_Entry or XML to post - * @param string $uri (optional) POST URI - * @param int $remainingRedirects (optional) - * @param string $contentType Content-type of the data - * - * @return Zend_Http_Response - * - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_App_InvalidArgumentException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function post($data, $uri = null, $remainingRedirects = null, - $contentType = null, $extraHeaders = null) - { - try { - return parent::post($data, $uri, $remainingRedirects, $contentType, $extraHeaders); - } catch (Zend_Gdata_App_HttpException $e) { - self::throwServiceExceptionIfDetected($e); - } - } - - /** - * PUT data with client object - * This method overrides the default behavior of Zend_Gdata_App, - * providing support for Zend_Gdata_Gapps_ServiceException. - * - * @param mixed $data The Zend_Gdata_App_Entry or XML to post - * @param string $uri (optional) PUT URI - * @param int $remainingRedirects (optional) - * @param string $contentType Content-type of the data - * - * @return Zend_Http_Response - * - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_App_InvalidArgumentException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function put($data, $uri = null, $remainingRedirects = null, - $contentType = null, $extraHeaders = null) - { - try { - return parent::put($data, $uri, $remainingRedirects, $contentType, $extraHeaders); - } catch (Zend_Gdata_App_HttpException $e) { - self::throwServiceExceptionIfDetected($e); - } - } - - /** - * DELETE entry with client object - * This method overrides the default behavior of Zend_Gdata_App, - * providing support for Zend_Gdata_Gapps_ServiceException. - * - * @param mixed $data The Zend_Gdata_App_Entry or URL to delete - * @param int $remainingRedirects (optional) - * - * @return void - * - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_App_InvalidArgumentException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function delete($data, $remainingRedirects = null) - { - try { - return parent::delete($data, $remainingRedirects); - } catch (Zend_Gdata_App_HttpException $e) { - self::throwServiceExceptionIfDetected($e); - } - } - - /** - * Set domain for this service instance. This should be a fully qualified - * domain, such as 'foo.example.com'. - * - * This value is used when calculating URLs for retrieving and posting - * entries. If no value is specified, a URL will have to be manually - * constructed prior to using any methods which interact with the Google - * Apps provisioning service. - * - * @param string $value the domain to be used for this session - */ - public function setDomain($value) - { - $this->_domain = $value; - } - - /** - * Get domain for this service instance. This should be a fully qualified - * domain, such as 'foo.example.com'. If no domain is set, null will be - * returned. - * - * @return string the domain to be used for this session, or null if not - * set - */ - public function getDomain() - { - return $this->_domain; - } - - /** - * Returns the base URL used to access the Google Apps service, based - * on the current domain. The current domain can be temporarily - * overridden by providing a fully qualified domain as $domain. - * - * @param string $domain (optional) A fully-qualified domain to use - * instead of the default domain for this service instance - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getBaseUrl($domain = null) - { - if (null !== $domain) { - return self::APPS_BASE_FEED_URI.'/'.$domain; - } elseif (null !== $this->_domain) { - return self::APPS_BASE_FEED_URI.'/'.$this->_domain; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Domain must be specified.'); - } - } - - /** - * Retrieve a UserFeed containing multiple UserEntry objects. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getUserFeed($location = null) - { - if (null === $location) { - $uri = $this->getBaseUrl().self::APPS_USER_PATH; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_UserFeed'); - } - - /** - * Retreive NicknameFeed object containing multiple NicknameEntry objects. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getNicknameFeed($location = null) - { - if (null === $location) { - $uri = $this->getBaseUrl().self::APPS_NICKNAME_PATH; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_NicknameFeed'); - } - - /** - * Retreive GroupFeed object containing multiple GroupEntry - * objects. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getGroupFeed($location = null) - { - if (null === $location) { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_GroupFeed'); - } - - /** - * Retreive MemberFeed object containing multiple MemberEntry - * objects. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getMemberFeed($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_MemberFeed'); - } - - /** - * Retreive OwnerFeed object containing multiple OwnerEntry - * objects. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getOwnerFeed($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_OwnerFeed'); - } - - /** - * Retreive EmailListFeed object containing multiple EmailListEntry - * objects. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getEmailListFeed($location = null) - { - if (null === $location) { - $uri = $this->getBaseUrl().self::APPS_NICKNAME_PATH; - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_EmailListFeed'); - } - - /** - * Retreive EmailListRecipientFeed object containing multiple - * EmailListRecipientEntry objects. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getEmailListRecipientFeed($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Gapps_EmailListRecipientFeed'); - } - - /** - * Retreive a single UserEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getUserEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_UserEntry'); - } - - /** - * Retreive a single NicknameEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getNicknameEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_NicknameEntry'); - } - - /** - * Retreive a single GroupEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getGroupEntry($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_GroupEntry'); - } - - /** - * Retreive a single MemberEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getMemberEntry($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_MemberEntry'); - } - - /** - * Retreive a single OwnerEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getOwnerEntry($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_OwnerEntry'); - } - - /** - * Retreive a single EmailListEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getEmailListEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_EmailListEntry'); - } - - /** - * Retreive a single EmailListRecipientEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function getEmailListRecipientEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Gapps_EmailListRecipientEntry'); - } - - /** - * Create a new user from a UserEntry. - * - * @param Zend_Gdata_Gapps_UserEntry $user the user entry to insert - * @param string $uri (optional) The URI where the user should be - * uploaded to. If null, the default user creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted user entry as - * returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertUser($user, $uri = null) - { - if (null === $uri) { - $uri = $this->getBaseUrl().self::APPS_USER_PATH; - } - $newEntry = $this->insertEntry($user, $uri, 'Zend_Gdata_Gapps_UserEntry'); - - return $newEntry; - } - - /** - * Create a new nickname from a NicknameEntry. - * - * @param Zend_Gdata_Gapps_NicknameEntry $nickname the nickname entry to - * insert - * @param string $uri (optional) The URI where the nickname should be - * uploaded to. If null, the default nickname creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted nickname entry as - * returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertNickname($nickname, $uri = null) - { - if (null === $uri) { - $uri = $this->getBaseUrl().self::APPS_NICKNAME_PATH; - } - $newEntry = $this->insertEntry($nickname, $uri, 'Zend_Gdata_Gapps_NicknameEntry'); - - return $newEntry; - } - - /** - * Create a new group from a GroupEntry. - * - * @param Zend_Gdata_Gapps_GroupEntry $group the group entry to insert - * @param string $uri (optional) The URI where the group should be - * uploaded to. If null, the default user creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted group entry as - * returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertGroup($group, $uri = null) - { - if (null === $uri) { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain(); - } - $newEntry = $this->insertEntry($group, $uri, 'Zend_Gdata_Gapps_GroupEntry'); - - return $newEntry; - } - - /** - * Create a new member from a MemberEntry. - * - * @param Zend_Gdata_Gapps_MemberEntry $member the member entry to insert - * @param string $uri (optional) The URI where the group should be - * uploaded to. If null, the default user creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted member entry as - * returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertMember($member, $uri = null) - { - if (null === $uri) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('URI must not be null'); - } - $newEntry = $this->insertEntry($member, $uri, 'Zend_Gdata_Gapps_MemberEntry'); - - return $newEntry; - } - - /** - * Create a new group from a OwnerEntry. - * - * @param Zend_Gdata_Gapps_OwnerEntry $owner the owner entry to insert - * @param string $uri (optional) The URI where the owner should be - * uploaded to. If null, the default user creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted owner entry as - * returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertOwner($owner, $uri = null) - { - if (null === $uri) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('URI must not be null'); - } - $newEntry = $this->insertEntry($owner, $uri, 'Zend_Gdata_Gapps_OwnerEntry'); - - return $newEntry; - } - - /** - * Create a new email list from an EmailListEntry. - * - * @param Zend_Gdata_Gapps_EmailListEntry $emailList the email list entry - * to insert - * @param string $uri (optional) The URI where the email list should be - * uploaded to. If null, the default email list creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted email list entry - * as returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertEmailList($emailList, $uri = null) - { - if (null === $uri) { - $uri = $this->getBaseUrl().self::APPS_EMAIL_LIST_PATH; - } - $newEntry = $this->insertEntry($emailList, $uri, 'Zend_Gdata_Gapps_EmailListEntry'); - - return $newEntry; - } - - /** - * Create a new email list recipient from an EmailListRecipientEntry. - * - * @param Zend_Gdata_Gapps_EmailListRecipientEntry $recipient the recipient - * entry to insert - * @param string $uri (optional) The URI where the recipient should be - * uploaded to. If null, the default recipient creation URI for - * this domain will be used. - * - * @return Zend_Gdata_App_Entry the inserted - * recipient entry as returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function insertEmailListRecipient($recipient, $uri = null) - { - if (null === $uri) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('URI must not be null'); - } elseif ($uri instanceof Zend_Gdata_Gapps_EmailListEntry) { - $uri = $uri->getLink('edit')->href; - } - $newEntry = $this->insertEntry($recipient, $uri, 'Zend_Gdata_Gapps_EmailListRecipientEntry'); - - return $newEntry; - } - - /** - * Provides a magic factory method to instantiate new objects with - * shorter syntax than would otherwise be required by the Zend Framework - * naming conventions. For more information, see Zend_Gdata_App::__call(). - * - * This overrides the default behavior of __call() so that query classes - * do not need to have their domain manually set when created with - * a magic factory method. - * - * @see Zend_Gdata_App::__call() - * - * @param string $method The method name being called - * @param array $args The arguments passed to the call - * - * @throws Zend_Gdata_App_Exception - */ - public function __call($method, $args) - { - if (preg_match('/^new(\w+Query)/', $method, $matches)) { - $class = $matches[1]; - $foundClassName = null; - foreach ($this->_registeredPackages as $name) { - try { - // Autoloading disabled on next line for compatibility - // with magic factories. See ZF-6660. - Zend_Loader_Autoloader::setDisabled(); - $found = class_exists($name.'_'.$class); - Zend_Loader_Autoloader::setDisabled(false); - if (!$found) { - // require_once 'Zend/Loader.php'; - @Zend_Loader::loadClass($name.'_'.$class); - } - $foundClassName = $name.'_'.$class; - break; - } catch (Zend_Exception $e) { - // package wasn't here- continue searching - } - } - if (null != $foundClassName) { - $reflectionObj = new ReflectionClass($foundClassName); - // Prepend the domain to the query - $args = array_merge([$this->getDomain()], $args); - - return $reflectionObj->newInstanceArgs($args); - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("Unable to find '{$class}' in registered packages"); - } - } else { - return parent::__call($method, $args); - } - } - - // Convenience methods - // Specified at http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_e - - /** - * Create a new user entry and send it to the Google Apps servers. - * - * @param string $username the username for the new user - * @param string $givenName the given name for the new user - * @param string $familyName the family name for the new user - * @param string $password the password for the new user as a plaintext string - * (if $passwordHashFunction is null) or a SHA-1 hashed - * value (if $passwordHashFunction = 'SHA-1') - * @param string $quotaLimitInMB (optional) The quota limit for the new user in MB - * - * @return Zend_Gdata_App_Entry (optional) the new user entry as returned by - * server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function createUser($username, $givenName, $familyName, $password, - $passwordHashFunction = null, $quotaLimitInMB = null) - { - $user = $this->newUserEntry(); - $user->login = $this->newLogin(); - $user->login->username = $username; - $user->login->password = $password; - $user->login->hashFunctionName = $passwordHashFunction; - $user->name = $this->newName(); - $user->name->givenName = $givenName; - $user->name->familyName = $familyName; - if (null !== $quotaLimitInMB) { - $user->quota = $this->newQuota(); - $user->quota->limit = $quotaLimitInMB; - } - - return $this->insertUser($user); - } - - /** - * Retrieve a user based on their username. - * - * @param string $username the username to search for - * - * @return string|Zend_Gdata_App_Entry|null the username to search for, or null - * if no match found - * - * @throws Zend_Gdata_App_InvalidArgumentException - * @throws Zend_Gdata_App_HttpException - */ - public function retrieveUser($username) - { - $query = $this->newUserQuery($username); - try { - $user = $this->getUserEntry($query); - } catch (Zend_Gdata_Gapps_ServiceException $e) { - // Set the user to null if not found - if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { - $user = null; - } else { - throw $e; - } - } - - return $user; - } - - /** - * Retrieve a page of users in alphabetical order, starting with the - * provided username. - * - * @param string $startUsername (optional) The first username to retrieve. - * If null or not declared, the page will begin with the first - * user in the domain. - * - * @return string|Zend_Gdata_App_Feed collection of Zend_Gdata_UserEntry - * objects representing all users in the domain - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrievePageOfUsers($startUsername = null) - { - $query = $this->newUserQuery(); - $query->setStartUsername($startUsername); - - return $this->getUserFeed($query); - } - - /** - * Retrieve all users in the current domain. Be aware that - * calling this function on a domain with many users will take a - * signifigant amount of time to complete. On larger domains this may - * may cause execution to timeout without proper precautions in place. - * - * @return object collection of Zend_Gdata_UserEntry - * objects representing all users in the domain - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveAllUsers() - { - return $this->retrieveAllEntriesForFeed($this->retrievePageOfUsers()); - } - - /** - * Overwrite a specified username with the provided UserEntry. The - * UserEntry does not need to contain an edit link. - * - * This method is provided for compliance with the Google Apps - * Provisioning API specification. Normally users will instead want to - * call UserEntry::save() instead. - * - * @param string $username the username whose data will be overwritten - * @param Zend_Gdata_Gapps_UserEntry $userEntry the user entry which - * will be overwritten - * - * @return Zend_Gdata_App_Entry the UserEntry returned by the - * server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - * - *@see Zend_Gdata_App_Entry::save - */ - public function updateUser($username, $userEntry) - { - return $this->updateEntry($userEntry, $this->getBaseUrl(). - self::APPS_USER_PATH.'/'.$username); - } - - /** - * Mark a given user as suspended. - * - * @param string $username the username associated with the user who - * should be suspended - * - * @return Zend_Gdata_App_Entry the UserEntry for the modified - * user - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function suspendUser($username) - { - $user = $this->retrieveUser($username); - $user->login->suspended = true; - - return $user->save(); - } - - /** - * Mark a given user as not suspended. - * - * @param string $username the username associated with the user who - * should be restored - * - * @return Zend_Gdata_App_Entry the UserEntry for the modified - * user - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function restoreUser($username) - { - $user = $this->retrieveUser($username); - $user->login->suspended = false; - - return $user->save(); - } - - /** - * Delete a user by username. - * - * @param string $username the username associated with the user who - * should be deleted - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function deleteUser($username) - { - $this->delete($this->getBaseUrl().self::APPS_USER_PATH.'/'. - $username); - } - - /** - * Create a nickname for a given user. - * - * @param string $username the username to which the new nickname should - * be associated - * @param string $nickname the new nickname to be created - * - * @return Zend_Gdata_App_Entry the nickname entry which was - * created by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function createNickname($username, $nickname) - { - $entry = $this->newNicknameEntry(); - $nickname = $this->newNickname($nickname); - $login = $this->newLogin($username); - $entry->nickname = $nickname; - $entry->login = $login; - - return $this->insertNickname($entry); - } - - /** - * Retrieve the entry for a specified nickname. - * - * @param string $nickname the nickname to be retrieved - * - * @return string|Zend_Gdata_App_Entry|null the requested nickname entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveNickname($nickname) - { - $query = $this->newNicknameQuery(); - $query->setNickname($nickname); - try { - $nickname = $this->getNicknameEntry($query); - } catch (Zend_Gdata_Gapps_ServiceException $e) { - // Set the nickname to null if not found - if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { - $nickname = null; - } else { - throw $e; - } - } - - return $nickname; - } - - /** - * Retrieve all nicknames associated with a specific username. - * - * @param string $username the username whose nicknames should be - * returned - * - * @return object A feed containing all nicknames - * for the given user, or null if - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveNicknames($username) - { - $query = $this->newNicknameQuery(); - $query->setUsername($username); - $nicknameFeed = $this->retrieveAllEntriesForFeed( - $this->getNicknameFeed($query)); - - return $nicknameFeed; - } - - /** - * Retrieve a page of nicknames in alphabetical order, starting with the - * provided nickname. - * - * @param string $startNickname (optional) The first nickname to - * retrieve. If null or not declared, the page will begin with - * the first nickname in the domain. - * - * @return string|Zend_Gdata_App_Feed collection of Zend_Gdata_NicknameEntry - * objects representing all nicknames in the domain - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrievePageOfNicknames($startNickname = null) - { - $query = $this->newNicknameQuery(); - $query->setStartNickname($startNickname); - - return $this->getNicknameFeed($query); - } - - /** - * Retrieve all nicknames in the current domain. Be aware that - * calling this function on a domain with many nicknames will take a - * signifigant amount of time to complete. On larger domains this may - * may cause execution to timeout without proper precautions in place. - * - * @return object collection of Zend_Gdata_NicknameEntry - * objects representing all nicknames in the domain - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveAllNicknames() - { - return $this->retrieveAllEntriesForFeed($this->retrievePageOfNicknames()); - } - - /** - * Delete a specified nickname. - * - * @param string $nickname the name of the nickname to be deleted - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function deleteNickname($nickname) - { - $this->delete($this->getBaseUrl().self::APPS_NICKNAME_PATH.'/'.$nickname); - } - - /** - * Create a new group. - * - * @param string $groupId A unique identifier for the group - * @param string $groupName The name of the group - * @param string $description A description of the group - * @param string $emailPermission The subscription permission of the group - * - * @return Zend_Gdata_App_Entry the group entry as created on the server - */ - public function createGroup($groupId, $groupName, $description = null, $emailPermission = null) - { - $i = 0; - $group = $this->newGroupEntry(); - - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'groupId'; - $properties[$i]->value = $groupId; - ++$i; - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'groupName'; - $properties[$i]->value = $groupName; - ++$i; - - if (null != $description) { - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'description'; - $properties[$i]->value = $description; - ++$i; - } - - if (null != $emailPermission) { - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'emailPermission'; - $properties[$i]->value = $emailPermission; - ++$i; - } - - $group->property = $properties; - - return $this->insertGroup($group); - } - - /** - * Retrieves a group based on group id. - * - * @param string $groupId The unique identifier for the group - * - * @return string|Zend_Gdata_App_Entry|null the group entry as returned by the server - */ - public function retrieveGroup($groupId) - { - $query = $this->newGroupQuery($groupId); - // $query->setGroupId($groupId); - - try { - $group = $this->getGroupEntry($query); - } catch (Zend_Gdata_Gapps_ServiceException $e) { - // Set the group to null if not found - if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { - $group = null; - } else { - throw $e; - } - } - - return $group; - } - - /** - * Retrieve all groups in the current domain. Be aware that - * calling this function on a domain with many groups will take a - * signifigant amount of time to complete. On larger domains this may - * may cause execution to timeout without proper precautions in place. - * - * @return object collection of Zend_Gdata_GroupEntry objects - * representing all groups apart of the domain - */ - public function retrieveAllGroups() - { - return $this->retrieveAllEntriesForFeed($this->retrievePageOfGroups()); - } - - /** - * Delete a group. - * - * @param string $groupId The unique identifier for the group - */ - public function deleteGroup($groupId) - { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId; - - $this->delete($uri); - } - - /** - * Check to see if a member id or group id is a member of group. - * - * @param string $memberId Member id or group group id - * @param string $groupId Group to be checked for - * - * @return bool True, if given entity is a member - */ - public function isMember($memberId, $groupId) - { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/member/'.$memberId; - - // if the enitiy is not a member, an exception is thrown - try { - $results = $this->get($uri); - } catch (Throwable $e) { - $results = false; - } - - if ($results) { - return true; - } else { - return false; - } - } - - /** - * Add an email address to a group as a member. - * - * @param string $recipientAddress Email address, member id, or group id - * @param string $groupId The unique id of the group - * - * @return Zend_Gdata_App_Entry The member entry returned by the server - */ - public function addMemberToGroup($recipientAddress, $groupId) - { - $member = $this->newMemberEntry(); - - $properties[] = $this->newProperty(); - $properties[0]->name = 'memberId'; - $properties[0]->value = $recipientAddress; - - $member->property = $properties; - - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/member'; - - return $this->insertMember($member, $uri); - } - - /** - * Remove a member id from a group. - * - * @param string $memberId Member id or group id - * @param string $groupId The unique id of the group - */ - public function removeMemberFromGroup($memberId, $groupId) - { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/member/'.$memberId; - - return $this->delete($uri); - } - - /** - * Retrieves all the members of a group. - * - * @param string $groupId The unique id of the group - * - * @return object collection of MemberEntry objects - * representing all members apart of the group - */ - public function retrieveAllMembers($groupId) - { - return $this->retrieveAllEntriesForFeed( - $this->retrievePageOfMembers($groupId)); - } - - /** - * Add an email as an owner of a group. - * - * @param string $email Owner's email - * @param string $groupId Group ownership to be checked for - * - * @return Zend_Gdata_App_Entry The OwnerEntry returned by the server - */ - public function addOwnerToGroup($email, $groupId) - { - $owner = $this->newOwnerEntry(); - - $properties[] = $this->newProperty(); - $properties[0]->name = 'email'; - $properties[0]->value = $email; - - $owner->property = $properties; - - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/owner'; - - return $this->insertOwner($owner, $uri); - } - - /** - * Retrieves all the owners of a group. - * - * @param string $groupId The unique identifier for the group - * - * @return string|Zend_Gdata_App_Feed collection of Zend_Gdata_OwnerEntry - * objects representing all owners apart of the group - */ - public function retrieveGroupOwners($groupId) - { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/owner'; - - return $this->getOwnerFeed($uri); - } - - /** - * Checks to see if an email is an owner of a group. - * - * @param string $email Owner's email - * @param string $groupId Group ownership to be checked for - * - * @return bool True, if given entity is an owner - */ - public function isOwner($email, $groupId) - { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/owner/'.$email; - - // if the enitiy is not an owner of the group, an exception is thrown - try { - $results = $this->get($uri); - } catch (Throwable $e) { - $results = false; - } - - if ($results) { - return true; - } else { - return false; - } - } - - /** - * Remove email as an owner of a group. - * - * @param string $email Owner's email - * @param string $groupId The unique identifier for the group - */ - public function removeOwnerFromGroup($email, $groupId) - { - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId.'/owner/'.$email; - - return $this->delete($uri); - } - - /** - * Update group properties with new values. any property not defined will not - * be updated. - * - * @param string $groupId A unique identifier for the group - * @param string $groupName The name of the group - * @param string $description A description of the group - * @param string $emailPermission The subscription permission of the group - * - * @return Zend_Gdata_App_Entry the group entry as updated on the server - */ - public function updateGroup($groupId, $groupName = null, $description = null, - $emailPermission = null) - { - $i = 0; - $group = $this->newGroupEntry(); - - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'groupId'; - $properties[$i]->value = $groupId; - ++$i; - - if (null != $groupName) { - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'groupName'; - $properties[$i]->value = $groupName; - ++$i; - } - - if (null != $description) { - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'description'; - $properties[$i]->value = $description; - ++$i; - } - - if (null != $emailPermission) { - $properties[$i] = $this->newProperty(); - $properties[$i]->name = 'emailPermission'; - $properties[$i]->value = $emailPermission; - ++$i; - } - - $group->property = $properties; - - $uri = self::APPS_BASE_FEED_URI.self::APPS_GROUP_PATH.'/'; - $uri .= $this->getDomain().'/'.$groupId; - - return $this->updateEntry($group, $uri, 'Zend_Gdata_Gapps_GroupEntry'); - } - - /** - * Retrieve all of the groups that a user is a member of. - * - * @param string $memberId Member username - * @param bool $directOnly (Optional) If true, members with direct association - * only will be considered - * - * @return string|Zend_Gdata_App_Feed collection of Zend_Gdata_GroupEntry - * objects representing all groups member is apart of in the domain - */ - public function retrieveGroups($memberId, $directOnly = null) - { - $query = $this->newGroupQuery(); - $query->setMember($memberId); - if (null != $directOnly) { - $query->setDirectOnly($directOnly); - } - - return $this->getGroupFeed($query); - } - - /** - * Retrieve a page of groups in alphabetical order, starting with the - * provided group. - * - * @param string $startGroup (optional) The first group to - * retrieve. If null or not defined, the page will begin - * with the first group in the domain. - * - * @return string|Zend_Gdata_App_Feed collection of Zend_Gdata_GroupEntry - * objects representing the groups in the domain - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrievePageOfGroups($startGroup = null) - { - $query = $this->newGroupQuery(); - $query->setStartGroupId($startGroup); - - return $this->getGroupFeed($query); - } - - /** - * Gets page of Members. - * - * @param string $groupId the group id which should be searched - * @param string $startMember (optinal) The address of the first member, - * or null to start with the first member in the list - * - * @return string|Zend_Gdata_App_Feed Collection of Zend_Gdata_MemberEntry - * objects - */ - public function retrievePageOfMembers($groupId, $startMember = null) - { - $query = $this->newMemberQuery($groupId); - $query->setStartMemberId($startMember); - - return $this->getMemberFeed($query); - } - - /** - * Create a new email list. - * - * @param string $emailList the name of the email list to be created - * - * @return Zend_Gdata_App_Entry the email list entry - * as created on the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function createEmailList($emailList) - { - $entry = $this->newEmailListEntry(); - $list = $this->newEmailList(); - $list->name = $emailList; - $entry->emailList = $list; - - return $this->insertEmailList($entry); - } - - /** - * Retrieve all email lists associated with a recipient. - * - * @return string|Zend_Gdata_App_Feed the list of email lists found as - * Zend_Gdata_EmailListEntry objects - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveEmailLists($recipient) - { - $query = $this->newEmailListQuery(); - $query->recipient = $recipient; - - return $this->getEmailListFeed($query); - } - - /** - * Retrieve a page of email lists in alphabetical order, starting with the - * provided email list. - * - * @return string|Zend_Gdata_App_Feed collection of Zend_Gdata_EmailListEntry - * objects representing all nicknames in the domain - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrievePageOfEmailLists($startNickname = null) - { - $query = $this->newEmailListQuery(); - $query->setStartEmailListName($startNickname); - - return $this->getEmailListFeed($query); - } - - /** - * Retrieve all email lists associated with the curent domain. Be aware that - * calling this function on a domain with many email lists will take a - * signifigant amount of time to complete. On larger domains this may - * may cause execution to timeout without proper precautions in place. - * - * @return object the list of email lists found - * as Zend_Gdata_Gapps_EmailListEntry objects - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveAllEmailLists() - { - return $this->retrieveAllEntriesForFeed($this->retrievePageOfEmailLists()); - } - - /** - * Delete a specified email list. - * - * @param string $emailList the name of the emailList to be deleted - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function deleteEmailList($emailList) - { - $this->delete($this->getBaseUrl().self::APPS_EMAIL_LIST_PATH.'/' - .$emailList); - } - - /** - * Add a specified recipient to an existing emailList. - * - * @param string $recipientAddress the address of the recipient to be - * added to the email list - * @param string $emailList the name of the email address to which the - * recipient should be added - * - * @return Zend_Gdata_App_Entry the recipient entry - * created by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function addRecipientToEmailList($recipientAddress, $emailList) - { - $entry = $this->newEmailListRecipientEntry(); - $who = $this->newWho(); - $who->email = $recipientAddress; - $entry->who = $who; - $address = $this->getBaseUrl().self::APPS_EMAIL_LIST_PATH.'/'. - $emailList.self::APPS_EMAIL_LIST_RECIPIENT_POSTFIX.'/'; - - return $this->insertEmailListRecipient($entry, $address); - } - - /** - * Retrieve a page of email list recipients in alphabetical order, - * starting with the provided email list recipient. - * - * @param string $startRecipient (optinal) The address of the first - * recipient, or null to start with the first recipient in - * the list - * - * @return string|Zend_Gdata_App_Feed collection of - * Zend_Gdata_EmailListRecipientEntry objects representing all - * recpients in the specified list - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrievePageOfRecipients($emailList, - $startRecipient = null) - { - $query = $this->newEmailListRecipientQuery(); - $query->setEmailListName($emailList); - $query->setStartRecipient($startRecipient); - - return $this->getEmailListRecipientFeed($query); - } - - /** - * Retrieve all recipients associated with an email list. Be aware that - * calling this function on a domain with many email lists will take a - * signifigant amount of time to complete. On larger domains this may - * may cause execution to timeout without proper precautions in place. - * - * @return object the list of email lists - * found as Zend_Gdata_Gapps_EmailListRecipientEntry objects - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function retrieveAllRecipients($emailList) - { - return $this->retrieveAllEntriesForFeed( - $this->retrievePageOfRecipients($emailList)); - } - - /** - * Remove a specified recipient from an email list. - * - * @param string $recipientAddress the recipient to be removed - * @param string $emailList the list from which the recipient should - * be removed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - * @throws Zend_Gdata_Gapps_ServiceException - */ - public function removeRecipientFromEmailList($recipientAddress, $emailList) - { - $this->delete($this->getBaseUrl().self::APPS_EMAIL_LIST_PATH.'/' - .$emailList.self::APPS_EMAIL_LIST_RECIPIENT_POSTFIX.'/' - .$recipientAddress); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListEntry.php deleted file mode 100644 index 6f7a72d1c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListEntry.php +++ /dev/null @@ -1,221 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_EmailListEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry'; - - /** - * child element containing general information about - * this email list. - * - * @var Zend_Gdata_Gapps_Extension_EmailList - */ - protected $_emailList; - - /** - * element containing information about other feeds - * relevant to this entry. - * - * @var Zend_Gdata_Extension_FeedLink - */ - protected $_feedLink = []; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_emailList) { - $element->appendChild($this->_emailList->getDOM($element->ownerDocument)); - } - foreach ($this->_feedLink as $feedLink) { - $element->appendChild($feedLink->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('apps').':emailList': - $emailList = new Zend_Gdata_Gapps_Extension_EmailList(); - $emailList->transferFromDOM($child); - $this->_emailList = $emailList; - break; - case $this->lookupNamespace('gd').':feedLink': - $feedLink = new Zend_Gdata_Extension_FeedLink(); - $feedLink->transferFromDOM($child); - $this->_feedLink[] = $feedLink; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Retrieve the email list property for this entry. - * - * @see setEmailList - * - * @return Zend_Gdata_Gapps_Extension_EmailList the requested object - * or null if not set - */ - public function getEmailList() - { - return $this->_emailList; - } - - /** - * Set the email list property for this entry. This property contains - * information such as the name of this email list. - * - * This corresponds to the property in the Google Data - * protocol. - * - * @param Zend_Gdata_Gapps_Extension_EmailList $value the desired value - * this element, or null to unset - * - * @return Zend_Gdata_Gapps_EmailListEntry Provides a fluent interface - */ - public function setEmailList($value) - { - $this->_emailList = $value; - - return $this; - } - - /** - * Get the feed link property for this entry. - * - * @see setFeedLink - * - * @param string $rel (optional) The rel value of the link to be found. - * If null, the array of links is returned. - * - * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink - * object corresponding to the requested rel value is returned - * if found, or null if the requested value is not found. If - * $rel is null or not specified, an array of all available - * feed links for this entry is returned, or null if no feed - * links are set. - */ - public function getFeedLink($rel = null) - { - if (null == $rel) { - return $this->_feedLink; - } else { - foreach ($this->_feedLink as $feedLink) { - if ($feedLink->rel == $rel) { - return $feedLink; - } - } - - return null; - } - } - - /** - * Set the feed link property for this entry. Feed links provide - * information about other feeds associated with this entry. - * - * This corresponds to the property in the Google Data - * protocol. - * - * @param array $value a collection of Zend_Gdata_Gapps_Extension_FeedLink - * instances representing all feed links for this entry, or - * null to unset - * - * @return Zend_Gdata_Gapps_EmailListEntry Provides a fluent interface - */ - public function setFeedLink($value) - { - $this->_feedLink = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListFeed.php deleted file mode 100644 index 1049866a1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setEmailListName($emailListName); - $this->setRecipient($recipient); - $this->setStartEmailListName($startEmailListName); - } - - /** - * Set the email list name to query for. When set, only lists with a name - * matching this value will be returned in search results. Set to - * null to disable filtering by list name. - * - * @param string $value the email list name to filter search results by, - * or null to disable - */ - public function setEmailListName($value) - { - $this->_emailListName = $value; - } - - /** - * Get the email list name to query for. If no name is set, null will be - * returned. - * - * @see setEmailListName - * - * @return string the email list name to filter search results by, or null - * if disabled - */ - public function getEmailListName() - { - return $this->_emailListName; - } - - /** - * Set the recipient to query for. When set, only subscribers with an - * email address matching this value will be returned in search results. - * Set to null to disable filtering by username. - * - * @param string $value the recipient email address to filter search - * results by, or null to disable - */ - public function setRecipient($value) - { - if (null !== $value) { - $this->_params['recipient'] = $value; - } else { - unset($this->_params['recipient']); - } - } - - /** - * Get the recipient email address to query for. If no recipient is set, - * null will be returned. - * - * @see setRecipient - * - * @return string the recipient email address to filter search results by, - * or null if disabled - */ - public function getRecipient() - { - if (array_key_exists('recipient', $this->_params)) { - return $this->_params['recipient']; - } else { - return null; - } - } - - /** - * Set the first email list which should be displayed when retrieving - * a list of email lists. - * - * @param string $value the first email list to be returned, or null to - * disable - */ - public function setStartEmailListName($value) - { - if (null !== $value) { - $this->_params['startEmailListName'] = $value; - } else { - unset($this->_params['startEmailListName']); - } - } - - /** - * Get the first email list which should be displayed when retrieving - * a list of email lists. - * - * @return string the first email list to be returned, or null to - * disable - */ - public function getStartEmailListName() - { - if (array_key_exists('startEmailListName', $this->_params)) { - return $this->_params['startEmailListName']; - } else { - return null; - } - } - - /** - * Returns the URL generated for this query, based on it's current - * parameters. - * - * @return string a URL generated based on the state of this query - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getQueryUrl() - { - $uri = $this->getBaseUrl(); - $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH; - if (null !== $this->_emailListName) { - $uri .= '/'.$this->_emailListName; - } - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListRecipientEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListRecipientEntry.php deleted file mode 100644 index bf7426213..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListRecipientEntry.php +++ /dev/null @@ -1,148 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_EmailListRecipientEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry'; - - /** - * element used to store the email address of the current - * recipient. Only the email property of this element should be - * populated. - * - * @var Zend_Gdata_Extension_Who - */ - protected $_who; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_who) { - $element->appendChild($this->_who->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':who': - $who = new Zend_Gdata_Extension_Who(); - $who->transferFromDOM($child); - $this->_who = $who; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value of the who property for this object. - * - * @see setWho - * - * @return Zend_Gdata_Extension_Who the requested object - */ - public function getWho() - { - return $this->_who; - } - - /** - * Set the value of the who property for this object. This property - * is used to store the email address of the current recipient. - * - * @param Zend_Gdata_Extension_Who $value the desired value for this - * instance's who property - * - * @return Zend_Gdata_Gapps_EmailListRecipientEntry provides a fluent interface - */ - public function setWho($value) - { - $this->_who = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListRecipientFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListRecipientFeed.php deleted file mode 100644 index 500b2998e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/EmailListRecipientFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setEmailListName($emailListName); - $this->setStartRecipient($startRecipient); - } - - /** - * Set the email list name to query for. When set, only lists with a name - * matching this value will be returned in search results. Set to - * null to disable filtering by list name. - * - * @param string $value the email list name to filter search results by, - * or null to disable - */ - public function setEmailListName($value) - { - $this->_emailListName = $value; - } - - /** - * Get the email list name to query for. If no name is set, null will be - * returned. - */ - public function getEmailListName() - { - return $this->_emailListName; - } - - /** - * Set the first recipient which should be displayed when retrieving - * a list of email list recipients. - * - * @param string $value the first recipient to be returned, or null to - * disable - */ - public function setStartRecipient($value) - { - if (null !== $value) { - $this->_params['startRecipient'] = $value; - } else { - unset($this->_params['startRecipient']); - } - } - - /** - * Get the first recipient which should be displayed when retrieving - * a list of email list recipients. - * - * @return string the first recipient to be returned, or null if - * disabled - */ - public function getStartRecipient() - { - if (array_key_exists('startRecipient', $this->_params)) { - return $this->_params['startRecipient']; - } else { - return null; - } - } - - /** - * Returns the URL generated for this query, based on it's current - * parameters. - * - * @return string a URL generated based on the state of this query - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getQueryUrl() - { - $uri = $this->getBaseUrl(); - $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH; - if (null !== $this->_emailListName) { - $uri .= '/'.$this->_emailListName; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('EmailListName must not be null'); - } - $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_RECIPIENT_POSTFIX.'/'; - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Error.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Error.php deleted file mode 100644 index 6d1df2f52..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Error.php +++ /dev/null @@ -1,245 +0,0 @@ -_errorCode = $errorCode; - $this->_reason = $reason; - $this->_invalidInput = $invalidInput; - } - - /** - * Set the error code for this exception. For more information about - * error codes, see getErrorCode. - * - * @see getErrorCode - * - * @param int $value the new value for the error code - */ - public function setErrorCode($value) - { - $this->_errorCode = $value; - } - - /** - * Get the error code for this exception. Currently valid values are - * available as constants within this class. These values are: - * - * UNKNOWN_ERROR (1000) - * USER_DELETED_RECENTLY (1100) - * USER_SUSPENDED (1101) - * DOMAIN_USER_LIMIT_EXCEEDED (1200) - * DOMAIN_ALIAS_LIMIT_EXCEEDED (1201) - * DOMAIN_SUSPENDED (1202) - * DOMAIN_FEATURE_UNAVAILABLE (1203) - * ENTITY_EXISTS (1300) - * ENTITY_DOES_NOT_EXIST (1301) - * ENTITY_NAME_IS_RESERVED (1302) - * ENTITY_NAME_NOT_VALID (1303) - * INVALID_GIVEN_NAME (1400) - * INVALID_FAMILY_NAME (1401) - * INVALID_PASSWORD (1402) - * INVALID_USERNAME (1403) - * INVALID_HASH_FUNCTION_NAME (1404) - * INVALID_HASH_DIGEST_LENGTH (1405) - * INVALID_EMAIL_ADDRESS (1406) - * INVALID_QUERY_PARAMETER_VALUE (1407) - * TOO_MANY_RECIPIENTS_ON_EMAIL_LIST (1500) - * - * Numbers in parenthesis indicate the actual integer value of the - * constant. This list should not be treated as exhaustive, as additional - * error codes may be added at any time. - * - * For more information about these codes and their meaning, please - * see Appendix D of the Google Apps Provisioning API Reference. - * - * @see http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d Google Apps Provisioning API Reference: Appendix D - Gdata Error Codes - * @see setErrorCode - * - * @return int the error code returned by the Google Apps server - */ - public function getErrorCode() - { - return $this->_errorCode; - } - - /** - * Set human-readable text describing the reason this exception occurred. - * - * @see getReason - * - * @param string $value the reason this exception occurred - */ - public function setReason($value) - { - $this->_reason = $value; - } - - /** - * Get human-readable text describing the reason this exception occurred. - * - * @see setReason - * - * @return string the reason this exception occurred - */ - public function getReason() - { - return $this->_reason; - } - - /** - * Set the invalid input which caused this exception. - * - * @see getInvalidInput - * - * @param string $value the invalid input that triggered this exception - */ - public function setInvalidInput($value) - { - $this->_invalidInput = $value; - } - - /** - * Set the invalid input which caused this exception. - * - * @see setInvalidInput - * - * @return string the reason this exception occurred - */ - public function getInvalidInput() - { - return $this->_invalidInput; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_errorCode) { - $element->setAttribute('errorCode', $this->_errorCode); - } - if (null !== $this->_reason) { - $element->setAttribute('reason', $this->_reason); - } - if (null !== $this->_invalidInput) { - $element->setAttribute('invalidInput', $this->_invalidInput); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'errorCode': - $this->_errorCode = $attribute->nodeValue; - break; - case 'reason': - $this->_reason = $attribute->nodeValue; - break; - case 'invalidInput': - $this->_invalidInput = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get a human readable version of this exception. - * - * @return string - */ - public function __toString() - { - return 'Error '.$this->getErrorCode().': '.$this->getReason(). - "\n\tInvalid Input: \"".$this->getInvalidInput().'"'; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/EmailList.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/EmailList.php deleted file mode 100644 index 417ab4572..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/EmailList.php +++ /dev/null @@ -1,146 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct(); - $this->_name = $name; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_name) { - $element->setAttribute('name', $this->_name); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'name': - $this->_name = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's name attribute. - * - * @see setName - * - * @return string the requested attribute - */ - public function getName() - { - return $this->_name; - } - - /** - * Set the value for this element's name attribute. This is the unique - * name which will be used to identify this email list within this - * domain, and will be used to form this email list's email address. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_EmailList the element being modified - */ - public function setName($value) - { - $this->_name = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - * - * @return string - */ - public function __toString() - { - return $this->getName(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Login.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Login.php deleted file mode 100644 index fb263d744..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Login.php +++ /dev/null @@ -1,510 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct(); - $this->_username = $username; - $this->_password = $password; - $this->_hashFunctionName = $hashFunctionName; - $this->_admin = $admin; - $this->_agreedToTerms = $agreedToTerms; - $this->_suspended = $suspended; - $this->_changePasswordAtNextLogin = $changePasswordAtNextLogin; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_username) { - $element->setAttribute('userName', $this->_username); - } - if (null !== $this->_password) { - $element->setAttribute('password', $this->_password); - } - if (null !== $this->_hashFunctionName) { - $element->setAttribute('hashFunctionName', $this->_hashFunctionName); - } - if (null !== $this->_admin) { - $element->setAttribute('admin', $this->_admin ? 'true' : 'false'); - } - if (null !== $this->_agreedToTerms) { - $element->setAttribute('agreedToTerms', $this->_agreedToTerms ? 'true' : 'false'); - } - if (null !== $this->_suspended) { - $element->setAttribute('suspended', $this->_suspended ? 'true' : 'false'); - } - if (null !== $this->_changePasswordAtNextLogin) { - $element->setAttribute('changePasswordAtNextLogin', $this->_changePasswordAtNextLogin ? 'true' : 'false'); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'userName': - $this->_username = $attribute->nodeValue; - break; - case 'password': - $this->_password = $attribute->nodeValue; - break; - case 'hashFunctionName': - $this->_hashFunctionName = $attribute->nodeValue; - break; - case 'admin': - if ('true' == $attribute->nodeValue) { - $this->_admin = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_admin = false; - } else { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#admin."); - } - break; - case 'agreedToTerms': - if ('true' == $attribute->nodeValue) { - $this->_agreedToTerms = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_agreedToTerms = false; - } else { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#agreedToTerms."); - } - break; - case 'suspended': - if ('true' == $attribute->nodeValue) { - $this->_suspended = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_suspended = false; - } else { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#suspended."); - } - break; - case 'changePasswordAtNextLogin': - if ('true' == $attribute->nodeValue) { - $this->_changePasswordAtNextLogin = true; - } elseif ('false' == $attribute->nodeValue) { - $this->_changePasswordAtNextLogin = false; - } else { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#changePasswordAtNextLogin."); - } - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's username attribute. - * - * @see setUsername - * - * @return string the attribute being modified - */ - public function getUsername() - { - return $this->_username; - } - - /** - * Set the value for this element's username attribute. This string - * is used to uniquely identify the user in this domian and is used - * to form this user's email address. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - */ - public function setUsername($value) - { - $this->_username = $value; - - return $this; - } - - /** - * Get the value for this element's password attribute. - * - * @see setPassword - * - * @return string the requested attribute - */ - public function getPassword() - { - return $this->_password; - } - - /** - * Set the value for this element's password attribute. As of this - * writing, this can be either be provided as plaintext or hashed using - * the SHA-1 algorithm for protection. If using a hash function, - * this must be indicated by calling setHashFunctionName(). - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - */ - public function setPassword($value) - { - $this->_password = $value; - - return $this; - } - - /** - * Get the value for this element's hashFunctionName attribute. - * - * @see setHashFunctionName - * - * @return string the requested attribute - */ - public function getHashFunctionName() - { - return $this->_hashFunctionName; - } - - /** - * Set the value for this element's hashFunctionName attribute. This - * indicates whether the password supplied with setPassword() is in - * plaintext or has had a hash function applied to it. If null, - * plaintext is assumed. As of this writing, the only valid hash - * function is 'SHA-1'. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - */ - public function setHashFunctionName($value) - { - $this->_hashFunctionName = $value; - - return $this; - } - - /** - * Get the value for this element's admin attribute. - * - * @see setAdmin - * - * @return bool the requested attribute - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getAdmin() - { - if (!is_bool($this->_admin)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for admin.'); - } - - return $this->_admin; - } - - /** - * Set the value for this element's admin attribute. This indicates - * whether this user is an administrator for this domain. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setAdmin($value) - { - if (!is_bool($value)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); - } - $this->_admin = $value; - - return $this; - } - - /** - * Get the value for this element's agreedToTerms attribute. - * - * @see setAgreedToTerms - * - * @return bool the requested attribute - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getAgreedToTerms() - { - if (!is_bool($this->_agreedToTerms)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for agreedToTerms.'); - } - - return $this->_agreedToTerms; - } - - /** - * Set the value for this element's agreedToTerms attribute. This - * indicates whether this user has agreed to the terms of service. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setAgreedToTerms($value) - { - if (!is_bool($value)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); - } - $this->_agreedToTerms = $value; - - return $this; - } - - /** - * Get the value for this element's suspended attribute. - * - * @see setSuspended - * - * @return bool the requested attribute - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getSuspended() - { - if (!is_bool($this->_suspended)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for suspended.'); - } - - return $this->_suspended; - } - - /** - * Set the value for this element's suspended attribute. If true, the - * user will not be able to login to this domain until unsuspended. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setSuspended($value) - { - if (!is_bool($value)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); - } - $this->_suspended = $value; - - return $this; - } - - /** - * Get the value for this element's changePasswordAtNextLogin attribute. - * - * @see setChangePasswordAtNextLogin - * - * @return bool the requested attribute - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getChangePasswordAtNextLogin() - { - if (!is_bool($this->_changePasswordAtNextLogin)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for changePasswordAtNextLogin.'); - } - - return $this->_changePasswordAtNextLogin; - } - - /** - * Set the value for this element's changePasswordAtNextLogin attribute. - * If true, the user will be forced to set a new password the next - * time they login. - * - * @param bool $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Login provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setChangePasswordAtNextLogin($value) - { - if (!is_bool($value)) { - // require_once('Zend/Gdata/App/InvalidArgumentException.php'); - throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); - } - $this->_changePasswordAtNextLogin = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return 'Username: '.$this->getUsername(). - "\nPassword: ".((null === $this->getPassword()) ? 'NOT SET' : 'SET'). - "\nPassword Hash Function: ".$this->getHashFunctionName(). - "\nAdministrator: ".($this->getAdmin() ? 'Yes' : 'No'). - "\nAgreed To Terms: ".($this->getAgreedToTerms() ? 'Yes' : 'No'). - "\nSuspended: ".($this->getSuspended() ? 'Yes' : 'No'); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Name.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Name.php deleted file mode 100644 index 2a2e6cec0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Name.php +++ /dev/null @@ -1,186 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct(); - $this->_familyName = $familyName; - $this->_givenName = $givenName; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_familyName) { - $element->setAttribute('familyName', $this->_familyName); - } - if (null !== $this->_givenName) { - $element->setAttribute('givenName', $this->_givenName); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'familyName': - $this->_familyName = $attribute->nodeValue; - break; - case 'givenName': - $this->_givenName = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's familyName attribute. - * - * @see setFamilyName - * - * @return string the requested attribute - */ - public function getFamilyName() - { - return $this->_familyName; - } - - /** - * Set the value for this element's familyName attribute. This - * represents a user's family name. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Name Provides a fluent interface.. - */ - public function setFamilyName($value) - { - $this->_familyName = $value; - - return $this; - } - - /** - * Get the value for this element's givenName attribute. - * - * @see setGivenName - * - * @return string the requested attribute - */ - public function getGivenName() - { - return $this->_givenName; - } - - /** - * Set the value for this element's givenName attribute. This - * represents a user's given name. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Name provides a fluent interface - */ - public function setGivenName($value) - { - $this->_givenName = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getGivenName().' '.$this->getFamilyName(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Nickname.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Nickname.php deleted file mode 100644 index f0abb2383..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Nickname.php +++ /dev/null @@ -1,145 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct(); - $this->_name = $name; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_name) { - $element->setAttribute('name', $this->_name); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'name': - $this->_name = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's name attribute. - * - * @see setName - * - * @return string the requested attribute - */ - public function getName() - { - return $this->_name; - } - - /** - * Set the value for this element's name attribute. This name uniquely - * describes this nickname within the domain. Emails addressed to this - * name will be delivered to the user who owns this nickname. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Nickname provides a fluent - * interface - */ - public function setName($value) - { - $this->_name = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getName(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Property.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Property.php deleted file mode 100644 index bbf438751..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Property.php +++ /dev/null @@ -1,183 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct(); - $this->_name = $name; - $this->_value = $value; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_name) { - $element->setAttribute('name', $this->_name); - } - if (null !== $this->_value) { - $element->setAttribute('value', $this->_value); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'name': - $this->_name = $attribute->nodeValue; - break; - case 'value': - $this->_value = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's name attribute. - * - * @see setName - * - * @return string the requested attribute - */ - public function getName() - { - return $this->_name; - } - - /** - * Set the value for this element's name attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Property the element being modified - */ - public function setName($value) - { - $this->_name = $value; - - return $this; - } - - /** - * Get the value for this element's value attribute. - * - * @see setName - * - * @return string the requested attribute - */ - public function getValue() - { - return $this->_value; - } - - /** - * Set the value for this element's value attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Property the element being modified - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - * - * @return string - */ - public function __toString() - { - return 'Property Name: '.$this->getName(). - "\nProperty Value: ".$this->getValue(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Quota.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Quota.php deleted file mode 100644 index 1f44d3618..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Extension/Quota.php +++ /dev/null @@ -1,144 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct(); - $this->_limit = $limit; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_limit) { - $element->setAttribute('limit', $this->_limit); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'limit': - $this->_limit = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Get the value for this element's limit attribute. - * - * @see setLimit - * - * @return string the requested attribute - */ - public function getLimit() - { - return $this->_limit; - } - - /** - * Set the value for this element's limit attribute. This is the amount - * of storage space, in bytes, that should be made available to - * the associated user. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Gapps_Extension_Quota provides a fluent interface - */ - public function setLimit($value) - { - $this->_limit = $value; - - return $this; - } - - /** - * Magic toString method allows using this directly via echo - * Works best in PHP >= 4.2.0. - */ - public function __toString() - { - return $this->getLimit(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/GroupEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/GroupEntry.php deleted file mode 100644 index fbc0bcfa4..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/GroupEntry.php +++ /dev/null @@ -1,159 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_GroupEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_GroupEntry'; - - /** - * element containing information about other items - * relevant to this entry. - * - * @var Zend_Gdata_Gapps_Extension_Property - */ - protected $_property = []; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - - foreach ($this->_property as $p) { - $element->appendChild($p->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('apps').':property': - $property = new Zend_Gdata_Gapps_Extension_Property(); - $property->transferFromDOM($child); - $this->_property[] = $property; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Returns all property tags for this entry. - * - * @param string $rel The rel value of the property to be found. If null, - * the array of properties is returned instead. - * - * @return mixed either an array of Zend_Gdata_Gapps_Extension_Property - * objects if $rel is null, a single - * Zend_Gdata_Gapps_Extension_Property object if $rel is specified - * and a matching feed link is found, or null if $rel is - * specified and no matching property is found - */ - public function getProperty($rel = null) - { - if (null == $rel) { - return $this->_property; - } else { - foreach ($this->_property as $p) { - if ($p->rel == $rel) { - return $p; - } - } - - return null; - } - } - - /** - * Set the value of the property property for this object. - * - * @param array $value a collection of - * Zend_Gdata_Gapps_Extension_Property objects - * - * @return Zend_Gdata_Gapps_GroupEntry provides a fluent interface - */ - public function setProperty($value) - { - $this->_property = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/GroupFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/GroupFeed.php deleted file mode 100644 index 72da2f73b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/GroupFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setGroupId($groupId); - $this->setStartGroupId($startGroupId); - } - - /** - * Set the group id to query for. When set, only groups with a group id - * matching this value will be returned in search results. Set to - * null to disable filtering by group id. - * - * @see getGroupId - * - * @param string $value the group id to filter search results by, or null to - * disable - */ - public function setGroupId($value) - { - $this->_groupId = $value; - } - - /** - * Get the group id to query for. If no group id is set, null will be - * returned. - */ - public function getGroupId() - { - return $this->_groupId; - } - - /** - * Set the member to query for. When set, only subscribers with an - * email address matching this value will be returned in search results. - * Set to null to disable filtering by username. - * - * @param string $value the member email address to filter search - * results by, or null to disable - */ - public function setMember($value) - { - if (null !== $value) { - $this->_params['member'] = $value; - } else { - unset($this->_params['member']); - } - } - - /** - * Get the member email address to query for. If no member is set, - * null will be returned. - * - * @see setMember - * - * @return string the member email address to filter search - * results by, or null if disabled - */ - public function getMember() - { - if (array_key_exists('member', $this->_params)) { - return $this->_params['member']; - } else { - return null; - } - } - - /** - * Sets the query parameter directOnly. - * - * @param bool $value - */ - public function setDirectOnly($value) - { - if (null !== $value) { - if (true == $value) { - $this->_params['directOnly'] = 'true'; - } else { - $this->_params['directOnly'] = 'false'; - } - } else { - unset($this->_params['directOnly']); - } - } - - /** - * @see setDirectOnly - * - * @return bool - */ - public function getDirectOnly() - { - if (array_key_exists('directOnly', $this->_params)) { - if ('true' == $this->_params['directOnly']) { - return true; - } else { - return false; - } - } else { - return null; - } - } - - /** - * Set the first group id which should be displayed when retrieving - * a list of groups. - * - * @param string $value the first group id to be returned, or null to - * disable - */ - public function setStartGroupId($value) - { - if (null !== $value) { - $this->_params['start'] = $value; - } else { - unset($this->_params['start']); - } - } - - /** - * Get the first group id which should be displayed when retrieving - * a list of groups. - * - * @see setStartGroupId - * - * @return string the first group id to be returned, or null if - * disabled - */ - public function getStartGroupId() - { - if (array_key_exists('start', $this->_params)) { - return $this->_params['start']; - } else { - return null; - } - } - - /** - * Returns the query URL generated by this query instance. - * - * @return string the query URL for this instance - */ - public function getQueryUrl() - { - $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI; - $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH; - $uri .= '/'.$this->_domain; - - if (null !== $this->_groupId) { - $uri .= '/'.$this->_groupId; - } - - if (array_key_exists('member', $this->_params)) { - $uri .= '/'; - } - - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/MemberEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/MemberEntry.php deleted file mode 100644 index 3817d8f6c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/MemberEntry.php +++ /dev/null @@ -1,159 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_MemberEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_MemberEntry'; - - /** - * element containing information about other items - * relevant to this entry. - * - * @var Zend_Gdata_Gapps_Extension_Property - */ - protected $_property = []; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - - foreach ($this->_property as $p) { - $element->appendChild($p->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('apps').':property': - $property = new Zend_Gdata_Gapps_Extension_Property(); - $property->transferFromDOM($child); - $this->_property[] = $property; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Returns all property tags for this entry. - * - * @param string $rel The rel value of the property to be found. If null, - * the array of properties is returned instead. - * - * @return mixed either an array of Zend_Gdata_Gapps_Extension_Property - * objects if $rel is null, a single - * Zend_Gdata_Gapps_Extension_Property object if $rel is specified - * and a matching feed link is found, or null if $rel is - * specified and no matching property is found - */ - public function getProperty($rel = null) - { - if (null == $rel) { - return $this->_property; - } else { - foreach ($this->_property as $p) { - if ($p->rel == $rel) { - return $p; - } - } - - return null; - } - } - - /** - * Set the value of the property property for this object. - * - * @param array $value a collection of - * Zend_Gdata_Gapps_Extension_Property objects - * - * @return Zend_Gdata_Gapps_MemberEntry provides a fluent interface - */ - public function setProperty($value) - { - $this->_property = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/MemberFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/MemberFeed.php deleted file mode 100644 index 19432ae8f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/MemberFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setGroupId($groupId); - $this->setMemberId($memberId); - $this->setStartMemberId($startMemberId); - } - - /** - * Set the group id to query for. - * - * @see getGroupId - * - * @param string $value the group id to filter search results by, or null to - * disable - */ - public function setGroupId($value) - { - $this->_groupId = $value; - } - - /** - * Get the group id to query for. If no group id is set, null will be - * returned. - * - * @return string The group id - */ - public function getGroupId() - { - return $this->_groupId; - } - - /** - * Set the member id to query for. When set, only users with a member id - * matching this value will be returned in search results. Set to - * null to disable filtering by member id. - * - * @see getMemberId - * - * @param string $value the member id to filter search results by, or null to - * disable - */ - public function setMemberId($value) - { - $this->_memberId = $value; - } - - /** - * Get the member id to query for. If no member id is set, null will be - * returned. - * - * @return string|null member id - */ - public function getMemberId() - { - return $this->_memberId; - } - - /** - * Set the first member id which should be displayed when retrieving - * a list of members. - * - * @param string $value the first member id to be returned, or null to - * disable - */ - public function setStartMemberId($value) - { - if (null !== $value) { - $this->_params['start'] = $value; - } else { - unset($this->_params['start']); - } - } - - /** - * Get the first username which should be displayed when retrieving - * a list of users. - * - * @see setStartUsername - * - * @return string the first username to be returned, or null if - * disabled - */ - public function getStartMemberId() - { - if (array_key_exists('start', $this->_params)) { - return $this->_params['start']; - } else { - return null; - } - } - - /** - * Returns the query URL generated by this query instance. - * - * @return string the query URL for this instance - */ - public function getQueryUrl() - { - $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI; - $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH; - $uri .= '/'.$this->_domain; - if (null !== $this->_groupId) { - $uri .= '/'.$this->_groupId; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('groupId must not be null'); - } - - $uri .= '/member'; - - if (null !== $this->_memberId) { - $uri .= '/'.$this->_memberId; - } - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/NicknameEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/NicknameEntry.php deleted file mode 100644 index 0f4b365e6..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/NicknameEntry.php +++ /dev/null @@ -1,194 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry'; - - /** - * element used to hold information about the owner - * of this nickname, including their username. - * - * @var Zend_Gdata_Gapps_Extension_Login - */ - protected $_login; - - /** - * element used to hold the name of this nickname. - * - * @var Zend_Gdata_Gapps_Extension_Nickname - */ - protected $_nickname; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_login) { - $element->appendChild($this->_login->getDOM($element->ownerDocument)); - } - if (null !== $this->_nickname) { - $element->appendChild($this->_nickname->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('apps').':login': - $login = new Zend_Gdata_Gapps_Extension_Login(); - $login->transferFromDOM($child); - $this->_login = $login; - break; - case $this->lookupNamespace('apps').':nickname': - $nickname = new Zend_Gdata_Gapps_Extension_Nickname(); - $nickname->transferFromDOM($child); - $this->_nickname = $nickname; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value of the login property for this object. - * - * @see setLogin - * - * @return Zend_Gdata_Gapps_Extension_Login the requested object - */ - public function getLogin() - { - return $this->_login; - } - - /** - * Set the value of the login property for this object. This property - * is used to store the username address of the current user. - * - * @param Zend_Gdata_Gapps_Extension_Login $value the desired value for - * this instance's login property - * - * @return Zend_Gdata_Gapps_NicknameEntry provides a fluent interface - */ - public function setLogin($value) - { - $this->_login = $value; - - return $this; - } - - /** - * Get the value of the nickname property for this object. - * - * @see setNickname - * - * @return Zend_Gdata_Gapps_Extension_Nickname the requested object - */ - public function getNickname() - { - return $this->_nickname; - } - - /** - * Set the value of the nickname property for this object. This property - * is used to store the the name of the current nickname. - * - * @param Zend_Gdata_Gapps_Extension_Nickname $value the desired value for - * this instance's nickname property - * - * @return Zend_Gdata_Gapps_NicknameEntry provides a fluent interface - */ - public function setNickname($value) - { - $this->_nickname = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/NicknameFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/NicknameFeed.php deleted file mode 100644 index 8d0521d32..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/NicknameFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setNickname($nickname); - $this->setUsername($username); - $this->setStartNickname($startNickname); - } - - /** - * Set the nickname to query for. When set, only users with a nickname - * matching this value will be returned in search results. Set to - * null to disable filtering by username. - * - * @param string $value the nickname to filter search results by, or null - * to disable - */ - public function setNickname($value) - { - $this->_nickname = $value; - } - - /** - * Get the nickname to query for. If no nickname is set, null will be - * returned. - * - * @see setNickname - * - * @return string the nickname to filter search results by, or null if - * disabled - */ - public function getNickname() - { - return $this->_nickname; - } - - /** - * Set the username to query for. When set, only users with a username - * matching this value will be returned in search results. Set to - * null to disable filtering by username. - * - * @param string $value the username to filter search results by, or null - * to disable - */ - public function setUsername($value) - { - if (null !== $value) { - $this->_params['username'] = $value; - } else { - unset($this->_params['username']); - } - } - - /** - * Get the username to query for. If no username is set, null will be - * returned. - * - * @see setUsername - * - * @return string the username to filter search results by, or null if - * disabled - */ - public function getUsername() - { - if (array_key_exists('username', $this->_params)) { - return $this->_params['username']; - } else { - return null; - } - } - - /** - * Set the first nickname which should be displayed when retrieving - * a list of nicknames. - * - * @param string $value the first nickname to be returned, or null to - * disable - */ - public function setStartNickname($value) - { - if (null !== $value) { - $this->_params['startNickname'] = $value; - } else { - unset($this->_params['startNickname']); - } - } - - /** - * Get the first nickname which should be displayed when retrieving - * a list of nicknames. - * - * @return string the first nickname to be returned, or null to - * disable - */ - public function getStartNickname() - { - if (array_key_exists('startNickname', $this->_params)) { - return $this->_params['startNickname']; - } else { - return null; - } - } - - /** - * Returns the URL generated for this query, based on it's current - * parameters. - * - * @return string a URL generated based on the state of this query - */ - public function getQueryUrl() - { - $uri = $this->getBaseUrl(); - $uri .= Zend_Gdata_Gapps::APPS_NICKNAME_PATH; - if (null !== $this->_nickname) { - $uri .= '/'.$this->_nickname; - } - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/OwnerEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/OwnerEntry.php deleted file mode 100644 index 5b4bdde8c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/OwnerEntry.php +++ /dev/null @@ -1,159 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_OwnerEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_OwnerEntry'; - - /** - * element containing information about other items - * relevant to this entry. - * - * @var Zend_Gdata_Gapps_Extension_Property - */ - protected $_property = []; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - - foreach ($this->_property as $p) { - $element->appendChild($p->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as owners of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('apps').':property': - $property = new Zend_Gdata_Gapps_Extension_Property(); - $property->transferFromDOM($child); - $this->_property[] = $property; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Returns all property tags for this entry. - * - * @param string $rel The rel value of the property to be found. If null, - * the array of properties is returned instead. - * - * @return mixed either an array of Zend_Gdata_Gapps_Extension_Property - * objects if $rel is null, a single - * Zend_Gdata_Gapps_Extension_Property object if $rel is specified - * and a matching feed link is found, or null if $rel is - * specified and no matching property is found - */ - public function getProperty($rel = null) - { - if (null == $rel) { - return $this->_property; - } else { - foreach ($this->_property as $p) { - if ($p->rel == $rel) { - return $p; - } - } - - return null; - } - } - - /** - * Set the value of the property property for this object. - * - * @param array $value a collection of - * Zend_Gdata_Gapps_Extension_Property objects - * - * @return Zend_Gdata_Gapps_OwnerEntry provides a fluent interface - */ - public function setProperty($value) - { - $this->_property = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/OwnerFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/OwnerFeed.php deleted file mode 100644 index ffabda636..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/OwnerFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setGroupId($groupId); - $this->setOwnerEmail($ownerEmail); - } - - /** - * Set the group id to query for. - * - * @see getGroupId - * - * @param string $value - */ - public function setGroupId($value) - { - $this->_groupId = $value; - } - - /** - * Get the group id to query for. - * - * @return string - */ - public function getGroupId() - { - return $this->_groupId; - } - - /** - * Set the owner email to query for. - * - * @see getOwnerEmail - * - * @param string $value - */ - public function setOwnerEmail($value) - { - $this->_ownerEmail = $value; - } - - /** - * Get the owner email to query for. - * - * @return string - */ - public function getOwnerEmail() - { - return $this->_ownerEmail; - } - - /** - * Returns the query URL generated by this query instance. - * - * @return string the query URL for this instance - */ - public function getQueryUrl() - { - $uri = Zend_Gdata_Gapps::APPS_BASE_FEED_URI; - $uri .= Zend_Gdata_Gapps::APPS_GROUP_PATH; - $uri .= '/'.$this->_domain; - if (null !== $this->_groupId) { - $uri .= '/'.$this->_groupId; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('groupId must not be null'); - } - - $uri .= '/owner'; - - if (null !== $this->_ownerEmail) { - $uri .= '/'.$this->_ownerEmail; - } - - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/Query.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/Query.php deleted file mode 100644 index 73ca219ef..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/Query.php +++ /dev/null @@ -1,119 +0,0 @@ -_domain = $domain; - } - - /** - * Set domain for this service instance. This should be a fully qualified - * domain, such as 'foo.example.com'. - * - * This value is used when calculating URLs for retrieving and posting - * entries. If no value is specified, a URL will have to be manually - * constructed prior to using any methods which interact with the Google - * Apps provisioning service. - * - * @param string $value the domain to be used for this session - */ - public function setDomain($value) - { - $this->_domain = $value; - } - - /** - * Get domain for this service instance. This should be a fully qualified - * domain, such as 'foo.example.com'. If no domain is set, null will be - * returned. - * - * @see setDomain - * - * @return string the domain to be used for this session, or null if not - * set - */ - public function getDomain() - { - return $this->_domain; - } - - /** - * Returns the base URL used to access the Google Apps service, based - * on the current domain. The current domain can be temporarily - * overridden by providing a fully qualified domain as $domain. - * - * @see setDomain - * - * @param string $domain (optional) A fully-qualified domain to use - * instead of the default domain for this service instance - */ - public function getBaseUrl($domain = null) - { - if (null !== $domain) { - return Zend_Gdata_Gapps::APPS_BASE_FEED_URI.'/'.$domain; - } elseif (null !== $this->_domain) { - return Zend_Gdata_Gapps::APPS_BASE_FEED_URI.'/'.$this->_domain; - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Domain must be specified.'); - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/ServiceException.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/ServiceException.php deleted file mode 100644 index f13afa619..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/ServiceException.php +++ /dev/null @@ -1,218 +0,0 @@ -setErrors($errors); - } - } - - /** - * Add a single Error object to the list of errors received by the - * server. - * - * @param Zend_Gdata_Gapps_Error $error An instance of an error returned - * by the server. The error's errorCode must be set. - * - * @throws Zend_Gdata_App_Exception - */ - public function addError($error) - { - // Make sure that we don't try to index an error that doesn't - // contain an index value. - if (null == $error->getErrorCode()) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Error encountered without corresponding error code.'); - } - - $this->_errors[$error->getErrorCode()] = $error; - } - - /** - * Set the list of errors as sent by the server inside of an - * AppsForYourDomainErrors tag. - * - * @param array $array An associative array containing a collection of - * Zend_Gdata_Gapps_Error objects. All errors must have their - * errorCode value set. - * - * @throws Zend_Gdata_App_Exception - */ - public function setErrors($array) - { - $this->_errors = []; - foreach ($array as $error) { - $this->addError($error); - } - } - - /** - * Get the list of errors as sent by the server inside of an - * AppsForYourDomainErrors tag. - * - * @return array an associative array containing a collection of - * Zend_Gdata_Gapps_Error objects, indexed by error code - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * Return the Error object associated with a specific error code. - * - * @return Zend_Gdata_Gapps_Error the Error object requested, or null - * if not found - */ - public function getError($errorCode) - { - if (array_key_exists($errorCode, $this->_errors)) { - $result = $this->_errors[$errorCode]; - - return $result; - } else { - return null; - } - } - - /** - * Check whether or not a particular error code was returned by the - * server. - * - * @param int $errorCode the error code to check against - * - * @return bool whether or not the supplied error code was returned - * by the server - */ - public function hasError($errorCode) - { - return array_key_exists($errorCode, $this->_errors); - } - - /** - * Import an AppsForYourDomain error from XML. - * - * @param string $string The XML data to be imported - * - * @return Zend_Gdata_Gapps_ServiceException provides a fluent interface - * - * @throws Zend_Gdata_App_Exception - */ - public function importFromString($string) - { - if ($string) { - error_clear_last(); - - $doc = new DOMDocument(); - $doc = @Zend_Xml_Security::scan($string, $doc); - - $err = error_get_last(); - $phpErrormsg = isset($err['message'][0]) ? $err['message'] : null; - if (!$doc) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $phpErrormsg"); - } - - // Ensure that the outermost node is an AppsForYourDomain error. - // If it isn't, something has gone horribly wrong. - $rootElement = $doc->getElementsByTagName($this->_rootElement)->item(0); - if (!$rootElement) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('No root <'.$this->_rootElement.'> element found, cannot parse feed.'); - } - - foreach ($rootElement->childNodes as $errorNode) { - if (!($errorNode instanceof DOMText)) { - $error = new Zend_Gdata_Gapps_Error(); - $error->transferFromDom($errorNode); - $this->addError($error); - } - } - - return $this; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null'); - } - } - - /** - * Get a human readable version of this exception. - * - * @return string - */ - public function __toString() - { - $result = 'The server encountered the following errors processing the request:'; - foreach ($this->_errors as $error) { - $result .= "\n".$error->__toString(); - } - - return $result; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/UserEntry.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/UserEntry.php deleted file mode 100644 index ddcca9666..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/UserEntry.php +++ /dev/null @@ -1,307 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Gapps_UserEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Gapps_UserEntry'; - - /** - * element containing information about this user's - * account, including their username and permissions. - * - * @var Zend_Gdata_Gapps_Extension_Login - */ - protected $_login; - - /** - * element containing the user's actual name. - * - * @var Zend_Gdata_Gapps_Extension_Name - */ - protected $_name; - - /** - * element describing any storage quotas in place for - * this user. - * - * @var Zend_Gdata_Gapps_Extension_Quota - */ - protected $_quota; - - /** - * element containing information about other feeds - * relevant to this entry. - * - * @var Zend_Gdata_Extension_FeedLink - */ - protected $_feedLink = []; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_login) { - $element->appendChild($this->_login->getDOM($element->ownerDocument)); - } - if (null !== $this->_name) { - $element->appendChild($this->_name->getDOM($element->ownerDocument)); - } - if (null !== $this->_quota) { - $element->appendChild($this->_quota->getDOM($element->ownerDocument)); - } - foreach ($this->_feedLink as $feedLink) { - $element->appendChild($feedLink->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('apps').':login': - $login = new Zend_Gdata_Gapps_Extension_Login(); - $login->transferFromDOM($child); - $this->_login = $login; - break; - case $this->lookupNamespace('apps').':name': - $name = new Zend_Gdata_Gapps_Extension_Name(); - $name->transferFromDOM($child); - $this->_name = $name; - break; - case $this->lookupNamespace('apps').':quota': - $quota = new Zend_Gdata_Gapps_Extension_Quota(); - $quota->transferFromDOM($child); - $this->_quota = $quota; - break; - case $this->lookupNamespace('gd').':feedLink': - $feedLink = new Zend_Gdata_Extension_FeedLink(); - $feedLink->transferFromDOM($child); - $this->_feedLink[] = $feedLink; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value of the login property for this object. - * - * @see setLogin - * - * @return Zend_Gdata_Gapps_Extension_Login the requested object - */ - public function getLogin() - { - return $this->_login; - } - - /** - * Set the value of the login property for this object. This property - * is used to store the username address of the current user. - * - * @param Zend_Gdata_Gapps_Extension_Login $value the desired value for - * this instance's login property - * - * @return Zend_Gdata_Gapps_UserEntry provides a fluent interface - */ - public function setLogin($value) - { - $this->_login = $value; - - return $this; - } - - /** - * Get the value of the name property for this object. - * - * @see setName - * - * @return Zend_Gdata_Gapps_Extension_Name the requested object - */ - public function getName() - { - return $this->_name; - } - - /** - * Set the value of the name property for this object. This property - * is used to store the full name of the current user. - * - * @param Zend_Gdata_Gapps_Extension_Name $value the desired value for - * this instance's name property - * - * @return Zend_Gdata_Gapps_UserEntry provides a fluent interface - */ - public function setName($value) - { - $this->_name = $value; - - return $this; - } - - /** - * Get the value of the quota property for this object. - * - * @see setQuota - * - * @return Zend_Gdata_Gapps_Extension_Quota the requested object - */ - public function getQuota() - { - return $this->_quota; - } - - /** - * Set the value of the quota property for this object. This property - * is used to store the amount of storage available for the current - * user. Quotas may not be modifiable depending on the domain used. - * - * @param Zend_Gdata_Gapps_Extension_Quota $value the desired value for - * this instance's quota property - * - * @return Zend_Gdata_Gapps_UserEntry provides a fluent interface - */ - public function setQuota($value) - { - $this->_quota = $value; - - return $this; - } - - /** - * Returns all feed links for this entry, or if a rel value is - * specified, the feed link associated with that value is returned. - * - * @param string $rel The rel value of the link to be found. If null, - * the array of links is returned instead. - * - * @return mixed either an array of Zend_Gdata_Extension_FeedLink - * objects if $rel is null, a single - * Zend_Gdata_Extension_FeedLink object if $rel is specified - * and a matching feed link is found, or null if $rel is - * specified and no matching feed link is found - */ - public function getFeedLink($rel = null) - { - if (null == $rel) { - return $this->_feedLink; - } else { - foreach ($this->_feedLink as $feedLink) { - if ($feedLink->rel == $rel) { - return $feedLink; - } - } - - return null; - } - } - - /** - * Set the value of the feed link property for this object. This property - * is used to provide links to alternative feeds relevant to this entry. - * - * @param array $value a collection of - * Zend_Gdata_Gapps_Extension_FeedLink objects - * - * @return Zend_Gdata_Gapps_UserEntry provides a fluent interface - */ - public function setFeedLink($value) - { - $this->_feedLink = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gapps/UserFeed.php b/packages/zend-gdata/library/Zend/Gdata/Gapps/UserFeed.php deleted file mode 100644 index e0e7f48d3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gapps/UserFeed.php +++ /dev/null @@ -1,50 +0,0 @@ -setUsername($username); - $this->setStartUsername($startUsername); - } - - /** - * Set the username to query for. When set, only users with a username - * matching this value will be returned in search results. Set to - * null to disable filtering by username. - * - * @see getUsername - * - * @param string $value the username to filter search results by, or null to - * disable - */ - public function setUsername($value) - { - $this->_username = $value; - } - - /** - * Get the username to query for. If no username is set, null will be - * returned. - */ - public function getUsername() - { - return $this->_username; - } - - /** - * Set the first username which should be displayed when retrieving - * a list of users. - * - * @param string $value the first username to be returned, or null to - * disable - */ - public function setStartUsername($value) - { - if (null !== $value) { - $this->_params['startUsername'] = $value; - } else { - unset($this->_params['startUsername']); - } - } - - /** - * Get the first username which should be displayed when retrieving - * a list of users. - * - * @see setStartUsername - * - * @return string the first username to be returned, or null if - * disabled - */ - public function getStartUsername() - { - if (array_key_exists('startUsername', $this->_params)) { - return $this->_params['startUsername']; - } else { - return null; - } - } - - /** - * Returns the query URL generated by this query instance. - * - * @return string the query URL for this instance - */ - public function getQueryUrl() - { - $uri = $this->getBaseUrl(); - $uri .= Zend_Gdata_Gapps::APPS_USER_PATH; - if (null !== $this->_username) { - $uri .= '/'.$this->_username; - } - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Gbase.php b/packages/zend-gdata/library/Zend/Gdata/Gbase.php deleted file mode 100644 index d2a87fce1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Gbase.php +++ /dev/null @@ -1,72 +0,0 @@ -registerPackage('Zend_Gdata_Geo'); - $this->registerPackage('Zend_Gdata_Geo_Extension'); - parent::__construct($client, $applicationId); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Geo/Entry.php b/packages/zend-gdata/library/Zend/Gdata/Geo/Entry.php deleted file mode 100644 index 38fde1745..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Geo/Entry.php +++ /dev/null @@ -1,95 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Geo::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_where) { - $element->appendChild($this->_where->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('georss').':where': - $where = new Zend_Gdata_Geo_Extension_GeoRssWhere(); - $where->transferFromDOM($child); - $this->_where = $where; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getWhere() - { - return $this->_where; - } - - public function setWhere($value) - { - $this->_where = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GeoRssWhere.php b/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GeoRssWhere.php deleted file mode 100644 index 26df09815..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GeoRssWhere.php +++ /dev/null @@ -1,136 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Geo::$namespaces); - parent::__construct(); - $this->setPoint($point); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_point) { - $element->appendChild($this->_point->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gml').':Point': - $point = new Zend_Gdata_Geo_Extension_GmlPoint(); - $point->transferFromDOM($child); - $this->_point = $point; - break; - } - } - - /** - * Get the value for this element's point attribute. - * - * @see setPoint - * - * @return Zend_Gdata_Geo_Extension_GmlPoint the requested attribute - */ - public function getPoint() - { - return $this->_point; - } - - /** - * Set the value for this element's point attribute. - * - * @param Zend_Gdata_Geo_Extension_GmlPoint $value the desired value for this attribute - * - * @return Zend_Gdata_Geo_Extension_GeoRssWhere Provides a fluent interface - */ - public function setPoint($value) - { - $this->_point = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GmlPoint.php b/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GmlPoint.php deleted file mode 100644 index 91cabd440..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GmlPoint.php +++ /dev/null @@ -1,136 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Geo::$namespaces); - parent::__construct(); - $this->setPos($pos); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_pos) { - $element->appendChild($this->_pos->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gml').':pos': - $pos = new Zend_Gdata_Geo_Extension_GmlPos(); - $pos->transferFromDOM($child); - $this->_pos = $pos; - break; - } - } - - /** - * Get the value for this element's pos attribute. - * - * @see setPos - * - * @return Zend_Gdata_Geo_Extension_GmlPos the requested attribute - */ - public function getPos() - { - return $this->_pos; - } - - /** - * Set the value for this element's distance attribute. - * - * @param Zend_Gdata_Geo_Extension_GmlPos $value The desired value for this attribute - * - * @return Zend_Gdata_Geo_Extension_GmlPoint Provides a fluent interface - */ - public function setPos($value) - { - $this->_pos = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GmlPos.php b/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GmlPos.php deleted file mode 100644 index 7076751fc..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Geo/Extension/GmlPos.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Geo::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Geo/Feed.php b/packages/zend-gdata/library/Zend/Gdata/Geo/Feed.php deleted file mode 100644 index 9fc923692..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Geo/Feed.php +++ /dev/null @@ -1,61 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Geo::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Health.php b/packages/zend-gdata/library/Zend/Gdata/Health.php deleted file mode 100644 index 4c1138935..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Health.php +++ /dev/null @@ -1,84 +0,0 @@ -config['proxy_host']) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('No proxy host set!'); - } - - // Make sure we're properly connected - if (!$this->socket) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); - } - - $host = $this->config['proxy_host']; - $port = $this->config['proxy_port']; - - if ($this->connected_to[0] != $host || $this->connected_to[1] != $port) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong proxy server'); - } - - // Add Proxy-Authorization header - if ($this->config['proxy_user'] && !isset($headers['proxy-authorization'])) { - $headers['proxy-authorization'] = Zend_Http_Client::encodeAuthHeader( - $this->config['proxy_user'], $this->config['proxy_pass'], $this->config['proxy_auth'] - ); - } - - // if we are proxying HTTPS, preform CONNECT handshake with the proxy - if ('https' == $uri->getScheme() && (!$this->negotiated)) { - $this->connectHandshake($uri->getHost(), $uri->getPort(), $http_ver, $headers); - $this->negotiated = true; - } - - // Save request method for later - $this->method = $method; - - // Build request headers - $request = "{$method} {$uri->__toString()} HTTP/{$http_ver}\r\n"; - - // Add all headers to the request string - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = "$k: $v"; - } - $request .= "$v\r\n"; - } - - $request .= "\r\n"; - - // Send the request headers - if (!@fwrite($this->socket, $request)) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Error writing request to proxy server'); - } - - // Read from $body, write to socket - $chunk = $body->read(self::CHUNK_SIZE); - while (false !== $chunk) { - if (!@fwrite($this->socket, $chunk)) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - $chunk = $body->read(self::CHUNK_SIZE); - } - $body->closeFileHandle(); - - return 'Large upload, request is not cached.'; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/HttpAdapterStreamingSocket.php b/packages/zend-gdata/library/Zend/Gdata/HttpAdapterStreamingSocket.php deleted file mode 100644 index ccefcb400..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/HttpAdapterStreamingSocket.php +++ /dev/null @@ -1,110 +0,0 @@ -socket) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); - } - - $host = $uri->getHost(); - $host = ('https' == strtolower((string) $uri->getScheme()) ? $this->config['ssltransport'] : 'tcp').'://'.$host; - if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); - } - - // Save request method for later - $this->method = $method; - - // Build request headers - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?'.$uri->getQuery(); - } - $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = ucfirst($k).": $v"; - } - $request .= "$v\r\n"; - } - - // Send the headers over - $request .= "\r\n"; - if (!@fwrite($this->socket, $request)) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - - // read from $body, write to socket - $chunk = $body->read(self::CHUNK_SIZE); - while (false !== $chunk) { - if (!@fwrite($this->socket, $chunk)) { - // require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - $chunk = $body->read(self::CHUNK_SIZE); - } - $body->closeFileHandle(); - - return 'Large upload, request is not cached.'; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/HttpClient.php b/packages/zend-gdata/library/Zend/Gdata/HttpClient.php deleted file mode 100644 index 936d1455c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/HttpClient.php +++ /dev/null @@ -1,375 +0,0 @@ -setAuthSubPrivateKey($key, $passphrase); - fclose($fp); - } - - /** - * Sets the PEM formatted private key to be used for secure AuthSub auth. - * - * In order to call this method, openssl must be enabled in your PHP - * installation. Otherwise, a Zend_Gdata_App_InvalidArgumentException - * will be thrown. - * - * @param string $key The private key - * @param string $passphrase The optional private key passphrase - * - * @return Zend_Gdata_HttpClient Provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function setAuthSubPrivateKey($key, $passphrase = null) - { - if (null != $key && !function_exists('openssl_pkey_get_private')) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('You cannot enable secure AuthSub if the openssl module is not enabled in your PHP installation.'); - } - $this->_authSubPrivateKeyId = openssl_pkey_get_private( - $key, $passphrase); - - return $this; - } - - /** - * Gets the openssl private key id. - * - * @return resource|null The private key - */ - public function getAuthSubPrivateKeyId() - { - return $this->_authSubPrivateKeyId; - } - - /** - * Gets the AuthSub token used for authentication. - * - * @return string The token - */ - public function getAuthSubToken() - { - return $this->_authSubToken; - } - - /** - * Sets the AuthSub token used for authentication. - * - * @param string $token The token - * - * @return Zend_Gdata_HttpClient Provides a fluent interface - */ - public function setAuthSubToken($token) - { - $this->_authSubToken = $token; - - return $this; - } - - /** - * Gets the ClientLogin token used for authentication. - * - * @return string The token - */ - public function getClientLoginToken() - { - return $this->_clientLoginToken; - } - - /** - * Sets the ClientLogin token used for authentication. - * - * @param string $token The token - * - * @return Zend_Gdata_HttpClient Provides a fluent interface - */ - public function setClientLoginToken($token) - { - $this->_clientLoginToken = $token; - - return $this; - } - - /** - * Filters the HTTP requests being sent to add the Authorization header. - * - * If both AuthSub and ClientLogin tokens are set, - * AuthSub takes precedence. If an AuthSub key is set, then - * secure AuthSub authentication is used, and the request is signed. - * Requests must be signed only with the private key corresponding to the - * public key registered with Google. If an AuthSub key is set, but - * openssl support is not enabled in the PHP installation, an exception is - * thrown. - * - * @param string $method The HTTP method - * @param string $url The URL - * @param array $headers An associate array of headers to be - * sent with the request or null - * @param string $body The body of the request or null - * @param string $contentType The MIME content type of the body or null - * - * @return array The processed values in an associative array, - * using the same names as the params - * - * @throws Zend_Gdata_App_Exception if there was a signing failure - */ - public function filterHttpRequest($method, $url, $headers = [], $body = null, $contentType = null) - { - if (null != $this->getAuthSubToken()) { - // AuthSub authentication - if (null != $this->getAuthSubPrivateKeyId()) { - // secure AuthSub - $time = time(); - $nonce = Zend_Crypt_Math::randInteger(0, 999999999); - $dataToSign = $method.' '.$url.' '.$time.' '.$nonce; - - // compute signature - $pKeyId = $this->getAuthSubPrivateKeyId(); - $signSuccess = openssl_sign($dataToSign, $signature, $pKeyId, - OPENSSL_ALGO_SHA1); - if (!$signSuccess) { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('openssl_signing failure - returned false'); - } - // encode signature - $encodedSignature = base64_encode($signature); - - // final header - $headers['authorization'] = 'AuthSub token="'.$this->getAuthSubToken().'" '. - 'data="'.$dataToSign.'" '. - 'sig="'.$encodedSignature.'" '. - 'sigalg="rsa-sha1"'; - } else { - // AuthSub without secure tokens - $headers['authorization'] = 'AuthSub token="'.$this->getAuthSubToken().'"'; - } - } elseif (null != $this->getClientLoginToken()) { - $headers['authorization'] = 'GoogleLogin auth='.$this->getClientLoginToken(); - } - - return ['method' => $method, 'url' => $url, 'body' => $body, 'headers' => $headers, 'contentType' => $contentType]; - } - - /** - * Method for filtering the HTTP response, though no filtering is - * currently done. - * - * @param Zend_Http_Response $response The response object to filter - * - * @return Zend_Http_Response The filterd response object - */ - public function filterHttpResponse($response) - { - return $response; - } - - /** - * Return the current connection adapter. - * - * @return Zend_Http_Client_Adapter_Interface|null $adapter - */ - public function getAdapter() - { - return $this->adapter; - } - - /** - * Load the connection adapter. - * - * @param Zend_Http_Client_Adapter_Interface $adapter - * - * @return void - */ - public function setAdapter($adapter) - { - if (null == $adapter) { - $this->adapter = $adapter; - } else { - parent::setAdapter($adapter); - } - } - - /** - * Set the streamingRequest variable which controls whether we are - * sending the raw (already encoded) POST data from a stream source. - * - * @param bool $value the value to set - * - * @return void - */ - public function setStreamingRequest($value) - { - $this->_streamingRequest = $value; - } - - /** - * Check whether the client is set to perform streaming requests. - * - * @return bool true if yes, false otherwise - */ - public function getStreamingRequest() - { - if ($this->_streamingRequest()) { - return true; - } else { - return false; - } - } - - /** - * Prepare the request body (for POST and PUT requests). - * - * @return string - * - * @throws Zend_Http_Client_Exception - */ - protected function _prepareBody() - { - if ($this->_streamingRequest) { - $this->setHeaders(self::CONTENT_LENGTH, - $this->raw_post_data->getTotalSize()); - - return $this->raw_post_data; - } else { - return parent::_prepareBody(); - } - } - - /** - * Clear all custom parameters we set. - * - * @return Zend_Http_Client - */ - public function resetParameters($clearAll = false) - { - $this->_streamingRequest = false; - - return parent::resetParameters($clearAll); - } - - /** - * Set the raw (already encoded) POST data from a stream source. - * - * This is used to support POSTing from open file handles without - * caching the entire body into memory. It is a wrapper around - * Zend_Http_Client::setRawData(). - * - * @param string $data The request data - * @param string $enctype The encoding type - * - * @return Zend_Http_Client - */ - public function setRawDataStream($data, $enctype = null) - { - $this->_streamingRequest = true; - - return $this->setRawData($data, $enctype); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Kind/EventEntry.php b/packages/zend-gdata/library/Zend/Gdata/Kind/EventEntry.php deleted file mode 100644 index b6c9acc60..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Kind/EventEntry.php +++ /dev/null @@ -1,448 +0,0 @@ -_who) { - foreach ($this->_who as $who) { - $element->appendChild($who->getDOM($element->ownerDocument)); - } - } - if (null != $this->_when) { - foreach ($this->_when as $when) { - $element->appendChild($when->getDOM($element->ownerDocument)); - } - } - if (null != $this->_where) { - foreach ($this->_where as $where) { - $element->appendChild($where->getDOM($element->ownerDocument)); - } - } - if (null != $this->_recurrenceException) { - foreach ($this->_recurrenceException as $recurrenceException) { - $element->appendChild($recurrenceException->getDOM($element->ownerDocument)); - } - } - if (null != $this->_extendedProperty) { - foreach ($this->_extendedProperty as $extProp) { - $element->appendChild($extProp->getDOM($element->ownerDocument)); - } - } - - if (null != $this->_recurrence) { - $element->appendChild($this->_recurrence->getDOM($element->ownerDocument)); - } - if (null != $this->_eventStatus) { - $element->appendChild($this->_eventStatus->getDOM($element->ownerDocument)); - } - if (null != $this->_comments) { - $element->appendChild($this->_comments->getDOM($element->ownerDocument)); - } - if (null != $this->_transparency) { - $element->appendChild($this->_transparency->getDOM($element->ownerDocument)); - } - if (null != $this->_visibility) { - $element->appendChild($this->_visibility->getDOM($element->ownerDocument)); - } - if (null != $this->_originalEvent) { - $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument)); - } - if (null != $this->_entryLink) { - $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gd').':where': - $where = new Zend_Gdata_Extension_Where(); - $where->transferFromDOM($child); - $this->_where[] = $where; - break; - case $this->lookupNamespace('gd').':when': - $when = new Zend_Gdata_Extension_When(); - $when->transferFromDOM($child); - $this->_when[] = $when; - break; - case $this->lookupNamespace('gd').':who': - $who = new Zend_Gdata_Extension_Who(); - $who->transferFromDOM($child); - $this->_who[] = $who; - break; - case $this->lookupNamespace('gd').':recurrence': - $recurrence = new Zend_Gdata_Extension_Recurrence(); - $recurrence->transferFromDOM($child); - $this->_recurrence = $recurrence; - break; - case $this->lookupNamespace('gd').':eventStatus': - $eventStatus = new Zend_Gdata_Extension_EventStatus(); - $eventStatus->transferFromDOM($child); - $this->_eventStatus = $eventStatus; - break; - case $this->lookupNamespace('gd').':comments': - $comments = new Zend_Gdata_Extension_Comments(); - $comments->transferFromDOM($child); - $this->_comments = $comments; - break; - case $this->lookupNamespace('gd').':transparency': - $transparency = new Zend_Gdata_Extension_Transparency(); - $transparency->transferFromDOM($child); - $this->_transparency = $transparency; - break; - case $this->lookupNamespace('gd').':visibility': - $visiblity = new Zend_Gdata_Extension_Visibility(); - $visiblity->transferFromDOM($child); - $this->_visibility = $visiblity; - break; - case $this->lookupNamespace('gd').':recurrenceException': - // require_once 'Zend/Gdata/Extension/RecurrenceException.php'; - $recurrenceException = new Zend_Gdata_Extension_RecurrenceException(); - $recurrenceException->transferFromDOM($child); - $this->_recurrenceException[] = $recurrenceException; - break; - case $this->lookupNamespace('gd').':originalEvent': - $originalEvent = new Zend_Gdata_Extension_OriginalEvent(); - $originalEvent->transferFromDOM($child); - $this->_originalEvent = $originalEvent; - break; - case $this->lookupNamespace('gd').':extendedProperty': - $extProp = new Zend_Gdata_Extension_ExtendedProperty(); - $extProp->transferFromDOM($child); - $this->_extendedProperty[] = $extProp; - break; - case $this->lookupNamespace('gd').':entryLink': - $entryLink = new Zend_Gdata_Extension_EntryLink(); - $entryLink->transferFromDOM($child); - $this->_entryLink = $entryLink; - break; - - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getWhen() - { - return $this->_when; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setWhen($value) - { - $this->_when = $value; - - return $this; - } - - public function getWhere() - { - return $this->_where; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setWhere($value) - { - $this->_where = $value; - - return $this; - } - - public function getWho() - { - return $this->_who; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setWho($value) - { - $this->_who = $value; - - return $this; - } - - public function getRecurrence() - { - return $this->_recurrence; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setRecurrence($value) - { - $this->_recurrence = $value; - - return $this; - } - - public function getEventStatus() - { - return $this->_eventStatus; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setEventStatus($value) - { - $this->_eventStatus = $value; - - return $this; - } - - public function getComments() - { - return $this->_comments; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setComments($value) - { - $this->_comments = $value; - - return $this; - } - - public function getTransparency() - { - return $this->_transparency; - } - - /** - * @param Zend_Gdata_Transparency $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setTransparency($value) - { - $this->_transparency = $value; - - return $this; - } - - public function getVisibility() - { - return $this->_visibility; - } - - /** - * @param Zend_Gdata_Visibility $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setVisibility($value) - { - $this->_visibility = $value; - - return $this; - } - - public function getRecurrenceExcption() - { - return $this->_recurrenceException; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setRecurrenceException($value) - { - $this->_recurrenceException = $value; - - return $this; - } - - public function getExtendedProperty() - { - return $this->_extendedProperty; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setExtendedProperty($value) - { - $this->_extendedProperty = $value; - - return $this; - } - - public function getOriginalEvent() - { - return $this->_originalEvent; - } - - /** - * @param Zend_Gdata_Extension_OriginalEvent $value - * - * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface - */ - public function setOriginalEvent($value) - { - $this->_originalEvent = $value; - - return $this; - } - - /** - * Get this entry's EntryLink element. - * - * @return Zend_Gdata_Extension_EntryLink|null the requested entry - */ - public function getEntryLink() - { - return $this->_entryLink; - } - - /** - * Set the child's EntryLink element. - * - * @param Zend_Gdata_Extension_EntryLink $value the desired value for this attribute - * - * @return Zend_Gdata_Kind_EventEntry the element being modified - */ - public function setEntryLink($value) - { - $this->_entryLink = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media.php b/packages/zend-gdata/library/Zend/Gdata/Media.php deleted file mode 100644 index 9075d53b7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media.php +++ /dev/null @@ -1,63 +0,0 @@ -registerPackage('Zend_Gdata_Media'); - $this->registerPackage('Zend_Gdata_Media_Extension'); - parent::__construct($client, $applicationId); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Entry.php b/packages/zend-gdata/library/Zend/Gdata/Media/Entry.php deleted file mode 100644 index b20eaab0b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Entry.php +++ /dev/null @@ -1,134 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_mediaGroup) { - $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('media').':group': - $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); - $mediaGroup->transferFromDOM($child); - $this->_mediaGroup = $mediaGroup; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Returns the entry's mediaGroup object. - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function getMediaGroup() - { - return $this->_mediaGroup; - } - - /** - * Sets the entry's mediaGroup object. - * - * @param Zend_Gdata_Media_Extension_MediaGroup $mediaGroup - * - * @return Zend_Gdata_Media_Entry Provides a fluent interface - */ - public function setMediaGroup($mediaGroup) - { - $this->_mediaGroup = $mediaGroup; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCategory.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCategory.php deleted file mode 100644 index ed081ce37..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCategory.php +++ /dev/null @@ -1,151 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_scheme = $scheme; - $this->_label = $label; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_scheme) { - $element->setAttribute('scheme', $this->_scheme); - } - if (null !== $this->_label) { - $element->setAttribute('label', $this->_label); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'scheme': - $this->_scheme = $attribute->nodeValue; - break; - case 'label': - $this->_label = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Returns the URI that identifies the categorization scheme - * Optional. - * - * @return string URI that identifies the categorization scheme - */ - public function getScheme() - { - return $this->_scheme; - } - - /** - * @param string $value URI that identifies the categorization scheme - * - * @return Zend_Gdata_Media_Extension_MediaCategory Provides a fluent interface - */ - public function setScheme($value) - { - $this->_scheme = $value; - - return $this; - } - - /** - * @return string Human-readable label to be displayed in applications - */ - public function getLabel() - { - return $this->_label; - } - - /** - * @param string $value Human-readable label to be displayed in applications - * - * @return Zend_Gdata_Media_Extension_MediaCategory Provides a fluent interface - */ - public function setLabel($value) - { - $this->_label = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaContent.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaContent.php deleted file mode 100644 index ab52cca5c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaContent.php +++ /dev/null @@ -1,548 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_url = $url; - $this->_fileSize = $fileSize; - $this->_type = $type; - $this->_medium = $medium; - $this->_isDefault = $isDefault; - $this->_expression = $expression; - $this->_bitrate = $bitrate; - $this->_framerate = $framerate; - $this->_samplingrate = $samplingrate; - $this->_channels = $channels; - $this->_duration = $duration; - $this->_height = $height; - $this->_width = $width; - $this->_lang = $lang; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_url) { - $element->setAttribute('url', $this->_url); - } - if (null !== $this->_fileSize) { - $element->setAttribute('fileSize', $this->_fileSize); - } - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - if (null !== $this->_medium) { - $element->setAttribute('medium', $this->_medium); - } - if (null !== $this->_isDefault) { - $element->setAttribute('isDefault', $this->_isDefault); - } - if (null !== $this->_expression) { - $element->setAttribute('expression', $this->_expression); - } - if (null !== $this->_bitrate) { - $element->setAttribute('bitrate', $this->_bitrate); - } - if (null !== $this->_framerate) { - $element->setAttribute('framerate', $this->_framerate); - } - if (null !== $this->_samplingrate) { - $element->setAttribute('samplingrate', $this->_samplingrate); - } - if (null !== $this->_channels) { - $element->setAttribute('channels', $this->_channels); - } - if (null !== $this->_duration) { - $element->setAttribute('duration', $this->_duration); - } - if (null !== $this->_height) { - $element->setAttribute('height', $this->_height); - } - if (null !== $this->_width) { - $element->setAttribute('width', $this->_width); - } - if (null !== $this->_lang) { - $element->setAttribute('lang', $this->_lang); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'url': - $this->_url = $attribute->nodeValue; - break; - case 'fileSize': - $this->_fileSize = $attribute->nodeValue; - break; - case 'type': - $this->_type = $attribute->nodeValue; - break; - case 'medium': - $this->_medium = $attribute->nodeValue; - break; - case 'isDefault': - $this->_isDefault = $attribute->nodeValue; - break; - case 'expression': - $this->_expression = $attribute->nodeValue; - break; - case 'bitrate': - $this->_bitrate = $attribute->nodeValue; - break; - case 'framerate': - $this->_framerate = $attribute->nodeValue; - break; - case 'samplingrate': - $this->_samplingrate = $attribute->nodeValue; - break; - case 'channels': - $this->_channels = $attribute->nodeValue; - break; - case 'duration': - $this->_duration = $attribute->nodeValue; - break; - case 'height': - $this->_height = $attribute->nodeValue; - break; - case 'width': - $this->_width = $attribute->nodeValue; - break; - case 'lang': - $this->_lang = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Returns the URL representing this MediaContent object. - * - * @return string the URL representing this MediaContent object - */ - public function __toString() - { - return $this->getUrl(); - } - - /** - * @return string The direct URL to the media object - */ - public function getUrl() - { - return $this->_url; - } - - /** - * @param string $value The direct URL to the media object - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setUrl($value) - { - $this->_url = $value; - - return $this; - } - - /** - * @return int The size of the media in bytes - */ - public function getFileSize() - { - return $this->_fileSize; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setFileSize($value) - { - $this->_fileSize = $value; - - return $this; - } - - /** - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } - - /** - * @return string - */ - public function getMedium() - { - return $this->_medium; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setMedium($value) - { - $this->_medium = $value; - - return $this; - } - - /** - * @return bool - */ - public function getIsDefault() - { - return $this->_isDefault; - } - - /** - * @param bool $value - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setIsDefault($value) - { - $this->_isDefault = $value; - - return $this; - } - - /** - * @return string - */ - public function getExpression() - { - return $this->_expression; - } - - /** - * @param string - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setExpression($value) - { - $this->_expression = $value; - - return $this; - } - - /** - * @return int - */ - public function getBitrate() - { - return $this->_bitrate; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setBitrate($value) - { - $this->_bitrate = $value; - - return $this; - } - - /** - * @return int - */ - public function getFramerate() - { - return $this->_framerate; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setFramerate($value) - { - $this->_framerate = $value; - - return $this; - } - - /** - * @return int - */ - public function getSamplingrate() - { - return $this->_samplingrate; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setSamplingrate($value) - { - $this->_samplingrate = $value; - - return $this; - } - - /** - * @return int - */ - public function getChannels() - { - return $this->_channels; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setChannels($value) - { - $this->_channels = $value; - - return $this; - } - - /** - * @return int - */ - public function getDuration() - { - return $this->_duration; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setDuration($value) - { - $this->_duration = $value; - - return $this; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->_height; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setHeight($value) - { - $this->_height = $value; - - return $this; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->_width; - } - - /** - * @param int - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setWidth($value) - { - $this->_width = $value; - - return $this; - } - - /** - * @return string - */ - public function getLang() - { - return $this->_lang; - } - - /** - * @param string - * - * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface - */ - public function setLang($value) - { - $this->_lang = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCopyright.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCopyright.php deleted file mode 100644 index a856d8476..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCopyright.php +++ /dev/null @@ -1,117 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_url = $url; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_url) { - $element->setAttribute('url', $this->_url); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'url': - $this->_url = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getUrl() - { - return $this->_url; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaCopyright Provides a fluent interface - */ - public function setUrl($value) - { - $this->_url = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCredit.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCredit.php deleted file mode 100644 index b3e8128f7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaCredit.php +++ /dev/null @@ -1,152 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_role = $role; - $this->_scheme = $scheme; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_role) { - $element->setAttribute('role', $this->_role); - } - if (null !== $this->_scheme) { - $element->setAttribute('scheme', $this->_scheme); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'role': - $this->_role = $attribute->nodeValue; - break; - case 'scheme': - $this->_scheme = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getRole() - { - return $this->_role; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent interface - */ - public function setRole($value) - { - $this->_role = $value; - - return $this; - } - - /** - * @return string - */ - public function getScheme() - { - return $this->_scheme; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent interface - */ - public function setScheme($value) - { - $this->_scheme = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaDescription.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaDescription.php deleted file mode 100644 index e1a48c317..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaDescription.php +++ /dev/null @@ -1,117 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_type = $type; - $this->_text = $text; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'type': - $this->_type = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaDescription Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaGroup.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaGroup.php deleted file mode 100644 index a7f57f37b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaGroup.php +++ /dev/null @@ -1,590 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - foreach ($this->_content as $content) { - $element->appendChild($content->getDOM($element->ownerDocument)); - } - foreach ($this->_category as $category) { - $element->appendChild($category->getDOM($element->ownerDocument)); - } - foreach ($this->_credit as $credit) { - $element->appendChild($credit->getDOM($element->ownerDocument)); - } - foreach ($this->_player as $player) { - $element->appendChild($player->getDOM($element->ownerDocument)); - } - foreach ($this->_rating as $rating) { - $element->appendChild($rating->getDOM($element->ownerDocument)); - } - foreach ($this->_restriction as $restriction) { - $element->appendChild($restriction->getDOM($element->ownerDocument)); - } - foreach ($this->_mediaText as $text) { - $element->appendChild($text->getDOM($element->ownerDocument)); - } - foreach ($this->_thumbnail as $thumbnail) { - $element->appendChild($thumbnail->getDOM($element->ownerDocument)); - } - if (null != $this->_copyright) { - $element->appendChild( - $this->_copyright->getDOM($element->ownerDocument)); - } - if (null != $this->_description) { - $element->appendChild( - $this->_description->getDOM($element->ownerDocument)); - } - foreach ($this->_hash as $hash) { - $element->appendChild($hash->getDOM($element->ownerDocument)); - } - if (null != $this->_keywords) { - $element->appendChild( - $this->_keywords->getDOM($element->ownerDocument)); - } - if (null != $this->_title) { - $element->appendChild( - $this->_title->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('media').':content': - $content = new Zend_Gdata_Media_Extension_MediaContent(); - $content->transferFromDOM($child); - $this->_content[] = $content; - break; - case $this->lookupNamespace('media').':category': - $category = new Zend_Gdata_Media_Extension_MediaCategory(); - $category->transferFromDOM($child); - $this->_category[] = $category; - break; - case $this->lookupNamespace('media').':copyright': - $copyright = new Zend_Gdata_Media_Extension_MediaCopyright(); - $copyright->transferFromDOM($child); - $this->_copyright = $copyright; - break; - case $this->lookupNamespace('media').':credit': - $credit = new Zend_Gdata_Media_Extension_MediaCredit(); - $credit->transferFromDOM($child); - $this->_credit[] = $credit; - break; - case $this->lookupNamespace('media').':description': - $description = new Zend_Gdata_Media_Extension_MediaDescription(); - $description->transferFromDOM($child); - $this->_description = $description; - break; - case $this->lookupNamespace('media').':hash': - $hash = new Zend_Gdata_Media_Extension_MediaHash(); - $hash->transferFromDOM($child); - $this->_hash[] = $hash; - break; - case $this->lookupNamespace('media').':keywords': - $keywords = new Zend_Gdata_Media_Extension_MediaKeywords(); - $keywords->transferFromDOM($child); - $this->_keywords = $keywords; - break; - case $this->lookupNamespace('media').':player': - $player = new Zend_Gdata_Media_Extension_MediaPlayer(); - $player->transferFromDOM($child); - $this->_player[] = $player; - break; - case $this->lookupNamespace('media').':rating': - $rating = new Zend_Gdata_Media_Extension_MediaRating(); - $rating->transferFromDOM($child); - $this->_rating[] = $rating; - break; - case $this->lookupNamespace('media').':restriction': - $restriction = new Zend_Gdata_Media_Extension_MediaRestriction(); - $restriction->transferFromDOM($child); - $this->_restriction[] = $restriction; - break; - case $this->lookupNamespace('media').':text': - $text = new Zend_Gdata_Media_Extension_MediaText(); - $text->transferFromDOM($child); - $this->_mediaText[] = $text; - break; - case $this->lookupNamespace('media').':thumbnail': - $thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail(); - $thumbnail->transferFromDOM($child); - $this->_thumbnail[] = $thumbnail; - break; - case $this->lookupNamespace('media').':title': - $title = new Zend_Gdata_Media_Extension_MediaTitle(); - $title->transferFromDOM($child); - $this->_title = $title; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * @return array - */ - public function getContent() - { - return $this->_content; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup Provides a fluent interface - */ - public function setContent($value) - { - $this->_content = $value; - - return $this; - } - - /** - * @return array - */ - public function getCategory() - { - return $this->_category; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setCategory($value) - { - $this->_category = $value; - - return $this; - } - - /** - * @return Zend_Gdata_Media_Extension_MediaCopyright - */ - public function getCopyright() - { - return $this->_copyright; - } - - /** - * @param Zend_Gdata_Media_Extension_MediaCopyright $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setCopyright($value) - { - $this->_copyright = $value; - - return $this; - } - - /** - * @return array - */ - public function getCredit() - { - return $this->_credit; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setCredit($value) - { - $this->_credit = $value; - - return $this; - } - - /** - * @return string|null - */ - public function getTitle() - { - return $this->_title; - } - - /** - * @param Zend_Gdata_Media_Extension_MediaTitle $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setTitle($value) - { - $this->_title = $value; - - return $this; - } - - /** - * @return Zend_Gdata_Media_Extension_MediaDescription - */ - public function getDescription() - { - return $this->_description; - } - - /** - * @param Zend_Gdata_Media_Extension_MediaDescription $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setDescription($value) - { - $this->_description = $value; - - return $this; - } - - /** - * @return array - */ - public function getHash() - { - return $this->_hash; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setHash($value) - { - $this->_hash = $value; - - return $this; - } - - /** - * @return Zend_Gdata_Media_Extension_MediaKeywords - */ - public function getKeywords() - { - return $this->_keywords; - } - - /** - * @param array $value - * - * @return Zend_Gdata_Media_Extension_MediaGroup Provides a fluent interface - */ - public function setKeywords($value) - { - $this->_keywords = $value; - - return $this; - } - - /** - * @return array - */ - public function getPlayer() - { - return $this->_player; - } - - /** - * @param array - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setPlayer($value) - { - $this->_player = $value; - - return $this; - } - - /** - * @return array - */ - public function getRating() - { - return $this->_rating; - } - - /** - * @param array - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setRating($value) - { - $this->_rating = $value; - - return $this; - } - - /** - * @return array - */ - public function getRestriction() - { - return $this->_restriction; - } - - /** - * @param array - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setRestriction($value) - { - $this->_restriction = $value; - - return $this; - } - - /** - * @return array - */ - public function getThumbnail() - { - return $this->_thumbnail; - } - - /** - * @param array - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setThumbnail($value) - { - $this->_thumbnail = $value; - - return $this; - } - - /** - * @return array - */ - public function getMediaText() - { - return $this->_mediaText; - } - - /** - * @param array - * - * @return Zend_Gdata_Media_Extension_MediaGroup - */ - public function setMediaText($value) - { - $this->_mediaText = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaHash.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaHash.php deleted file mode 100644 index 9b016dc74..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaHash.php +++ /dev/null @@ -1,117 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_algo = $algo; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_algo) { - $element->setAttribute('algo', $this->_algo); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'algo': - $this->_algo = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string The algo - */ - public function getAlgo() - { - return $this->_algo; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaHash Provides a fluent interface - */ - public function setAlgo($value) - { - $this->_algo = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaKeywords.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaKeywords.php deleted file mode 100644 index 8efe2b60c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaKeywords.php +++ /dev/null @@ -1,50 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaPlayer.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaPlayer.php deleted file mode 100644 index 8c4dfddd3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaPlayer.php +++ /dev/null @@ -1,183 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_url = $url; - $this->_width = $width; - $this->_height = $height; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_url) { - $element->setAttribute('url', $this->_url); - } - if (null !== $this->_width) { - $element->setAttribute('width', $this->_width); - } - if (null !== $this->_height) { - $element->setAttribute('height', $this->_height); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'url': - $this->_url = $attribute->nodeValue; - break; - case 'width': - $this->_width = $attribute->nodeValue; - break; - case 'height': - $this->_height = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getUrl() - { - return $this->_url; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface - */ - public function setUrl($value) - { - $this->_url = $value; - - return $this; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->_width; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface - */ - public function setWidth($value) - { - $this->_width = $value; - - return $this; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->_height; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface - */ - public function setHeight($value) - { - $this->_height = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaRating.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaRating.php deleted file mode 100644 index 9117142b0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaRating.php +++ /dev/null @@ -1,119 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_scheme = $scheme; - $this->_text = $text; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_scheme) { - $element->setAttribute('scheme', $this->_scheme); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'scheme': - $this->_scheme = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getScheme() - { - return $this->_scheme; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaRating Provides a fluent interface - */ - public function setScheme($value) - { - $this->_scheme = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaRestriction.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaRestriction.php deleted file mode 100644 index 560d17890..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaRestriction.php +++ /dev/null @@ -1,152 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_relationship = $relationship; - $this->_type = $type; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_relationship) { - $element->setAttribute('relationship', $this->_relationship); - } - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'relationship': - $this->_relationship = $attribute->nodeValue; - break; - case 'type': - $this->_type = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getRelationship() - { - return $this->_relationship; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaRestriction Provides a fluent interface - */ - public function setRelationship($value) - { - $this->_relationship = $value; - - return $this; - } - - /** - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaRestriction Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaText.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaText.php deleted file mode 100644 index 44b43198a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaText.php +++ /dev/null @@ -1,219 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_type = $type; - $this->_lang = $lang; - $this->_start = $start; - $this->_end = $end; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - if (null !== $this->_lang) { - $element->setAttribute('lang', $this->_lang); - } - if (null !== $this->_start) { - $element->setAttribute('start', $this->_start); - } - if (null !== $this->_end) { - $element->setAttribute('end', $this->_end); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'type': - $this->_type = $attribute->nodeValue; - break; - case 'lang': - $this->_lang = $attribute->nodeValue; - break; - case 'start': - $this->_start = $attribute->nodeValue; - break; - case 'end': - $this->_end = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } - - /** - * @return string - */ - public function getLang() - { - return $this->_lang; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface - */ - public function setLang($value) - { - $this->_lang = $value; - - return $this; - } - - /** - * @return string - */ - public function getStart() - { - return $this->_start; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface - */ - public function setStart($value) - { - $this->_start = $value; - - return $this; - } - - /** - * @return string - */ - public function getEnd() - { - return $this->_end; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface - */ - public function setEnd($value) - { - $this->_end = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaThumbnail.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaThumbnail.php deleted file mode 100644 index 34fd70bd9..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaThumbnail.php +++ /dev/null @@ -1,217 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_url = $url; - $this->_width = $width; - $this->_height = $height; - $this->_time = $time; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_url) { - $element->setAttribute('url', $this->_url); - } - if (null !== $this->_width) { - $element->setAttribute('width', $this->_width); - } - if (null !== $this->_height) { - $element->setAttribute('height', $this->_height); - } - if (null !== $this->_time) { - $element->setAttribute('time', $this->_time); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'url': - $this->_url = $attribute->nodeValue; - break; - case 'width': - $this->_width = $attribute->nodeValue; - break; - case 'height': - $this->_height = $attribute->nodeValue; - break; - case 'time': - $this->_time = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getUrl() - { - return $this->_url; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface - */ - public function setUrl($value) - { - $this->_url = $value; - - return $this; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->_width; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface - */ - public function setWidth($value) - { - $this->_width = $value; - - return $this; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->_height; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface - */ - public function setHeight($value) - { - $this->_height = $value; - - return $this; - } - - /** - * @return string - */ - public function getTime() - { - return $this->_time; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface - */ - public function setTime($value) - { - $this->_time = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaTitle.php b/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaTitle.php deleted file mode 100644 index 924fdb72c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Extension/MediaTitle.php +++ /dev/null @@ -1,119 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct(); - $this->_type = $type; - $this->_text = $text; - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_type) { - $element->setAttribute('type', $this->_type); - } - - return $element; - } - - /** - * Given a DOMNode representing an attribute, tries to map the data into - * instance members. If no mapping is defined, the name and value are - * stored in an array. - * - * @param DOMNode $attribute The DOMNode attribute needed to be handled - */ - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'type': - $this->_type = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Media_Extension_MediaTitle Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Media/Feed.php b/packages/zend-gdata/library/Zend/Gdata/Media/Feed.php deleted file mode 100644 index 838c54a84..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Media/Feed.php +++ /dev/null @@ -1,67 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Media::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/MediaMimeStream.php b/packages/zend-gdata/library/Zend/Gdata/MediaMimeStream.php deleted file mode 100644 index d4a77ffd0..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/MediaMimeStream.php +++ /dev/null @@ -1,187 +0,0 @@ - 1. - */ - public function __construct($xmlString = null, $filePath = null, - $fileContentType = null) - { - if (!file_exists((string) $filePath) || !is_readable($filePath)) { - // require_once 'Zend/Gdata/App/IOException.php'; - throw new Zend_Gdata_App_IOException('File to be uploaded at '.$filePath.' does not exist or is not readable.'); - } - - $this->_fileHandle = fopen($filePath, 'rb', true); - $this->_boundaryString = '=_'.md5((string) microtime(1).rand(1, 20)); - $entry = $this->wrapEntry($xmlString, $fileContentType); - $closingBoundary = new Zend_Gdata_MimeBodyString("\r\n--{$this->_boundaryString}--\r\n"); - $file = new Zend_Gdata_MimeFile($this->_fileHandle); - $this->_parts = [$entry, $file, $closingBoundary]; - - $fileSize = filesize($filePath); - $this->_totalSize = $entry->getSize() + $fileSize - + $closingBoundary->getSize(); - } - - /** - * Sandwiches the entry body into a MIME message. - * - * @return Zend_Gdata_MimeBodyString - */ - private function wrapEntry($entry, $fileMimeType) - { - $wrappedEntry = "--{$this->_boundaryString}\r\n"; - $wrappedEntry .= "Content-Type: application/atom+xml\r\n\r\n"; - $wrappedEntry .= $entry; - $wrappedEntry .= "\r\n--{$this->_boundaryString}\r\n"; - $wrappedEntry .= "Content-Type: $fileMimeType\r\n\r\n"; - - return new Zend_Gdata_MimeBodyString($wrappedEntry); - } - - /** - * Read a specific chunk of the the MIME multipart message. - * - * @return string A corresponding piece of the message. This could be - * binary or regular text. - */ - public function read($bytesRequested) - { - if ($this->_currentPart >= count($this->_parts)) { - return false; - } - - $activePart = $this->_parts[$this->_currentPart]; - $buffer = $activePart->read($bytesRequested); - - while (strlen((string) $buffer) < $bytesRequested) { - ++$this->_currentPart; - $nextBuffer = $this->read($bytesRequested - strlen((string) $buffer)); - if (false === $nextBuffer) { - break; - } - $buffer .= $nextBuffer; - } - - return $buffer; - } - - /** - * Return the total size of the mime message. - * - * @return int total size of the message to be sent - */ - public function getTotalSize() - { - return $this->_totalSize; - } - - /** - * Close the internal file that we are streaming to the socket. - * - * @return void - */ - public function closeFileHandle() - { - if (null !== $this->_fileHandle) { - fclose($this->_fileHandle); - } - } - - /** - * Return a Content-type header that includes the current boundary string. - * - * @return string a valid HTTP Content-Type header - */ - public function getContentType() - { - return 'multipart/related;boundary="'. - $this->_boundaryString.'"'."\r\n"; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/MimeBodyString.php b/packages/zend-gdata/library/Zend/Gdata/MimeBodyString.php deleted file mode 100644 index ceda03ba7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/MimeBodyString.php +++ /dev/null @@ -1,90 +0,0 @@ -_sourceString = $sourceString; - $this->_bytesRead = 0; - } - - /** - * Read the next chunk of the string. - * - * @param int $bytesRequested the size of the chunk that is to be read - * - * @return string a corresponding piece of the string - */ - public function read($bytesRequested) - { - $len = strlen((string) $this->_sourceString); - if ($this->_bytesRead == $len) { - return false; - } elseif ($bytesRequested > $len - $this->_bytesRead) { - $bytesRequested = $len - $this->_bytesRead; - } - - $buffer = substr((string) $this->_sourceString, $this->_bytesRead, $bytesRequested); - $this->_bytesRead += $bytesRequested; - - return $buffer; - } - - /** - * The length of the string. - * - * @return int the length of the string contained in the object - */ - public function getSize() - { - return strlen((string) $this->_sourceString); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/MimeFile.php b/packages/zend-gdata/library/Zend/Gdata/MimeFile.php deleted file mode 100644 index 8122b82a1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/MimeFile.php +++ /dev/null @@ -1,64 +0,0 @@ -_fileHandle = $fileHandle; - } - - /** - * Read the next chunk of the file. - * - * @param int $bytesRequested the size of the chunk that is to be read - * - * @return string A corresponding piece of the message. This could be - * binary or regular text. - */ - public function read($bytesRequested) - { - return fread($this->_fileHandle, $bytesRequested); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos.php b/packages/zend-gdata/library/Zend/Gdata/Photos.php deleted file mode 100644 index ea1c245e1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos.php +++ /dev/null @@ -1,595 +0,0 @@ -registerPackage('Zend_Gdata_Photos'); - $this->registerPackage('Zend_Gdata_Photos_Extension'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - } - - /** - * Retrieve a UserFeed containing AlbumEntries, PhotoEntries and - * TagEntries associated with a given user. - * - * @param string $userName The userName of interest - * @param mixed $location (optional) The location for the feed, as a URL - * or Query. If not provided, a default URL will be used instead. - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getUserFeed($userName = null, $location = null) - { - if ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('feed'); - if (null !== $userName) { - $location->setUser($userName); - } - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - if (null !== $userName) { - $location->setUser($userName); - } - $uri = $location->getQueryUrl(); - } elseif (null !== $location) { - $uri = $location; - } elseif (null !== $userName) { - $uri = self::PICASA_BASE_FEED_URI.'/'. - self::DEFAULT_PROJECTION.'/'.self::USER_PATH.'/'. - $userName; - } else { - $uri = self::PICASA_BASE_FEED_URI.'/'. - self::DEFAULT_PROJECTION.'/'.self::USER_PATH.'/'. - self::DEFAULT_USER; - } - - return parent::getFeed($uri, 'Zend_Gdata_Photos_UserFeed'); - } - - /** - * Retreive AlbumFeed object containing multiple PhotoEntry or TagEntry - * objects. - * - * @param mixed $location (optional) The location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getAlbumFeed($location = null) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('feed'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Photos_AlbumFeed'); - } - - /** - * Retreive PhotoFeed object containing comments and tags associated - * with a given photo. - * - * @param mixed $location (optional) The location for the feed, as a URL - * or Query. If not specified, the community search feed will - * be returned instead. - * - * @return string|Zend_Gdata_App_Feed - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getPhotoFeed($location = null) - { - if (null === $location) { - $uri = self::PICASA_BASE_FEED_URI.'/'. - self::DEFAULT_PROJECTION.'/'. - self::COMMUNITY_SEARCH_PATH; - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('feed'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Photos_PhotoFeed'); - } - - /** - * Retreive a single UserEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getUserEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('entry'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Photos_UserEntry'); - } - - /** - * Retreive a single AlbumEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getAlbumEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('entry'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Photos_AlbumEntry'); - } - - /** - * Retreive a single PhotoEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getPhotoEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('entry'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Photos_PhotoEntry'); - } - - /** - * Retreive a single TagEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getTagEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('entry'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Photos_TagEntry'); - } - - /** - * Retreive a single CommentEntry object. - * - * @param mixed $location the location for the feed, as a URL or Query - * - * @return string|Zend_Gdata_App_Entry - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function getCommentEntry($location) - { - if (null === $location) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Location must not be null'); - } elseif ($location instanceof Zend_Gdata_Photos_UserQuery) { - $location->setType('entry'); - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Query) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Photos_CommentEntry'); - } - - /** - * Create a new album from a AlbumEntry. - * - * @param Zend_Gdata_Photos_AlbumEntry $album the album entry to - * insert - * - * @return Zend_Gdata_App_Entry the inserted album entry as - * returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function insertAlbumEntry($album, $uri = null) - { - if (null === $uri) { - $uri = self::PICASA_BASE_FEED_URI.'/'. - self::DEFAULT_PROJECTION.'/'.self::USER_PATH.'/'. - self::DEFAULT_USER; - } - $newEntry = $this->insertEntry($album, $uri, 'Zend_Gdata_Photos_AlbumEntry'); - - return $newEntry; - } - - /** - * Create a new photo from a PhotoEntry. - * - * @param Zend_Gdata_Photos_PhotoEntry $photo the photo to insert - * - * @return Zend_Gdata_App_Entry the inserted photo entry - * as returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function insertPhotoEntry($photo, $uri = null) - { - if ($uri instanceof Zend_Gdata_Photos_AlbumEntry) { - $uri = $uri->getLink(self::FEED_LINK_PATH)->href; - } - if (null === $uri) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('URI must not be null'); - } - $newEntry = $this->insertEntry($photo, $uri, 'Zend_Gdata_Photos_PhotoEntry'); - - return $newEntry; - } - - /** - * Create a new tag from a TagEntry. - * - * @param Zend_Gdata_Photos_TagEntry $tag the tag entry to insert - * - * @return Zend_Gdata_App_Entry the inserted tag entry as returned - * by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function insertTagEntry($tag, $uri = null) - { - if ($uri instanceof Zend_Gdata_Photos_PhotoEntry) { - $uri = $uri->getLink(self::FEED_LINK_PATH)->href; - } - if (null === $uri) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('URI must not be null'); - } - $newEntry = $this->insertEntry($tag, $uri, 'Zend_Gdata_Photos_TagEntry'); - - return $newEntry; - } - - /** - * Create a new comment from a CommentEntry. - * - * @param Zend_Gdata_Photos_CommentEntry $comment the comment entry to - * insert - * - * @return Zend_Gdata_App_Entry the inserted comment entry - * as returned by the server - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function insertCommentEntry($comment, $uri = null) - { - if ($uri instanceof Zend_Gdata_Photos_PhotoEntry) { - $uri = $uri->getLink(self::FEED_LINK_PATH)->href; - } - if (null === $uri) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('URI must not be null'); - } - $newEntry = $this->insertEntry($comment, $uri, 'Zend_Gdata_Photos_CommentEntry'); - - return $newEntry; - } - - /** - * Delete an AlbumEntry. - * - * @param Zend_Gdata_Photos_AlbumEntry $album the album entry to - * delete - * @param bool $catch Whether to catch an exception when - * modified and re-delete or throw - * - * @return void - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function deleteAlbumEntry($album, $catch) - { - if ($catch) { - try { - $this->delete($album); - } catch (Zend_Gdata_App_HttpException $e) { - if (409 === $e->getResponse()->getStatus()) { - $entry = new Zend_Gdata_Photos_AlbumEntry($e->getResponse()->getBody()); - $this->delete($entry->getLink('edit')->href); - } else { - throw $e; - } - } - } else { - $this->delete($album); - } - } - - /** - * Delete a PhotoEntry. - * - * @param Zend_Gdata_Photos_PhotoEntry $photo the photo entry to - * delete - * @param bool $catch Whether to catch an exception when - * modified and re-delete or throw - * - * @return void - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function deletePhotoEntry($photo, $catch) - { - if ($catch) { - try { - $this->delete($photo); - } catch (Zend_Gdata_App_HttpException $e) { - if (409 === $e->getResponse()->getStatus()) { - $entry = new Zend_Gdata_Photos_PhotoEntry($e->getResponse()->getBody()); - $this->delete($entry->getLink('edit')->href); - } else { - throw $e; - } - } - } else { - $this->delete($photo); - } - } - - /** - * Delete a CommentEntry. - * - * @param Zend_Gdata_Photos_CommentEntry $comment the comment entry to - * delete - * @param bool $catch Whether to catch an exception when - * modified and re-delete or throw - * - * @return void - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function deleteCommentEntry($comment, $catch) - { - if ($catch) { - try { - $this->delete($comment); - } catch (Zend_Gdata_App_HttpException $e) { - if (409 === $e->getResponse()->getStatus()) { - $entry = new Zend_Gdata_Photos_CommentEntry($e->getResponse()->getBody()); - $this->delete($entry->getLink('edit')->href); - } else { - throw $e; - } - } - } else { - $this->delete($comment); - } - } - - /** - * Delete a TagEntry. - * - * @param Zend_Gdata_Photos_TagEntry $tag the tag entry to - * delete - * @param bool $catch Whether to catch an exception when - * modified and re-delete or throw - * - * @return void - * - * @throws Zend_Gdata_App_Exception - * @throws Zend_Gdata_App_HttpException - */ - public function deleteTagEntry($tag, $catch) - { - if ($catch) { - try { - $this->delete($tag); - } catch (Zend_Gdata_App_HttpException $e) { - if (409 === $e->getResponse()->getStatus()) { - $entry = new Zend_Gdata_Photos_TagEntry($e->getResponse()->getBody()); - $this->delete($entry->getLink('edit')->href); - } else { - throw $e; - } - } - } else { - $this->delete($tag); - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumEntry.php b/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumEntry.php deleted file mode 100644 index 0e11f0885..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumEntry.php +++ /dev/null @@ -1,646 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Photos_AlbumEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry'; - - /** - * gphoto:id element. - * - * @var Zend_Gdata_Photos_Extension_Id - */ - protected $_gphotoId; - - /** - * gphoto:access element. - * - * @var Zend_Gdata_Photos_Extension_Access - */ - protected $_gphotoAccess; - - /** - * gphoto:location element. - * - * @var Zend_Gdata_Photos_Extension_Location - */ - protected $_gphotoLocation; - - /** - * gphoto:user element. - * - * @var Zend_Gdata_Photos_Extension_User - */ - protected $_gphotoUser; - - /** - * gphoto:nickname element. - * - * @var Zend_Gdata_Photos_Extension_Nickname - */ - protected $_gphotoNickname; - - /** - * gphoto:timestamp element. - * - * @var Zend_Gdata_Photos_Extension_Timestamp - */ - protected $_gphotoTimestamp; - - /** - * gphoto:name element. - * - * @var Zend_Gdata_Photos_Extension_Name - */ - protected $_gphotoName; - - /** - * gphoto:numphotos element. - * - * @var Zend_Gdata_Photos_Extension_NumPhotos - */ - protected $_gphotoNumPhotos; - - /** - * gphoto:commentCount element. - * - * @var Zend_Gdata_Photos_Extension_CommentCount - */ - protected $_gphotoCommentCount; - - /** - * gphoto:commentingEnabled element. - * - * @var Zend_Gdata_Photos_Extension_CommentingEnabled - */ - protected $_gphotoCommentingEnabled; - - /** - * media:group element. - * - * @var Zend_Gdata_Media_MediaGroup - */ - protected $_mediaGroup; - - /** - * georss:where element. - * - * @var Zend_Gdata_Geo_Extension_GeoRssWhere - */ - protected $_geoRssWhere; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - - $category = new Zend_Gdata_App_Extension_Category( - 'http://schemas.google.com/photos/2007#album', - 'http://schemas.google.com/g/2005#kind'); - $this->setCategory([$category]); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_gphotoTimestamp) { - $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoUser) { - $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoNickname) { - $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoAccess) { - $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoLocation) { - $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoName) { - $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoNumPhotos) { - $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoCommentCount) { - $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoCommentingEnabled) { - $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoId) { - $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); - } - if (null !== $this->_mediaGroup) { - $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':access': - $access = new Zend_Gdata_Photos_Extension_Access(); - $access->transferFromDOM($child); - $this->_gphotoAccess = $access; - break; - case $this->lookupNamespace('gphoto').':location': - $location = new Zend_Gdata_Photos_Extension_Location(); - $location->transferFromDOM($child); - $this->_gphotoLocation = $location; - break; - case $this->lookupNamespace('gphoto').':name': - $name = new Zend_Gdata_Photos_Extension_Name(); - $name->transferFromDOM($child); - $this->_gphotoName = $name; - break; - case $this->lookupNamespace('gphoto').':numphotos': - $numPhotos = new Zend_Gdata_Photos_Extension_NumPhotos(); - $numPhotos->transferFromDOM($child); - $this->_gphotoNumPhotos = $numPhotos; - break; - case $this->lookupNamespace('gphoto').':commentCount': - $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); - $commentCount->transferFromDOM($child); - $this->_gphotoCommentCount = $commentCount; - break; - case $this->lookupNamespace('gphoto').':commentingEnabled': - $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); - $commentingEnabled->transferFromDOM($child); - $this->_gphotoCommentingEnabled = $commentingEnabled; - break; - case $this->lookupNamespace('gphoto').':id': - $id = new Zend_Gdata_Photos_Extension_Id(); - $id->transferFromDOM($child); - $this->_gphotoId = $id; - break; - case $this->lookupNamespace('gphoto').':user': - $user = new Zend_Gdata_Photos_Extension_User(); - $user->transferFromDOM($child); - $this->_gphotoUser = $user; - break; - case $this->lookupNamespace('gphoto').':timestamp': - $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); - $timestamp->transferFromDOM($child); - $this->_gphotoTimestamp = $timestamp; - break; - case $this->lookupNamespace('gphoto').':nickname': - $nickname = new Zend_Gdata_Photos_Extension_Nickname(); - $nickname->transferFromDOM($child); - $this->_gphotoNickname = $nickname; - break; - case $this->lookupNamespace('georss').':where': - $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere(); - $geoRssWhere->transferFromDOM($child); - $this->_geoRssWhere = $geoRssWhere; - break; - case $this->lookupNamespace('media').':group': - $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); - $mediaGroup->transferFromDOM($child); - $this->_mediaGroup = $mediaGroup; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:access attribute. - * - * @return Zend_Gdata_Photos_Extension_Access|null the requested attribute - * - *@see setGphotoAccess - */ - public function getGphotoAccess() - { - return $this->_gphotoAccess; - } - - /** - * Set the value for this element's gphoto:access attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoAccess($value) - { - $this->_gphotoAccess = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:location attribute. - * - * @return Zend_Gdata_Photos_Extension_Location|null the requested attribute - * - *@see setGphotoLocation - */ - public function getGphotoLocation() - { - return $this->_gphotoLocation; - } - - /** - * Set the value for this element's gphoto:location attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoLocation($value) - { - $this->_location = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:name attribute. - * - * @return Zend_Gdata_Photos_Extension_Name|null the requested attribute - * - *@see setGphotoName - */ - public function getGphotoName() - { - return $this->_gphotoName; - } - - /** - * Set the value for this element's gphoto:name attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoName($value) - { - $this->_gphotoName = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:numphotos attribute. - * - * @return Zend_Gdata_Photos_Extension_NumPhotos|null the requested attribute - * - * @see setGphotoNumPhotos - */ - public function getGphotoNumPhotos() - { - return $this->_gphotoNumPhotos; - } - - /** - * Set the value for this element's gphoto:numphotos attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoNumPhotos($value) - { - $this->_gphotoNumPhotos = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentCount attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentCount|null the requested attribute - * - *@see setGphotoCommentCount - */ - public function getGphotoCommentCount() - { - return $this->_gphotoCommentCount; - } - - /** - * Set the value for this element's gphoto:commentCount attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoCommentCount($value) - { - $this->_gphotoCommentCount = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentingEnabled attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentingEnabled|null the requested attribute - * - * @see setGphotoCommentingEnabled - */ - public function getGphotoCommentingEnabled() - { - return $this->_gphotoCommentingEnabled; - } - - /** - * Set the value for this element's gphoto:commentingEnabled attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoCommentingEnabled($value) - { - $this->_gphotoCommentingEnabled = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:id attribute. - * - * @return Zend_Gdata_Photos_Extension_Id|null the requested attribute - * - *@see setGphotoId - */ - public function getGphotoId() - { - return $this->_gphotoId; - } - - /** - * Set the value for this element's gphoto:id attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoId($value) - { - $this->_gphotoId = $value; - - return $this; - } - - /** - * Get the value for this element's georss:where attribute. - * - * @return Zend_Gdata_Geo_Extension_GeoRssWhere|null the requested attribute - * - * @see setGeoRssWhere - */ - public function getGeoRssWhere() - { - return $this->_geoRssWhere; - } - - /** - * Set the value for this element's georss:where attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGeoRssWhere($value) - { - $this->_geoRssWhere = $value; - - return $this; - } - - /** - * Get the value for this element's media:group attribute. - * - * @return Zend_Gdata_Media_MediaGroup|null the requested attribute - * - * @see setMediaGroup - */ - public function getMediaGroup() - { - return $this->_mediaGroup; - } - - /** - * Set the value for this element's media:group attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setMediaGroup($value) - { - $this->_mediaGroup = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:user attribute. - * - * @return Zend_Gdata_Photos_Extension_User|null the requested attribute - * - * @see setGphotoUser - */ - public function getGphotoUser() - { - return $this->_gphotoUser; - } - - /** - * Set the value for this element's gphoto:user attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoUser($value) - { - $this->_gphotoUser = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:nickname attribute. - * - * @return Zend_Gdata_Photos_Extension_Nickname|null the requested attribute - * - * @see setGphotoNickname - */ - public function getGphotoNickname() - { - return $this->_gphotoNickname; - } - - /** - * Set the value for this element's gphoto:nickname attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoNickname($value) - { - $this->_gphotoNickname = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:timestamp attribute. - * - * @return Zend_Gdata_Photos_Extension_Timestamp|null the requested attribute - * - * @see setGphotoTimestamp - */ - public function getGphotoTimestamp() - { - return $this->_gphotoTimestamp; - } - - /** - * Set the value for this element's gphoto:timestamp attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumEntry the element being modified - */ - public function setGphotoTimestamp($value) - { - $this->_gphotoTimestamp = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumFeed.php b/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumFeed.php deleted file mode 100644 index 7f8d5c197..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumFeed.php +++ /dev/null @@ -1,540 +0,0 @@ - 'Zend_Gdata_Photos_PhotoEntry', - 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', - 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry', - ]; - - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_gphotoId) { - $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoUser) { - $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoNickname) { - $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoName) { - $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoLocation) { - $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoAccess) { - $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoTimestamp) { - $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoNumPhotos) { - $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoCommentingEnabled) { - $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoCommentCount) { - $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':id': - $id = new Zend_Gdata_Photos_Extension_Id(); - $id->transferFromDOM($child); - $this->_gphotoId = $id; - break; - case $this->lookupNamespace('gphoto').':user': - $user = new Zend_Gdata_Photos_Extension_User(); - $user->transferFromDOM($child); - $this->_gphotoUser = $user; - break; - case $this->lookupNamespace('gphoto').':nickname': - $nickname = new Zend_Gdata_Photos_Extension_Nickname(); - $nickname->transferFromDOM($child); - $this->_gphotoNickname = $nickname; - break; - case $this->lookupNamespace('gphoto').':name': - $name = new Zend_Gdata_Photos_Extension_Name(); - $name->transferFromDOM($child); - $this->_gphotoName = $name; - break; - case $this->lookupNamespace('gphoto').':location': - $location = new Zend_Gdata_Photos_Extension_Location(); - $location->transferFromDOM($child); - $this->_gphotoLocation = $location; - break; - case $this->lookupNamespace('gphoto').':access': - $access = new Zend_Gdata_Photos_Extension_Access(); - $access->transferFromDOM($child); - $this->_gphotoAccess = $access; - break; - case $this->lookupNamespace('gphoto').':timestamp': - $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); - $timestamp->transferFromDOM($child); - $this->_gphotoTimestamp = $timestamp; - break; - case $this->lookupNamespace('gphoto').':numphotos': - $numphotos = new Zend_Gdata_Photos_Extension_NumPhotos(); - $numphotos->transferFromDOM($child); - $this->_gphotoNumPhotos = $numphotos; - break; - case $this->lookupNamespace('gphoto').':commentingEnabled': - $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); - $commentingEnabled->transferFromDOM($child); - $this->_gphotoCommentingEnabled = $commentingEnabled; - break; - case $this->lookupNamespace('gphoto').':commentCount': - $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); - $commentCount->transferFromDOM($child); - $this->_gphotoCommentCount = $commentCount; - break; - case $this->lookupNamespace('atom').':entry': - $entryClassName = $this->_entryClassName; - $tmpEntry = new Zend_Gdata_App_Entry($child); - $categories = $tmpEntry->getCategory(); - foreach ($categories as $category) { - if (Zend_Gdata_Photos::KIND_PATH == $category->scheme - && '' != $this->_entryKindClassMapping[$category->term]) { - $entryClassName = $this->_entryKindClassMapping[$category->term]; - break; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); - } - } - - $newEntry = new $entryClassName($child); - $newEntry->setHttpClient($this->getHttpClient()); - $this->_entry[] = $newEntry; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:user attribute. - * - * @return Zend_Gdata_Photos_Extension_User|null the requested attribute - * - *@see setGphotoUser - */ - public function getGphotoUser() - { - return $this->_gphotoUser; - } - - /** - * Set the value for this element's gphoto:user attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoUser($value) - { - $this->_gphotoUser = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:access attribute. - * - * @return Zend_Gdata_Photos_Extension_Access|null the requested attribute - * - *@see setGphotoAccess - */ - public function getGphotoAccess() - { - return $this->_gphotoAccess; - } - - /** - * Set the value for this element's gphoto:access attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoAccess($value) - { - $this->_gphotoAccess = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:location attribute. - * - * @return Zend_Gdata_Photos_Extension_Location|null the requested attribute - * - * @see setGphotoLocation - */ - public function getGphotoLocation() - { - return $this->_gphotoLocation; - } - - /** - * Set the value for this element's gphoto:location attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoLocation($value) - { - $this->_gphotoLocation = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:name attribute. - * - * @return Zend_Gdata_Photos_Extension_Name|null the requested attribute - * - *@see setGphotoName - */ - public function getGphotoName() - { - return $this->_gphotoName; - } - - /** - * Set the value for this element's gphoto:name attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoName($value) - { - $this->_gphotoName = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:numphotos attribute. - * - * @return Zend_Gdata_Photos_Extension_NumPhotos|null the requested attribute - * - * @see setGphotoNumPhotos - */ - public function getGphotoNumPhotos() - { - return $this->_gphotoNumPhotos; - } - - /** - * Set the value for this element's gphoto:numphotos attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoNumPhotos($value) - { - $this->_gphotoNumPhotos = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentCount attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentCount|null the requested attribute - * - * @see setGphotoCommentCount - */ - public function getGphotoCommentCount() - { - return $this->_gphotoCommentCount; - } - - /** - * Set the value for this element's gphoto:commentCount attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoCommentCount($value) - { - $this->_gphotoCommentCount = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentingEnabled attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentingEnabled|null the requested attribute - * - * @see setGphotoCommentingEnabled - */ - public function getGphotoCommentingEnabled() - { - return $this->_gphotoCommentingEnabled; - } - - /** - * Set the value for this element's gphoto:commentingEnabled attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoCommentingEnabled($value) - { - $this->_gphotoCommentingEnabled = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:id attribute. - * - * @return Zend_Gdata_Photos_Extension_Id|null the requested attribute - * - *@see setGphotoId - */ - public function getGphotoId() - { - return $this->_gphotoId; - } - - /** - * Set the value for this element's gphoto:id attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoId($value) - { - $this->_gphotoId = $value; - - return $this; - } - - /** - * Get the value for this element's georss:where attribute. - * - * @see setGeoRssWhere - * - * @return string the requested attribute - */ - public function getGeoRssWhere() - { - return $this->_geoRssWhere; - } - - /** - * Set the value for this element's georss:where attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGeoRssWhere($value) - { - $this->_geoRssWhere = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:nickname attribute. - * - * @return Zend_Gdata_Photos_Extension_Nickname|null the requested attribute - * - *@see setGphotoNickname - */ - public function getGphotoNickname() - { - return $this->_gphotoNickname; - } - - /** - * Set the value for this element's gphoto:nickname attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoNickname($value) - { - $this->_gphotoNickname = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:timestamp attribute. - * - * @return Zend_Gdata_Photos_Extension_Timestamp|null the requested attribute - * - * @see setGphotoTimestamp - */ - public function getGphotoTimestamp() - { - return $this->_gphotoTimestamp; - } - - /** - * Set the value for this element's gphoto:timestamp attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_AlbumFeed the element being modified - */ - public function setGphotoTimestamp($value) - { - $this->_gphotoTimestamp = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumQuery.php b/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumQuery.php deleted file mode 100644 index e01d5d1c6..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/AlbumQuery.php +++ /dev/null @@ -1,150 +0,0 @@ -_albumId = null; - $this->_albumName = $value; - - return $this; - } - - /** - * Get the album name which is to be returned. - * - * @see setAlbumName - * - * @return string the name of the album to retrieve - */ - public function getAlbumName() - { - return $this->_albumName; - } - - /** - * Set the album ID to query for. When set, this album's photographs - * be returned. If not set or null, the default user's feed will be - * returned instead. - * - * NOTE: Album and AlbumId are mutually exclusive. Setting one will - * automatically set the other to null. - * - * @param string $value the ID of the album to retrieve, or null to - * clear - * - * @return Zend_Gdata_Photos_AlbumQuery the query object - */ - public function setAlbumId($value) - { - $this->_albumName = null; - $this->_albumId = $value; - - return $this; - } - - /** - * Get the album ID which is to be returned. - * - * @see setAlbum - * - * @return string the ID of the album to retrieve - */ - public function getAlbumId() - { - return $this->_albumId; - } - - /** - * Returns the URL generated for this query, based on it's current - * parameters. - * - * @return string a URL generated based on the state of this query - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getQueryUrl($incomingUri = '') - { - $uri = ''; - if (null !== $this->getAlbumName() && null === $this->getAlbumId()) { - $uri .= '/album/'.$this->getAlbumName(); - } elseif (null === $this->getAlbumName() && null !== $this->getAlbumId()) { - $uri .= '/albumid/'.$this->getAlbumId(); - } elseif (null !== $this->getAlbumName() && null !== $this->getAlbumId()) { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('AlbumName and AlbumId cannot both be non-null'); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('AlbumName and AlbumId cannot both be null'); - } - $uri .= $incomingUri; - - return parent::getQueryUrl($uri); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/CommentEntry.php b/packages/zend-gdata/library/Zend/Gdata/Photos/CommentEntry.php deleted file mode 100644 index e59d76d80..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/CommentEntry.php +++ /dev/null @@ -1,201 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Photos_CommentEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry'; - - /** - * gphoto:id element. - * - * @var Zend_Gdata_Photos_Extension_Id - */ - protected $_gphotoId; - - /** - * gphoto:photoid element, differs from gphoto:id as this is an - * actual identification number unique exclusively to photo entries, - * whereas gphoto:id can refer to all gphoto objects. - * - * @var Zend_Gdata_Photos_Extension_PhotoId - */ - protected $_gphotoPhotoId; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - - $category = new Zend_Gdata_App_Extension_Category( - 'http://schemas.google.com/photos/2007#comment', - 'http://schemas.google.com/g/2005#kind'); - $this->setCategory([$category]); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_gphotoId) { - $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoPhotoId) { - $element->appendChild($this->_gphotoPhotoId->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':id': - $id = new Zend_Gdata_Photos_Extension_Id(); - $id->transferFromDOM($child); - $this->_gphotoId = $id; - break; - case $this->lookupNamespace('gphoto').':photoid': - $photoid = new Zend_Gdata_Photos_Extension_PhotoId(); - $photoid->transferFromDOM($child); - $this->_gphotoPhotoId = $photoid; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:photoid attribute. - * - * @return Zend_Gdata_Photos_Extension_PhotoId|null the requested attribute - * - *@see setGphotoPhotoId - */ - public function getGphotoPhotoId() - { - return $this->_gphotoPhotoId; - } - - /** - * Set the value for this element's gphoto:photoid attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_CommentEntry the element being modified - */ - public function setGphotoPhotoId($value) - { - $this->_gphotoPhotoId = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:id attribute. - * - * @return Zend_Gdata_Photos_Extension_Id|null the requested attribute - * - *@see setGphotoId - */ - public function getGphotoId() - { - return $this->_gphotoId; - } - - /** - * Set the value for this element's gphoto:id attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_CommentEntry the element being modified - */ - public function setGphotoId($value) - { - $this->_gphotoId = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Access.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Access.php deleted file mode 100644 index e4dd9ebba..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Access.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/AlbumId.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/AlbumId.php deleted file mode 100644 index dca7fda30..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/AlbumId.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/BytesUsed.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/BytesUsed.php deleted file mode 100644 index 280beee9e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/BytesUsed.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Checksum.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Checksum.php deleted file mode 100644 index 06976f7fa..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Checksum.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Client.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Client.php deleted file mode 100644 index ce65563ca..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Client.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/CommentCount.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/CommentCount.php deleted file mode 100644 index ba86f43ab..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/CommentCount.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/CommentingEnabled.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/CommentingEnabled.php deleted file mode 100644 index e1f1e3991..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/CommentingEnabled.php +++ /dev/null @@ -1,61 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Height.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Height.php deleted file mode 100644 index b249f9b2f..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Height.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Id.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Id.php deleted file mode 100644 index a500eb71e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Id.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Location.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Location.php deleted file mode 100644 index e8d6eeeca..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Location.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php deleted file mode 100644 index 4ea127984..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Name.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Name.php deleted file mode 100644 index f19aabe0c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Name.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Nickname.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Nickname.php deleted file mode 100644 index e76d7f466..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Nickname.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/NumPhotos.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/NumPhotos.php deleted file mode 100644 index fb43a9216..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/NumPhotos.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/NumPhotosRemaining.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/NumPhotosRemaining.php deleted file mode 100644 index fafc42e9d..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/NumPhotosRemaining.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/PhotoId.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/PhotoId.php deleted file mode 100644 index dab90f176..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/PhotoId.php +++ /dev/null @@ -1,58 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Position.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Position.php deleted file mode 100644 index ef2052661..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Position.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/QuotaCurrent.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/QuotaCurrent.php deleted file mode 100644 index 86c5dc7aa..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/QuotaCurrent.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/QuotaLimit.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/QuotaLimit.php deleted file mode 100644 index 8b030e2c7..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/QuotaLimit.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Rotation.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Rotation.php deleted file mode 100644 index 476ac37e2..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Rotation.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Size.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Size.php deleted file mode 100644 index 3bc0cc0a8..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Size.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Thumbnail.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Thumbnail.php deleted file mode 100644 index 5745122bd..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Thumbnail.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Timestamp.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Timestamp.php deleted file mode 100644 index b17942678..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Timestamp.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/User.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/User.php deleted file mode 100644 index ec91cbcec..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/User.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Version.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Version.php deleted file mode 100644 index fa7160c8a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Version.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Weight.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Weight.php deleted file mode 100644 index cee10c4e3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Weight.php +++ /dev/null @@ -1,60 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Width.php b/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Width.php deleted file mode 100644 index cf7d7a279..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/Extension/Width.php +++ /dev/null @@ -1,59 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct(); - $this->setText($text); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoEntry.php b/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoEntry.php deleted file mode 100644 index d712ec6b1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoEntry.php +++ /dev/null @@ -1,731 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Photos_PhotoEntry extends Zend_Gdata_Media_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry'; - - /** - * gphoto:id element. - * - * @var Zend_Gdata_Photos_Extension_Id - */ - protected $_gphotoId; - - /** - * gphoto:albumid element. - * - * @var Zend_Gdata_Photos_Extension_AlbumId - */ - protected $_gphotoAlbumId; - - /** - * gphoto:version element. - * - * @var Zend_Gdata_Photos_Extension_Version - */ - protected $_gphotoVersion; - - /** - * gphoto:width element. - * - * @var Zend_Gdata_Photos_Extension_Width - */ - protected $_gphotoWidth; - - /** - * gphoto:height element. - * - * @var Zend_Gdata_Photos_Extension_Height - */ - protected $_gphotoHeight; - - /** - * gphoto:size element. - * - * @var Zend_Gdata_Photos_Extension_Size - */ - protected $_gphotoSize; - - /** - * gphoto:client element. - * - * @var Zend_Gdata_Photos_Extension_Client - */ - protected $_gphotoClient; - - /** - * gphoto:checksum element. - * - * @var Zend_Gdata_Photos_Extension_Checksum - */ - protected $_gphotoChecksum; - - /** - * gphoto:timestamp element. - * - * @var Zend_Gdata_Photos_Extension_Timestamp - */ - protected $_gphotoTimestamp; - - /** - * gphoto:commentCount element. - * - * @var Zend_Gdata_Photos_Extension_CommentCount - */ - protected $_gphotoCommentCount; - - /** - * gphoto:commentingEnabled element. - * - * @var Zend_Gdata_Photos_Extension_CommentingEnabled - */ - protected $_gphotoCommentingEnabled; - - /** - * exif:tags element. - * - * @var Zend_Gdata_Exif_Extension_Tags - */ - protected $_exifTags; - - /** - * georss:where element. - * - * @var Zend_Gdata_Geo_Extension_GeoRssWhere - */ - protected $_geoRssWhere; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - - $category = new Zend_Gdata_App_Extension_Category( - 'http://schemas.google.com/photos/2007#photo', - 'http://schemas.google.com/g/2005#kind'); - $this->setCategory([$category]); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_gphotoAlbumId) { - $element->appendChild($this->_gphotoAlbumId->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoId) { - $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoVersion) { - $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoWidth) { - $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoHeight) { - $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoSize) { - $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoClient) { - $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoChecksum) { - $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoTimestamp) { - $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoCommentingEnabled) { - $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoCommentCount) { - $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); - } - if (null !== $this->_exifTags) { - $element->appendChild($this->_exifTags->getDOM($element->ownerDocument)); - } - if (null !== $this->_geoRssWhere) { - $element->appendChild($this->_geoRssWhere->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':albumid': - $albumId = new Zend_Gdata_Photos_Extension_AlbumId(); - $albumId->transferFromDOM($child); - $this->_gphotoAlbumId = $albumId; - break; - case $this->lookupNamespace('gphoto').':id': - $id = new Zend_Gdata_Photos_Extension_Id(); - $id->transferFromDOM($child); - $this->_gphotoId = $id; - break; - case $this->lookupNamespace('gphoto').':version': - $version = new Zend_Gdata_Photos_Extension_Version(); - $version->transferFromDOM($child); - $this->_gphotoVersion = $version; - break; - case $this->lookupNamespace('gphoto').':width': - $width = new Zend_Gdata_Photos_Extension_Width(); - $width->transferFromDOM($child); - $this->_gphotoWidth = $width; - break; - case $this->lookupNamespace('gphoto').':height': - $height = new Zend_Gdata_Photos_Extension_Height(); - $height->transferFromDOM($child); - $this->_gphotoHeight = $height; - break; - case $this->lookupNamespace('gphoto').':size': - $size = new Zend_Gdata_Photos_Extension_Size(); - $size->transferFromDOM($child); - $this->_gphotoSize = $size; - break; - case $this->lookupNamespace('gphoto').':client': - $client = new Zend_Gdata_Photos_Extension_Client(); - $client->transferFromDOM($child); - $this->_gphotoClient = $client; - break; - case $this->lookupNamespace('gphoto').':checksum': - $checksum = new Zend_Gdata_Photos_Extension_Checksum(); - $checksum->transferFromDOM($child); - $this->_gphotoChecksum = $checksum; - break; - case $this->lookupNamespace('gphoto').':timestamp': - $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); - $timestamp->transferFromDOM($child); - $this->_gphotoTimestamp = $timestamp; - break; - case $this->lookupNamespace('gphoto').':commentingEnabled': - $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); - $commentingEnabled->transferFromDOM($child); - $this->_gphotoCommentingEnabled = $commentingEnabled; - break; - case $this->lookupNamespace('gphoto').':commentCount': - $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); - $commentCount->transferFromDOM($child); - $this->_gphotoCommentCount = $commentCount; - break; - case $this->lookupNamespace('exif').':tags': - $exifTags = new Zend_Gdata_Exif_Extension_Tags(); - $exifTags->transferFromDOM($child); - $this->_exifTags = $exifTags; - break; - case $this->lookupNamespace('georss').':where': - $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere(); - $geoRssWhere->transferFromDOM($child); - $this->_geoRssWhere = $geoRssWhere; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:albumid attribute. - * - * @return Zend_Gdata_Photos_Extension_AlbumId|null the requested attribute - * - *@see setGphotoAlbumId - */ - public function getGphotoAlbumId() - { - return $this->_gphotoAlbumId; - } - - /** - * Set the value for this element's gphoto:albumid attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoAlbumId($value) - { - $this->_gphotoAlbumId = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:id attribute. - * - * @return Zend_Gdata_Photos_Extension_Id|null the requested attribute - * - *@see setGphotoId - */ - public function getGphotoId() - { - return $this->_gphotoId; - } - - /** - * Set the value for this element's gphoto:id attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoId($value) - { - $this->_gphotoId = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:version attribute. - * - * @return Zend_Gdata_Photos_Extension_Version|null the requested attribute - * - *@see setGphotoVersion - */ - public function getGphotoVersion() - { - return $this->_gphotoVersion; - } - - /** - * Set the value for this element's gphoto:version attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoVersion($value) - { - $this->_gphotoVersion = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:width attribute. - * - * @return Zend_Gdata_Photos_Extension_Width|null the requested attribute - * - *@see setGphotoWidth - */ - public function getGphotoWidth() - { - return $this->_gphotoWidth; - } - - /** - * Set the value for this element's gphoto:width attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoWidth($value) - { - $this->_gphotoWidth = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:height attribute. - * - * @return Zend_Gdata_Photos_Extension_Height|null the requested attribute - * - * @see setGphotoHeight - */ - public function getGphotoHeight() - { - return $this->_gphotoHeight; - } - - /** - * Set the value for this element's gphoto:height attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoHeight($value) - { - $this->_gphotoHeight = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:size attribute. - * - * @return Zend_Gdata_Photos_Extension_Size|null the requested attribute - * - *@see setGphotoSize - */ - public function getGphotoSize() - { - return $this->_gphotoSize; - } - - /** - * Set the value for this element's gphoto:size attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoSize($value) - { - $this->_gphotoSize = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:client attribute. - * - * @return Zend_Gdata_Photos_Extension_Client|null the requested attribute - * - * @see setGphotoClient - */ - public function getGphotoClient() - { - return $this->_gphotoClient; - } - - /** - * Set the value for this element's gphoto:client attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoClient($value) - { - $this->_gphotoClient = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:checksum attribute. - * - * @return Zend_Gdata_Photos_Extension_Checksum|null the requested attribute - * - * @see setGphotoChecksum - */ - public function getGphotoChecksum() - { - return $this->_gphotoChecksum; - } - - /** - * Set the value for this element's gphoto:checksum attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoChecksum($value) - { - $this->_gphotoChecksum = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:timestamp attribute. - * - * @return Zend_Gdata_Photos_Extension_Timestamp|null the requested attribute - * - * @see setGphotoTimestamp - */ - public function getGphotoTimestamp() - { - return $this->_gphotoTimestamp; - } - - /** - * Set the value for this element's gphoto:timestamp attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoTimestamp($value) - { - $this->_gphotoTimestamp = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentCount attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentCount|null the requested attribute - * - * @see setGphotoCommentCount - */ - public function getGphotoCommentCount() - { - return $this->_gphotoCommentCount; - } - - /** - * Set the value for this element's gphoto:commentCount attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoCommentCount($value) - { - $this->_gphotoCommentCount = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentingEnabled attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentingEnabled|null the requested attribute - * - * @see setGphotoCommentingEnabled - */ - public function getGphotoCommentingEnabled() - { - return $this->_gphotoCommentingEnabled; - } - - /** - * Set the value for this element's gphoto:commentingEnabled attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGphotoCommentingEnabled($value) - { - $this->_gphotoCommentingEnabled = $value; - - return $this; - } - - /** - * Get the value for this element's exif:tags attribute. - * - * @return Zend_Gdata_Exif_Extension_Tags|null the requested attribute - * - * @see setExifTags - */ - public function getExifTags() - { - return $this->_exifTags; - } - - /** - * Set the value for this element's exif:tags attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setExifTags($value) - { - $this->_exifTags = $value; - - return $this; - } - - /** - * Get the value for this element's georss:where attribute. - * - * @return Zend_Gdata_Geo_Extension_GeoRssWhere|null the requested attribute - * - * @see setGeoRssWhere - */ - public function getGeoRssWhere() - { - return $this->_geoRssWhere; - } - - /** - * Set the value for this element's georss:where attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setGeoRssWhere($value) - { - $this->_geoRssWhere = $value; - - return $this; - } - - /** - * Get the value for this element's media:group attribute. - * - * @return Zend_Gdata_Media_Extension_MediaGroup|null the requested attribute - * - * @see setMediaGroup - */ - public function getMediaGroup() - { - return $this->_mediaGroup; - } - - /** - * Set the value for this element's media:group attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoEntry the element being modified - */ - public function setMediaGroup($value) - { - $this->_mediaGroup = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoFeed.php b/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoFeed.php deleted file mode 100644 index 70f1189c1..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoFeed.php +++ /dev/null @@ -1,592 +0,0 @@ - 'Zend_Gdata_Photos_CommentEntry', - 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry', - ]; - - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_gphotoId) { - $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoVersion) { - $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoWidth) { - $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoHeight) { - $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoSize) { - $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoClient) { - $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoChecksum) { - $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoTimestamp) { - $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoCommentingEnabled) { - $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoCommentCount) { - $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); - } - if (null != $this->_mediaGroup) { - $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':id': - $id = new Zend_Gdata_Photos_Extension_Id(); - $id->transferFromDOM($child); - $this->_gphotoId = $id; - break; - case $this->lookupNamespace('gphoto').':version': - $version = new Zend_Gdata_Photos_Extension_Version(); - $version->transferFromDOM($child); - $this->_gphotoVersion = $version; - break; - case $this->lookupNamespace('gphoto').':albumid': - $albumid = new Zend_Gdata_Photos_Extension_AlbumId(); - $albumid->transferFromDOM($child); - $this->_gphotoAlbumId = $albumid; - break; - case $this->lookupNamespace('gphoto').':width': - $width = new Zend_Gdata_Photos_Extension_Width(); - $width->transferFromDOM($child); - $this->_gphotoWidth = $width; - break; - case $this->lookupNamespace('gphoto').':height': - $height = new Zend_Gdata_Photos_Extension_Height(); - $height->transferFromDOM($child); - $this->_gphotoHeight = $height; - break; - case $this->lookupNamespace('gphoto').':size': - $size = new Zend_Gdata_Photos_Extension_Size(); - $size->transferFromDOM($child); - $this->_gphotoSize = $size; - break; - case $this->lookupNamespace('gphoto').':client': - $client = new Zend_Gdata_Photos_Extension_Client(); - $client->transferFromDOM($child); - $this->_gphotoClient = $client; - break; - case $this->lookupNamespace('gphoto').':checksum': - $checksum = new Zend_Gdata_Photos_Extension_Checksum(); - $checksum->transferFromDOM($child); - $this->_gphotoChecksum = $checksum; - break; - case $this->lookupNamespace('gphoto').':timestamp': - $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); - $timestamp->transferFromDOM($child); - $this->_gphotoTimestamp = $timestamp; - break; - case $this->lookupNamespace('gphoto').':commentingEnabled': - $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); - $commentingEnabled->transferFromDOM($child); - $this->_gphotoCommentingEnabled = $commentingEnabled; - break; - case $this->lookupNamespace('gphoto').':commentCount': - $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); - $commentCount->transferFromDOM($child); - $this->_gphotoCommentCount = $commentCount; - break; - case $this->lookupNamespace('media').':group': - $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); - $mediaGroup->transferFromDOM($child); - $this->_mediaGroup = $mediaGroup; - break; - case $this->lookupNamespace('atom').':entry': - $entryClassName = $this->_entryClassName; - $tmpEntry = new Zend_Gdata_App_Entry($child); - $categories = $tmpEntry->getCategory(); - foreach ($categories as $category) { - if (Zend_Gdata_Photos::KIND_PATH == $category->scheme - && '' != $this->_entryKindClassMapping[$category->term]) { - $entryClassName = $this->_entryKindClassMapping[$category->term]; - break; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); - } - } - - $newEntry = new $entryClassName($child); - $newEntry->setHttpClient($this->getHttpClient()); - $this->_entry[] = $newEntry; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:id attribute. - * - * @return Zend_Gdata_Photos_Extension_Id|null the requested attribute - * - *@see setGphotoId - */ - public function getGphotoId() - { - return $this->_gphotoId; - } - - /** - * Set the value for this element's gphoto:id attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoId($value) - { - $this->_gphotoId = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:version attribute. - * - * @return Zend_Gdata_Photos_Extension_Version|null the requested attribute - * - *@see setGphotoVersion - */ - public function getGphotoVersion() - { - return $this->_gphotoVersion; - } - - /** - * Set the value for this element's gphoto:version attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoVersion($value) - { - $this->_gphotoVersion = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:albumid attribute. - * - * @return Zend_Gdata_Photos_Extension_AlbumId|null the requested attribute - * - *@see setGphotoAlbumId - */ - public function getGphotoAlbumId() - { - return $this->_gphotoAlbumId; - } - - /** - * Set the value for this element's gphoto:albumid attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoAlbumId($value) - { - $this->_gphotoAlbumId = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:width attribute. - * - * @return Zend_Gdata_Photos_Extension_Width|null the requested attribute - * - *@see setGphotoWidth - */ - public function getGphotoWidth() - { - return $this->_gphotoWidth; - } - - /** - * Set the value for this element's gphoto:width attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoWidth($value) - { - $this->_gphotoWidth = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:height attribute. - * - * @return Zend_Gdata_Photos_Extension_Height|null the requested attribute - * - * @see setGphotoHeight - */ - public function getGphotoHeight() - { - return $this->_gphotoHeight; - } - - /** - * Set the value for this element's gphoto:height attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoHeight($value) - { - $this->_gphotoHeight = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:size attribute. - * - * @return Zend_Gdata_Photos_Extension_Size|null the requested attribute - * - *@see setGphotoSize - */ - public function getGphotoSize() - { - return $this->_gphotoSize; - } - - /** - * Set the value for this element's gphoto:size attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoSize($value) - { - $this->_gphotoSize = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:client attribute. - * - * @return Zend_Gdata_Photos_Extension_Client|null the requested attribute - * - * @see setGphotoClient - */ - public function getGphotoClient() - { - return $this->_gphotoClient; - } - - /** - * Set the value for this element's gphoto:client attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoClient($value) - { - $this->_gphotoClient = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:checksum attribute. - * - * @return Zend_Gdata_Photos_Extension_Checksum|null the requested attribute - * - * @see setGphotoChecksum - */ - public function getGphotoChecksum() - { - return $this->_gphotoChecksum; - } - - /** - * Set the value for this element's gphoto:checksum attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoChecksum($value) - { - $this->_gphotoChecksum = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:timestamp attribute. - * - * @return Zend_Gdata_Photos_Extension_Timestamp|null the requested attribute - * - * @see setGphotoTimestamp - */ - public function getGphotoTimestamp() - { - return $this->_gphotoTimestamp; - } - - /** - * Set the value for this element's gphoto:timestamp attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoTimestamp($value) - { - $this->_gphotoTimestamp = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentCount attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentCount|null the requested attribute - * - * @see setGphotoCommentCount - */ - public function getGphotoCommentCount() - { - return $this->_gphotoCommentCount; - } - - /** - * Set the value for this element's gphoto:commentCount attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoCommentCount($value) - { - $this->_gphotoCommentCount = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:commentingEnabled attribute. - * - * @return Zend_Gdata_Photos_Extension_CommentingEnabled|null the requested attribute - * - * @see setGphotoCommentingEnabled - */ - public function getGphotoCommentingEnabled() - { - return $this->_gphotoCommentingEnabled; - } - - /** - * Set the value for this element's gphoto:commentingEnabled attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setGphotoCommentingEnabled($value) - { - $this->_gphotoCommentingEnabled = $value; - - return $this; - } - - /** - * Get the value for this element's media:group attribute. - * - * @return Zend_Gdata_Media_Extension_MediaGroup|null the requested attribute - * - * @see setMediaGroup - */ - public function getMediaGroup() - { - return $this->_mediaGroup; - } - - /** - * Set the value for this element's media:group attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_PhotoFeed the element being modified - */ - public function setMediaGroup($value) - { - $this->_mediaGroup = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoQuery.php b/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoQuery.php deleted file mode 100644 index 89795fc11..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/PhotoQuery.php +++ /dev/null @@ -1,97 +0,0 @@ -_photoId = $value; - } - - /** - * Get the photo ID which is to be returned. - * - * @see setPhoto - * - * @return string the ID of the photo to retrieve - */ - public function getPhotoId() - { - return $this->_photoId; - } - - /** - * Returns the URL generated for this query, based on it's current - * parameters. - * - * @return string a URL generated based on the state of this query - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getQueryUrl($incomingUri = '') - { - $uri = ''; - if (null !== $this->getPhotoId()) { - $uri .= '/photoid/'.$this->getPhotoId(); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('PhotoId cannot be null'); - } - $uri .= $incomingUri; - - return parent::getQueryUrl($uri); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/TagEntry.php b/packages/zend-gdata/library/Zend/Gdata/Photos/TagEntry.php deleted file mode 100644 index 7c187a0a5..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/TagEntry.php +++ /dev/null @@ -1,143 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Photos_TagEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Photos_TagEntry'; - - protected $_gphotoWeight; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - - $category = new Zend_Gdata_App_Extension_Category( - 'http://schemas.google.com/photos/2007#tag', - 'http://schemas.google.com/g/2005#kind'); - $this->setCategory([$category]); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_gphotoWeight) { - $element->appendChild($this->_gphotoWeight->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':weight': - $weight = new Zend_Gdata_Photos_Extension_Weight(); - $weight->transferFromDOM($child); - $this->_gphotoWeight = $weight; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:weight attribute. - * - * @return string|null the requested attribute - * - *@see setGphotoWeight - */ - public function getGphotoWeight() - { - return $this->_gphotoWeight; - } - - /** - * Set the value for this element's gphoto:weight attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_TagEntry the element being modified - */ - public function setGphotoWeight($value) - { - $this->_gphotoWeight = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/UserEntry.php b/packages/zend-gdata/library/Zend/Gdata/Photos/UserEntry.php deleted file mode 100644 index 27e707062..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/UserEntry.php +++ /dev/null @@ -1,383 +0,0 @@ - in the Google Data protocol. - * - * @category Zend - * - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Gdata_Photos_UserEntry extends Zend_Gdata_Entry -{ - protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry'; - - /** - * gphoto:nickname element. - * - * @var Zend_Gdata_Photos_Extension_Nickname - */ - protected $_gphotoNickname; - - /** - * gphoto:user element. - * - * @var Zend_Gdata_Photos_Extension_User - */ - protected $_gphotoUser; - - /** - * gphoto:thumbnail element. - * - * @var Zend_Gdata_Photos_Extension_Thumbnail - */ - protected $_gphotoThumbnail; - - /** - * gphoto:quotalimit element. - * - * @var Zend_Gdata_Photos_Extension_QuotaLimit - */ - protected $_gphotoQuotaLimit; - - /** - * gphoto:quotacurrent element. - * - * @var Zend_Gdata_Photos_Extension_QuotaCurrent - */ - protected $_gphotoQuotaCurrent; - - /** - * gphoto:maxPhotosPerAlbum element. - * - * @var Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum - */ - protected $_gphotoMaxPhotosPerAlbum; - - /** - * Create a new instance. - * - * @param DOMElement $element (optional) DOMElement from which this - * object should be constructed - */ - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - - $category = new Zend_Gdata_App_Extension_Category( - 'http://schemas.google.com/photos/2007#user', - 'http://schemas.google.com/g/2005#kind'); - $this->setCategory([$category]); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null !== $this->_gphotoNickname) { - $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoThumbnail) { - $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoUser) { - $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoQuotaCurrent) { - $element->appendChild($this->_gphotoQuotaCurrent->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoQuotaLimit) { - $element->appendChild($this->_gphotoQuotaLimit->getDOM($element->ownerDocument)); - } - if (null !== $this->_gphotoMaxPhotosPerAlbum) { - $element->appendChild($this->_gphotoMaxPhotosPerAlbum->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them as members of this entry based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':nickname': - $nickname = new Zend_Gdata_Photos_Extension_Nickname(); - $nickname->transferFromDOM($child); - $this->_gphotoNickname = $nickname; - break; - case $this->lookupNamespace('gphoto').':thumbnail': - $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail(); - $thumbnail->transferFromDOM($child); - $this->_gphotoThumbnail = $thumbnail; - break; - case $this->lookupNamespace('gphoto').':user': - $user = new Zend_Gdata_Photos_Extension_User(); - $user->transferFromDOM($child); - $this->_gphotoUser = $user; - break; - case $this->lookupNamespace('gphoto').':quotacurrent': - $quotaCurrent = new Zend_Gdata_Photos_Extension_QuotaCurrent(); - $quotaCurrent->transferFromDOM($child); - $this->_gphotoQuotaCurrent = $quotaCurrent; - break; - case $this->lookupNamespace('gphoto').':quotalimit': - $quotaLimit = new Zend_Gdata_Photos_Extension_QuotaLimit(); - $quotaLimit->transferFromDOM($child); - $this->_gphotoQuotaLimit = $quotaLimit; - break; - case $this->lookupNamespace('gphoto').':maxPhotosPerAlbum': - $maxPhotosPerAlbum = new Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum(); - $maxPhotosPerAlbum->transferFromDOM($child); - $this->_gphotoMaxPhotosPerAlbum = $maxPhotosPerAlbum; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Get the value for this element's gphoto:nickname attribute. - * - * @return Zend_Gdata_Photos_Extension_Nickname|null the requested attribute - * - *@see setGphotoNickname - */ - public function getGphotoNickname() - { - return $this->_gphotoNickname; - } - - /** - * Set the value for this element's gphoto:nickname attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserEntry the element being modified - */ - public function setGphotoNickname($value) - { - $this->_gphotoNickname = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:thumbnail attribute. - * - * @return Zend_Gdata_Photos_Extension_Thumbnail|null the requested attribute - * - * @see setGphotoThumbnail - */ - public function getGphotoThumbnail() - { - return $this->_gphotoThumbnail; - } - - /** - * Set the value for this element's gphoto:thumbnail attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserEntry the element being modified - */ - public function setGphotoThumbnail($value) - { - $this->_gphotoThumbnail = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:quotacurrent attribute. - * - * @return Zend_Gdata_Photos_Extension_QuotaCurrent|null the requested attribute - * - * @see setGphotoQuotaCurrent - */ - public function getGphotoQuotaCurrent() - { - return $this->_gphotoQuotaCurrent; - } - - /** - * Set the value for this element's gphoto:quotacurrent attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserEntry the element being modified - */ - public function setGphotoQuotaCurrent($value) - { - $this->_gphotoQuotaCurrent = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:quotalimit attribute. - * - * @return Zend_Gdata_Photos_Extension_QuotaLimit|null the requested attribute - * - * @see setGphotoQuotaLimit - */ - public function getGphotoQuotaLimit() - { - return $this->_gphotoQuotaLimit; - } - - /** - * Set the value for this element's gphoto:quotalimit attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserEntry the element being modified - */ - public function setGphotoQuotaLimit($value) - { - $this->_gphotoQuotaLimit = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:maxPhotosPerAlbum attribute. - * - * @return Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum|null the requested attribute - * - * @see setGphotoMaxPhotosPerAlbum - */ - public function getGphotoMaxPhotosPerAlbum() - { - return $this->_gphotoMaxPhotosPerAlbum; - } - - /** - * Set the value for this element's gphoto:maxPhotosPerAlbum attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserEntry the element being modified - */ - public function setGphotoMaxPhotosPerAlbum($value) - { - $this->_gphotoMaxPhotosPerAlbum = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:user attribute. - * - * @return Zend_Gdata_Photos_Extension_User|null the requested attribute - * - *@see setGphotoUser - */ - public function getGphotoUser() - { - return $this->_gphotoUser; - } - - /** - * Set the value for this element's gphoto:user attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserEntry the element being modified - */ - public function setGphotoUser($value) - { - $this->_gphotoUser = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/UserFeed.php b/packages/zend-gdata/library/Zend/Gdata/Photos/UserFeed.php deleted file mode 100644 index 91d507fa3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/UserFeed.php +++ /dev/null @@ -1,253 +0,0 @@ - 'Zend_Gdata_Photos_AlbumEntry', - 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', - 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', - 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry', - ]; - - public function __construct($element = null) - { - $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); - parent::__construct($element); - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gphoto').':user': - $user = new Zend_Gdata_Photos_Extension_User(); - $user->transferFromDOM($child); - $this->_gphotoUser = $user; - break; - case $this->lookupNamespace('gphoto').':nickname': - $nickname = new Zend_Gdata_Photos_Extension_Nickname(); - $nickname->transferFromDOM($child); - $this->_gphotoNickname = $nickname; - break; - case $this->lookupNamespace('gphoto').':thumbnail': - $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail(); - $thumbnail->transferFromDOM($child); - $this->_gphotoThumbnail = $thumbnail; - break; - case $this->lookupNamespace('atom').':entry': - $entryClassName = $this->_entryClassName; - $tmpEntry = new Zend_Gdata_App_Entry($child); - $categories = $tmpEntry->getCategory(); - foreach ($categories as $category) { - if (Zend_Gdata_Photos::KIND_PATH == $category->scheme - && '' != $this->_entryKindClassMapping[$category->term]) { - $entryClassName = $this->_entryKindClassMapping[$category->term]; - break; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); - } - } - - $newEntry = new $entryClassName($child); - $newEntry->setHttpClient($this->getHttpClient()); - $this->_entry[] = $newEntry; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_gphotoUser) { - $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoNickname) { - $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); - } - if (null != $this->_gphotoThumbnail) { - $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Get the value for this element's gphoto:user attribute. - * - * @return Zend_Gdata_Photos_Extension_User|null the requested attribute - * - *@see setGphotoUser - */ - public function getGphotoUser() - { - return $this->_gphotoUser; - } - - /** - * Set the value for this element's gphoto:user attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserFeed the element being modified - */ - public function setGphotoUser($value) - { - $this->_gphotoUser = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:nickname attribute. - * - * @return Zend_Gdata_Photos_Extension_Nickname|null the requested attribute - * - *@see setGphotoNickname - */ - public function getGphotoNickname() - { - return $this->_gphotoNickname; - } - - /** - * Set the value for this element's gphoto:nickname attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserFeed the element being modified - */ - public function setGphotoNickname($value) - { - $this->_gphotoNickname = $value; - - return $this; - } - - /** - * Get the value for this element's gphoto:thumbnail attribute. - * - * @return Zend_Gdata_Photos_Extension_Thumbnail|null the requested attribute - * - * @see setGphotoThumbnail - */ - public function getGphotoThumbnail() - { - return $this->_gphotoThumbnail; - } - - /** - * Set the value for this element's gphoto:thumbnail attribute. - * - * @param string $value the desired value for this attribute - * - * @return Zend_Gdata_Photos_UserFeed the element being modified - */ - public function setGphotoThumbnail($value) - { - $this->_gphotoThumbnail = $value; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Photos/UserQuery.php b/packages/zend-gdata/library/Zend/Gdata/Photos/UserQuery.php deleted file mode 100644 index 5374dea4a..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Photos/UserQuery.php +++ /dev/null @@ -1,363 +0,0 @@ -_projection = $value; - - return $this; - } - - /** - * Gets the format of data in returned in Atom feeds. - * - * @see setProjection - * - * @return string projection - */ - public function getProjection() - { - return $this->_projection; - } - - /** - * Set's the type of data returned in queries. Can be either - * 'feed' or 'entry'. Normally, 'feed' will be desired. Default is 'feed'. - * - * @param string $value - * - * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface - */ - public function setType($value) - { - $this->_type = $value; - - return $this; - } - - /** - * Gets the type of data in returned in queries. - * - * @see setType - * - * @return string type - */ - public function getType() - { - return $this->_type; - } - - /** - * Set the user to query for. When set, this user's feed will be - * returned. If not set or null, the default user's feed will be returned - * instead. - * - * @param string $value the user to retrieve, or null for the default - * user - */ - public function setUser($value) - { - if (null !== $value) { - $this->_user = $value; - } else { - $this->_user = Zend_Gdata_Photos::DEFAULT_USER; - } - } - - /** - * Get the user which is to be returned. - * - * @see setUser - * - * @return string the visibility to retrieve - */ - public function getUser() - { - return $this->_user; - } - - /** - * Set the visibility filter for entries returned. Only entries which - * match this value will be returned. If null or unset, the default - * value will be used instead. - * - * Valid values are 'all' (default), 'public', and 'private'. - * - * @param string $value the visibility to filter by, or null to use the - * default value - */ - public function setAccess($value) - { - if (null !== $value) { - $this->_params['access'] = $value; - } else { - unset($this->_params['access']); - } - } - - /** - * Get the visibility filter for entries returned. - * - * @see setAccess - * - * @return string the visibility to filter by, or null for the default - * user - */ - public function getAccess() - { - return $this->_params['access']; - } - - /** - * Set the tag for entries that are returned. Only entries which - * match this value will be returned. If null or unset, this filter will - * not be applied. - * - * See http://code.google.com/apis/picasaweb/reference.html#Parameters - * for a list of valid values. - * - * @param string $value the tag to filter by, or null if no - * filter is to be applied - */ - public function setTag($value) - { - if (null !== $value) { - $this->_params['tag'] = $value; - } else { - unset($this->_params['tag']); - } - } - - /** - * Get the tag filter for entries returned. - * - * @see setTag - * - * @return string the tag to filter by, or null if no filter - * is to be applied - */ - public function getTag() - { - return $this->_params['tag']; - } - - /** - * Set the kind of entries that are returned. Only entries which - * match this value will be returned. If null or unset, this filter will - * not be applied. - * - * See http://code.google.com/apis/picasaweb/reference.html#Parameters - * for a list of valid values. - * - * @param string $value the kind to filter by, or null if no - * filter is to be applied - */ - public function setKind($value) - { - if (null !== $value) { - $this->_params['kind'] = $value; - } else { - unset($this->_params['kind']); - } - } - - /** - * Get the kind of entries to be returned. - * - * @see setKind - * - * @return string the kind to filter by, or null if no filter - * is to be applied - */ - public function getKind() - { - return $this->_params['kind']; - } - - /** - * Set the maximum image size for entries returned. Only entries which - * match this value will be returned. If null or unset, this filter will - * not be applied. - * - * See http://code.google.com/apis/picasaweb/reference.html#Parameters - * for a list of valid values. - * - * @param string $value the image size to filter by, or null if no - * filter is to be applied - */ - public function setImgMax($value) - { - if (null !== $value) { - $this->_params['imgmax'] = $value; - } else { - unset($this->_params['imgmax']); - } - } - - /** - * Get the maximum image size filter for entries returned. - * - * @see setImgMax - * - * @return string the image size size to filter by, or null if no filter - * is to be applied - */ - public function getImgMax() - { - return $this->_params['imgmax']; - } - - /** - * Set the thumbnail size filter for entries returned. Only entries which - * match this value will be returned. If null or unset, this filter will - * not be applied. - * - * See http://code.google.com/apis/picasaweb/reference.html#Parameters - * for a list of valid values. - * - * @param string $value the thumbnail size to filter by, or null if no - * filter is to be applied - */ - public function setThumbsize($value) - { - if (null !== $value) { - $this->_params['thumbsize'] = $value; - } else { - unset($this->_params['thumbsize']); - } - } - - /** - * Get the thumbnail size filter for entries returned. - * - * @see setThumbsize - * - * @return string the thumbnail size to filter by, or null if no filter - * is to be applied - */ - public function getThumbsize() - { - return $this->_params['thumbsize']; - } - - /** - * Returns the URL generated for this query, based on it's current - * parameters. - * - * @return string a URL generated based on the state of this query - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function getQueryUrl($incomingUri = null) - { - $uri = Zend_Gdata_Photos::PICASA_BASE_URI; - - if (null !== $this->getType()) { - $uri .= '/'.$this->getType(); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Type must be feed or entry, not null'); - } - - if (null !== $this->getProjection()) { - $uri .= '/'.$this->getProjection(); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Projection must not be null'); - } - - if (null !== $this->getUser()) { - $uri .= '/user/'.$this->getUser(); - } else { - // Should never occur due to setter behavior - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('User must not be null'); - } - - $uri .= $incomingUri; - $uri .= $this->getQueryString(); - - return $uri; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Query.php b/packages/zend-gdata/library/Zend/Gdata/Query.php deleted file mode 100644 index 094a19221..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Query.php +++ /dev/null @@ -1,434 +0,0 @@ -_url = $url; - } - - /** - * @return string querystring - */ - public function getQueryString() - { - $queryArray = []; - foreach ($this->_params as $name => $value) { - if ('_' == substr((string) $name, 0, 1)) { - continue; - } - $queryArray[] = urlencode((string) $name).'='.urlencode((string) $value); - } - if (count($queryArray) > 0) { - return '?'.implode('&', $queryArray); - } else { - return ''; - } - } - - public function resetParameters() - { - $this->_params = []; - } - - /** - * @return string url - */ - public function getQueryUrl() - { - if (null == $this->_url) { - $url = $this->_defaultFeedUri; - } else { - $url = $this->_url; - } - if (null !== $this->getCategory()) { - $url .= '/-/'.$this->getCategory(); - } - $url .= $this->getQueryString(); - - return $url; - } - - /** - * @param string $name - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setParam($name, $value) - { - $this->_params[$name] = $value; - - return $this; - } - - /** - * @param string $name - */ - public function getParam($name) - { - return $this->_params[$name]; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setAlt($value) - { - if (null != $value) { - $this->_params['alt'] = $value; - } else { - unset($this->_params['alt']); - } - - return $this; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setMaxResults($value) - { - if (null != $value) { - $this->_params['max-results'] = $value; - } else { - unset($this->_params['max-results']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setQuery($value) - { - if (null != $value) { - $this->_params['q'] = $value; - } else { - unset($this->_params['q']); - } - - return $this; - } - - /** - * @param int $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setStartIndex($value) - { - if (null != $value) { - $this->_params['start-index'] = $value; - } else { - unset($this->_params['start-index']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setUpdatedMax($value) - { - if (null != $value) { - $this->_params['updated-max'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['updated-max']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setUpdatedMin($value) - { - if (null != $value) { - $this->_params['updated-min'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['updated-min']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setPublishedMax($value) - { - if (null !== $value) { - $this->_params['published-max'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['published-max']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setPublishedMin($value) - { - if (null != $value) { - $this->_params['published-min'] = Zend_Gdata_App_Util::formatTimestamp($value); - } else { - unset($this->_params['published-min']); - } - - return $this; - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setAuthor($value) - { - if (null != $value) { - $this->_params['author'] = $value; - } else { - unset($this->_params['author']); - } - - return $this; - } - - /** - * @return string rss or atom - */ - public function getAlt() - { - if (array_key_exists('alt', $this->_params)) { - return $this->_params['alt']; - } else { - return null; - } - } - - /** - * @return int maxResults - */ - public function getMaxResults() - { - if (array_key_exists('max-results', $this->_params)) { - return intval($this->_params['max-results']); - } else { - return null; - } - } - - /** - * @return string query - */ - public function getQuery() - { - if (array_key_exists('q', $this->_params)) { - return $this->_params['q']; - } else { - return null; - } - } - - /** - * @return int startIndex - */ - public function getStartIndex() - { - if (array_key_exists('start-index', $this->_params)) { - return intval($this->_params['start-index']); - } else { - return null; - } - } - - /** - * @return string updatedMax - */ - public function getUpdatedMax() - { - if (array_key_exists('updated-max', $this->_params)) { - return $this->_params['updated-max']; - } else { - return null; - } - } - - /** - * @return string updatedMin - */ - public function getUpdatedMin() - { - if (array_key_exists('updated-min', $this->_params)) { - return $this->_params['updated-min']; - } else { - return null; - } - } - - /** - * @return string publishedMax - */ - public function getPublishedMax() - { - if (array_key_exists('published-max', $this->_params)) { - return $this->_params['published-max']; - } else { - return null; - } - } - - /** - * @return string publishedMin - */ - public function getPublishedMin() - { - if (array_key_exists('published-min', $this->_params)) { - return $this->_params['published-min']; - } else { - return null; - } - } - - /** - * @return string author - */ - public function getAuthor() - { - if (array_key_exists('author', $this->_params)) { - return $this->_params['author']; - } else { - return null; - } - } - - /** - * @param string $value - * - * @return Zend_Gdata_Query Provides a fluent interface - */ - public function setCategory($value) - { - $this->_category = $value; - - return $this; - } - - /* - * @return string id - */ - public function getCategory() - { - return $this->_category; - } - - public function __get($name) - { - $method = 'get'.ucfirst($name); - if (method_exists($this, $method)) { - return call_user_func([&$this, $method]); - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Property '.$name.' does not exist'); - } - } - - public function __set($name, $val) - { - $method = 'set'.ucfirst($name); - if (method_exists($this, $method)) { - return call_user_func([&$this, $method], $val); - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('Property '.$name.' does not exist'); - } - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets.php deleted file mode 100644 index 5ebba5467..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets.php +++ /dev/null @@ -1,460 +0,0 @@ -registerPackage('Zend_Gdata_Spreadsheets'); - $this->registerPackage('Zend_Gdata_Spreadsheets_Extension'); - parent::__construct($client, $applicationId); - $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); - $this->_server = 'spreadsheets.google.com'; - } - - /** - * Gets a spreadsheet feed. - * - * @param mixed $location a DocumentQuery or a string URI specifying the feed location - * - * @return string|Zend_Gdata_App_Feed - */ - public function getSpreadsheetFeed($location = null) - { - if (null == $location) { - $uri = self::SPREADSHEETS_FEED_URI; - } elseif ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { - if (null == $location->getDocumentType()) { - $location->setDocumentType('spreadsheets'); - } - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_SpreadsheetFeed'); - } - - /** - * Gets a spreadsheet entry. - * - * @param string $location a DocumentQuery or a URI specifying the entry location - * - * @return string|Zend_Gdata_App_Entry - */ - public function getSpreadsheetEntry($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { - if (null == $location->getDocumentType()) { - $location->setDocumentType('spreadsheets'); - } - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_SpreadsheetEntry'); - } - - /** - * Gets a worksheet feed. - * - * @param mixed $location A DocumentQuery, SpreadsheetEntry, or a string URI - * - * @return string|Zend_Gdata_App_Feed The feed of worksheets - */ - public function getWorksheetFeed($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { - if (null == $location->getDocumentType()) { - $location->setDocumentType('worksheets'); - } - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry) { - $uri = $location->getLink(self::WORKSHEETS_FEED_LINK_URI)->href; - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_WorksheetFeed'); - } - - /** - * Gets a worksheet entry. - * - * @param string $location a DocumentQuery or a URI specifying the entry location - * - * @return string|Zend_Gdata_App_Entry - */ - public function GetWorksheetEntry($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { - if (null == $location->getDocumentType()) { - $location->setDocumentType('worksheets'); - } - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_WorksheetEntry'); - } - - /** - * Gets a cell feed. - * - * @param string $location a CellQuery, WorksheetEntry or a URI specifying the feed location - * - * @return string|Zend_Gdata_App_Feed - */ - public function getCellFeed($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_CellQuery) { - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Spreadsheets_WorksheetEntry) { - $uri = $location->getLink(self::CELL_FEED_LINK_URI)->href; - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_CellFeed'); - } - - /** - * Gets a cell entry. - * - * @param string $location a CellQuery or a URI specifying the entry location - * - * @return string|Zend_Gdata_App_Entry - */ - public function getCellEntry($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_CellQuery) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_CellEntry'); - } - - /** - * Gets a list feed. - * - * @param mixed $location a ListQuery, WorksheetEntry or string URI specifying the feed location - * - * @return string|Zend_Gdata_App_Feed - */ - public function getListFeed($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_ListQuery) { - $uri = $location->getQueryUrl(); - } elseif ($location instanceof Zend_Gdata_Spreadsheets_WorksheetEntry) { - $uri = $location->getLink(self::LIST_FEED_LINK_URI)->href; - } else { - $uri = $location; - } - - return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_ListFeed'); - } - - /** - * Gets a list entry. - * - * @param string $location a ListQuery or a URI specifying the entry location - * - * @return string|Zend_Gdata_App_Entry - */ - public function getListEntry($location) - { - if ($location instanceof Zend_Gdata_Spreadsheets_ListQuery) { - $uri = $location->getQueryUrl(); - } else { - $uri = $location; - } - - return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_ListEntry'); - } - - /** - * Updates an existing cell. - * - * @param int $row The row containing the cell to update - * @param int $col The column containing the cell to update - * @param int $inputValue The new value for the cell - * @param string $key The key for the spreadsheet to be updated - * @param string $wkshtId (optional) The worksheet to be updated - * - * @return Zend_Gdata_App_Entry the updated cell entry - */ - public function updateCell($row, $col, $inputValue, $key, $wkshtId = 'default') - { - $cell = 'R'.$row.'C'.$col; - - $query = new Zend_Gdata_Spreadsheets_CellQuery(); - $query->setSpreadsheetKey($key); - $query->setWorksheetId($wkshtId); - $query->setCellId($cell); - - $entry = $this->getCellEntry($query); - $entry->setCell(new Zend_Gdata_Spreadsheets_Extension_Cell(null, $row, $col, $inputValue)); - $response = $entry->save(); - - return $response; - } - - /** - * Inserts a new row with provided data. - * - * @param array $rowData An array of column header to row data - * @param string $key The key of the spreadsheet to modify - * @param string $wkshtId (optional) The worksheet to modify - * - * @return Zend_Gdata_App_Entry The inserted row - */ - public function insertRow($rowData, $key, $wkshtId = 'default') - { - $newEntry = new Zend_Gdata_Spreadsheets_ListEntry(); - $newCustomArr = []; - foreach ($rowData as $k => $v) { - $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); - $newCustom->setText($v)->setColumnName($k); - $newEntry->addCustom($newCustom); - } - - $query = new Zend_Gdata_Spreadsheets_ListQuery(); - $query->setSpreadsheetKey($key); - $query->setWorksheetId($wkshtId); - - $feed = $this->getListFeed($query); - $editLink = $feed->getLink('http://schemas.google.com/g/2005#post'); - - return $this->insertEntry($newEntry->saveXML(), $editLink->href, 'Zend_Gdata_Spreadsheets_ListEntry'); - } - - /** - * Updates an existing row with provided data. - * - * @param ListEntry $entry The row entry to update - * @param array $newRowData An array of column header to row data - */ - public function updateRow($entry, $newRowData) - { - $newCustomArr = []; - foreach ($newRowData as $k => $v) { - $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); - $newCustom->setText($v)->setColumnName($k); - $newCustomArr[] = $newCustom; - } - $entry->setCustom($newCustomArr); - - return $entry->save(); - } - - /** - * Deletes an existing row . - * - * @param ListEntry $entry The row to delete - */ - public function deleteRow($entry) - { - $entry->delete(); - } - - /** - * Returns the content of all rows as an associative array. - * - * @param mixed $location a ListQuery or string URI specifying the feed location - * - * @return array An array of rows. Each element of the array is an associative array of data - */ - public function getSpreadsheetListFeedContents($location) - { - $listFeed = $this->getListFeed($location); - $listFeed = $this->retrieveAllEntriesForFeed($listFeed); - $spreadsheetContents = []; - foreach ($listFeed as $listEntry) { - $rowContents = []; - $customArray = $listEntry->getCustom(); - foreach ($customArray as $custom) { - $rowContents[$custom->getColumnName()] = $custom->getText(); - } - $spreadsheetContents[] = $rowContents; - } - - return $spreadsheetContents; - } - - /** - * Returns the content of all cells as an associative array, indexed - * off the cell location (ie 'A1', 'D4', etc). Each element of - * the array is an associative array with a 'value' and a 'function'. - * Only non-empty cells are returned by default. 'range' is the - * value of the 'range' query parameter specified at: - * http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters. - * - * @param mixed $location a CellQuery, WorksheetEntry or a URL (w/o query string) specifying the feed location - * @param string $range The range of cells to retrieve - * @param bool $empty Whether to retrieve empty cells - * - * @return array An associative array of cells - */ - public function getSpreadsheetCellFeedContents($location, $range = null, $empty = false) - { - $cellQuery = null; - if ($location instanceof Zend_Gdata_Spreadsheets_CellQuery) { - $cellQuery = $location; - } elseif ($location instanceof Zend_Gdata_Spreadsheets_WorksheetEntry) { - $url = $location->getLink(self::CELL_FEED_LINK_URI)->href; - $cellQuery = new Zend_Gdata_Spreadsheets_CellQuery($url); - } else { - $url = $location; - $cellQuery = new Zend_Gdata_Spreadsheets_CellQuery($url); - } - - if (null != $range) { - $cellQuery->setRange($range); - } - $cellQuery->setReturnEmpty($empty); - - $cellFeed = $this->getCellFeed($cellQuery); - $cellFeed = $this->retrieveAllEntriesForFeed($cellFeed); - $spreadsheetContents = []; - foreach ($cellFeed as $cellEntry) { - $cellContents = []; - $cell = $cellEntry->getCell(); - $cellContents['formula'] = $cell->getInputValue(); - $cellContents['value'] = $cell->getText(); - $spreadsheetContents[$cellEntry->getTitle()->getText()] = $cellContents; - } - - return $spreadsheetContents; - } - - /** - * Alias for getSpreadsheetFeed. - * - * @param mixed $location a DocumentQuery or a string URI specifying the feed location - * - * @return string|Zend_Gdata_App_Feed - */ - public function getSpreadsheets($location = null) - { - return $this->getSpreadsheetFeed($location = null); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellEntry.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellEntry.php deleted file mode 100644 index 0543d4c25..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellEntry.php +++ /dev/null @@ -1,106 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_cell) { - $element->appendChild($this->_cell->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gs').':cell': - $cell = new Zend_Gdata_Spreadsheets_Extension_Cell(); - $cell->transferFromDOM($child); - $this->_cell = $cell; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Gets the Cell element of this Cell Entry. - * - * @return Zend_Gdata_Spreadsheets_Extension_Cell - */ - public function getCell() - { - return $this->_cell; - } - - /** - * Sets the Cell element of this Cell Entry. - * - * @param Zend_Gdata_Spreadsheets_Extension_Cell $cell - * - * @return Zend_Gdata_Spreadsheets_CellEntry - */ - public function setCell($cell) - { - $this->_cell = $cell; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellFeed.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellFeed.php deleted file mode 100644 index 49468d624..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellFeed.php +++ /dev/null @@ -1,162 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->rowCount) { - $element->appendChild($this->_rowCount->getDOM($element->ownerDocument)); - } - if (null != $this->colCount) { - $element->appendChild($this->_colCount->getDOM($element->ownerDocument)); - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gs').':rowCount': - $rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount(); - $rowCount->transferFromDOM($child); - $this->_rowCount = $rowCount; - break; - case $this->lookupNamespace('gs').':colCount': - $colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount(); - $colCount->transferFromDOM($child); - $this->_colCount = $colCount; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Gets the row count for this feed. - * - * @return Zend_Gdata_Spreadsheets_Extension_RowCount|null the row count for the feed - */ - public function getRowCount() - { - return $this->_rowCount; - } - - /** - * Gets the column count for this feed. - * - * @return Zend_Gdata_Spreadsheets_Extension_ColCount|null the column count for the feed - */ - public function getColumnCount() - { - return $this->_colCount; - } - - /** - * Sets the row count for this feed. - * - * @param string $rowCount the new row count for the feed - */ - public function setRowCount($rowCount) - { - $this->_rowCount = $rowCount; - - return $this; - } - - /** - * Sets the column count for this feed. - * - * @param string $colCount the new column count for the feed - */ - public function setColumnCount($colCount) - { - $this->_colCount = $colCount; - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellQuery.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellQuery.php deleted file mode 100644 index 07e398c61..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/CellQuery.php +++ /dev/null @@ -1,436 +0,0 @@ -_spreadsheetKey = $value; - - return $this; - } - - /** - * Gets the spreadsheet key for this query. - * - * @return string|null spreadsheet key - */ - public function getSpreadsheetKey() - { - return $this->_spreadsheetKey; - } - - /** - * Sets the worksheet id for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setWorksheetId($value) - { - $this->_worksheetId = $value; - - return $this; - } - - /** - * Gets the worksheet id for this query. - * - * @return string worksheet id - */ - public function getWorksheetId() - { - return $this->_worksheetId; - } - - /** - * Sets the cell id for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setCellId($value) - { - $this->_cellId = $value; - - return $this; - } - - /** - * Gets the cell id for this query. - * - * @return string|null cell id - */ - public function getCellId() - { - return $this->_cellId; - } - - /** - * Sets the projection for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setProjection($value) - { - $this->_projection = $value; - - return $this; - } - - /** - * Sets the visibility for this query. - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setVisibility($value) - { - $this->_visibility = $value; - - return $this; - } - - /** - * Gets the projection for this query. - * - * @return string projection - */ - public function getProjection() - { - return $this->_projection; - } - - /** - * Gets the visibility for this query. - * - * @return string visibility - */ - public function getVisibility() - { - return $this->_visibility; - } - - /** - * Sets the min-row attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setMinRow($value) - { - if (null != $value) { - $this->_params['min-row'] = $value; - } else { - unset($this->_params['min-row']); - } - - return $this; - } - - /** - * Gets the min-row attribute for this query. - * - * @return string min-row - */ - public function getMinRow() - { - if (array_key_exists('min-row', $this->_params)) { - return $this->_params['min-row']; - } else { - return null; - } - } - - /** - * Sets the max-row attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setMaxRow($value) - { - if (null != $value) { - $this->_params['max-row'] = $value; - } else { - unset($this->_params['max-row']); - } - - return $this; - } - - /** - * Gets the max-row attribute for this query. - * - * @return string max-row - */ - public function getMaxRow() - { - if (array_key_exists('max-row', $this->_params)) { - return $this->_params['max-row']; - } else { - return null; - } - } - - /** - * Sets the min-col attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setMinCol($value) - { - if (null != $value) { - $this->_params['min-col'] = $value; - } else { - unset($this->_params['min-col']); - } - - return $this; - } - - /** - * Gets the min-col attribute for this query. - * - * @return string min-col - */ - public function getMinCol() - { - if (array_key_exists('min-col', $this->_params)) { - return $this->_params['min-col']; - } else { - return null; - } - } - - /** - * Sets the max-col attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setMaxCol($value) - { - if (null != $value) { - $this->_params['max-col'] = $value; - } else { - unset($this->_params['max-col']); - } - - return $this; - } - - /** - * Gets the max-col attribute for this query. - * - * @return string max-col - */ - public function getMaxCol() - { - if (array_key_exists('max-col', $this->_params)) { - return $this->_params['max-col']; - } else { - return null; - } - } - - /** - * Sets the range attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setRange($value) - { - if (null != $value) { - $this->_params['range'] = $value; - } else { - unset($this->_params['range']); - } - - return $this; - } - - /** - * Gets the range attribute for this query. - * - * @return string range - */ - public function getRange() - { - if (array_key_exists('range', $this->_params)) { - return $this->_params['range']; - } else { - return null; - } - } - - /** - * Sets the return-empty attribute for this query. - * - * @param mixed $value String or bool value for whether to return empty cells - * - * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface - */ - public function setReturnEmpty($value) - { - if (is_bool($value)) { - $this->_params['return-empty'] = ($value ? 'true' : 'false'); - } elseif (null != $value) { - $this->_params['return-empty'] = $value; - } else { - unset($this->_params['return-empty']); - } - - return $this; - } - - /** - * Gets the return-empty attribute for this query. - * - * @return string return-empty - */ - public function getReturnEmpty() - { - if (array_key_exists('return-empty', $this->_params)) { - return $this->_params['return-empty']; - } else { - return null; - } - } - - /** - * Gets the full query URL for this query. - * - * @return string url - */ - public function getQueryUrl() - { - if (null == $this->_url) { - $uri = $this->_defaultFeedUri; - - if (null != $this->_spreadsheetKey) { - $uri .= '/'.$this->_spreadsheetKey; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for cell queries.'); - } - - if (null != $this->_worksheetId) { - $uri .= '/'.$this->_worksheetId; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A worksheet id must be provided for cell queries.'); - } - - if (null != $this->_visibility) { - $uri .= '/'.$this->_visibility; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A visibility must be provided for cell queries.'); - } - - if (null != $this->_projection) { - $uri .= '/'.$this->_projection; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A projection must be provided for cell queries.'); - } - - if (null != $this->_cellId) { - $uri .= '/'.$this->_cellId; - } - } else { - $uri = $this->_url; - } - - $uri .= $this->getQueryString(); - - return $uri; - } - - /** - * Gets the attribute query string for this query. - * - * @return string query string - */ - public function getQueryString() - { - return parent::getQueryString(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/DocumentQuery.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/DocumentQuery.php deleted file mode 100644 index e7e221d9e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/DocumentQuery.php +++ /dev/null @@ -1,314 +0,0 @@ -_spreadsheetKey = $value; - - return $this; - } - - /** - * Gets the spreadsheet key for this query. - * - * @return string|null spreadsheet key - */ - public function getSpreadsheetKey() - { - return $this->_spreadsheetKey; - } - - /** - * Sets the worksheet id for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface - */ - public function setWorksheetId($value) - { - $this->_worksheetId = $value; - - return $this; - } - - /** - * Gets the worksheet id for this query. - * - * @return string|null worksheet id - */ - public function getWorksheetId() - { - return $this->_worksheetId; - } - - /** - * Sets the document type for this query. - * - * @param string $value spreadsheets or worksheets - * - * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface - */ - public function setDocumentType($value) - { - $this->_documentType = $value; - - return $this; - } - - /** - * Gets the document type for this query. - * - * @return string document type - */ - public function getDocumentType() - { - return $this->_documentType; - } - - /** - * Sets the projection for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface - */ - public function setProjection($value) - { - $this->_projection = $value; - - return $this; - } - - /** - * Sets the visibility for this query. - * - * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface - */ - public function setVisibility($value) - { - $this->_visibility = $value; - - return $this; - } - - /** - * Gets the projection for this query. - * - * @return string projection - */ - public function getProjection() - { - return $this->_projection; - } - - /** - * Gets the visibility for this query. - * - * @return string visibility - */ - public function getVisibility() - { - return $this->_visibility; - } - - /** - * Sets the title attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface - */ - public function setTitle($value) - { - if (null != $value) { - $this->_params['title'] = $value; - } else { - unset($this->_params['title']); - } - - return $this; - } - - /** - * Sets the title-exact attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface - */ - public function setTitleExact($value) - { - if (null != $value) { - $this->_params['title-exact'] = $value; - } else { - unset($this->_params['title-exact']); - } - - return $this; - } - - /** - * Gets the title attribute for this query. - * - * @return string title - */ - public function getTitle() - { - if (array_key_exists('title', $this->_params)) { - return $this->_params['title']; - } else { - return null; - } - } - - /** - * Gets the title-exact attribute for this query. - * - * @return string title-exact - */ - public function getTitleExact() - { - if (array_key_exists('title-exact', $this->_params)) { - return $this->_params['title-exact']; - } else { - return null; - } - } - - private function appendVisibilityProjection() - { - $uri = ''; - - if (null != $this->_visibility) { - $uri .= '/'.$this->_visibility; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A visibility must be provided for document queries.'); - } - - if (null != $this->_projection) { - $uri .= '/'.$this->_projection; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A projection must be provided for document queries.'); - } - - return $uri; - } - - /** - * Gets the full query URL for this query. - * - * @return string url - */ - public function getQueryUrl() - { - $uri = $this->_defaultFeedUri; - - if (null != $this->_documentType) { - $uri .= '/'.$this->_documentType; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A document type must be provided for document queries.'); - } - - if ('spreadsheets' == $this->_documentType) { - $uri .= $this->appendVisibilityProjection(); - if (null != $this->_spreadsheetKey) { - $uri .= '/'.$this->_spreadsheetKey; - } - } elseif ('worksheets' == $this->_documentType) { - if (null != $this->_spreadsheetKey) { - $uri .= '/'.$this->_spreadsheetKey; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for worksheet document queries.'); - } - $uri .= $this->appendVisibilityProjection(); - if (null != $this->_worksheetId) { - $uri .= '/'.$this->_worksheetId; - } - } - - $uri .= $this->getQueryString(); - - return $uri; - } - - /** - * Gets the attribute query string for this query. - * - * @return string query string - */ - public function getQueryString() - { - return parent::getQueryString(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/Cell.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/Cell.php deleted file mode 100644 index 75a8b279d..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/Cell.php +++ /dev/null @@ -1,214 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct(); - $this->_text = $text; - $this->_row = $row; - $this->_col = $col; - $this->_inputValue = $inputValue; - $this->_numericValue = $numericValue; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - $element->setAttribute('row', $this->_row); - $element->setAttribute('col', $this->_col); - if ($this->_inputValue) { - $element->setAttribute('inputValue', $this->_inputValue); - } - if ($this->_numericValue) { - $element->setAttribute('numericValue', $this->_numericValue); - } - - return $element; - } - - protected function takeAttributeFromDOM($attribute) - { - switch ($attribute->localName) { - case 'row': - $this->_row = $attribute->nodeValue; - break; - case 'col': - $this->_col = $attribute->nodeValue; - break; - case 'inputValue': - $this->_inputValue = $attribute->nodeValue; - break; - case 'numericValue': - $this->_numericValue = $attribute->nodeValue; - break; - default: - parent::takeAttributeFromDOM($attribute); - } - } - - /** - * Gets the row attribute of the Cell element. - * - * @return string row of the Cell - */ - public function getRow() - { - return $this->_row; - } - - /** - * Gets the column attribute of the Cell element. - * - * @return string column of the Cell - */ - public function getColumn() - { - return $this->_col; - } - - /** - * Gets the input value attribute of the Cell element. - * - * @return string input value of the Cell - */ - public function getInputValue() - { - return $this->_inputValue; - } - - /** - * Gets the numeric value attribute of the Cell element. - * - * @return string numeric value of the Cell - */ - public function getNumericValue() - { - return $this->_numericValue; - } - - /** - * Sets the row attribute of the Cell element. - * - * @param string $row new row of the Cell - */ - public function setRow($row) - { - $this->_row = $row; - - return $this; - } - - /** - * Sets the column attribute of the Cell element. - * - * @param string $col new column of the Cell - */ - public function setColumn($col) - { - $this->_col = $col; - - return $this; - } - - /** - * Sets the input value attribute of the Cell element. - * - * @param string $inputValue new input value of the Cell - */ - public function setInputValue($inputValue) - { - $this->_inputValue = $inputValue; - - return $this; - } - - /** - * Sets the numeric value attribute of the Cell element. - * - * @param string $numericValue new numeric value of the Cell - */ - public function setNumericValue($numericValue) - { - $this->_numericValue = $numericValue; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/ColCount.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/ColCount.php deleted file mode 100644 index 16c28ac0e..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/ColCount.php +++ /dev/null @@ -1,57 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct(); - $this->_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/Custom.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/Custom.php deleted file mode 100644 index 294397b7c..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/Custom.php +++ /dev/null @@ -1,102 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct(); - $this->_text = $value; - $this->_rootElement = $column; - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - - return $element; - } - - /** - * Transfers each child and attribute into member variables. - * This is called when XML is received over the wire and the data - * model needs to be built to represent this XML. - * - * @param DOMNode $node The DOMNode that represents this object's data - */ - public function transferFromDOM($node) - { - parent::transferFromDOM($node); - $this->_rootElement = $node->localName; - } - - /** - * Sets the column/tag name of the element. - * - * @param string $column the new column name - */ - public function setColumnName($column) - { - $this->_rootElement = $column; - - return $this; - } - - /** - * Gets the column name of the element. - * - * @return string the column name - */ - public function getColumnName() - { - return $this->_rootElement; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/RowCount.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/RowCount.php deleted file mode 100644 index 635254d5b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/Extension/RowCount.php +++ /dev/null @@ -1,57 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct(); - $this->_text = $text; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListEntry.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListEntry.php deleted file mode 100644 index 2a990ba47..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListEntry.php +++ /dev/null @@ -1,224 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } - - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (!empty($this->_custom)) { - foreach ($this->_custom as $custom) { - $element->appendChild($custom->getDOM($element->ownerDocument)); - } - } - - return $element; - } - - protected function takeChildFromDOM($child) - { - switch ($child->namespaceURI) { - case $this->lookupNamespace('gsx'): - $custom = new Zend_Gdata_Spreadsheets_Extension_Custom($child->localName); - $custom->transferFromDOM($child); - $this->addCustom($custom); - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Gets the row elements contained by this list entry. - * - * @return array The custom row elements in this list entry - */ - public function getCustom() - { - return $this->_custom; - } - - /** - * Gets a single row element contained by this list entry using its name. - * - * @param string $name The name of a custom element to return. If null - * or not defined, an array containing all custom elements - * indexed by name will be returned. - * - * @return mixed If a name is specified, the - * Zend_Gdata_Spreadsheets_Extension_Custom element requested, - * is returned or null if not found. Otherwise, an array of all - * Zend_Gdata_Spreadsheets_Extension_Custom elements is returned - * indexed by name. - */ - public function getCustomByName($name = null) - { - if (null === $name) { - return $this->_customByName; - } else { - if (array_key_exists($name, $this->customByName)) { - return $this->_customByName[$name]; - } else { - return null; - } - } - } - - /** - * Sets the row elements contained by this list entry. If any - * custom row elements were previously stored, they will be overwritten. - * - * @param array $custom the custom row elements to be contained in this - * list entry - * - * @return Zend_Gdata_Spreadsheets_ListEntry provides a fluent interface - */ - public function setCustom($custom) - { - $this->_custom = []; - foreach ($custom as $c) { - $this->addCustom($c); - } - - return $this; - } - - /** - * Add an individual custom row element to this list entry. - * - * @param Zend_Gdata_Spreadsheets_Extension_Custom $custom the custom - * element to be added - * - * @return Zend_Gdata_Spreadsheets_ListEntry provides a fluent interface - */ - public function addCustom($custom) - { - $this->_custom[] = $custom; - $this->_customByName[$custom->getColumnName()] = $custom; - - return $this; - } - - /** - * Remove an individual row element from this list entry by index. This - * will cause the array to be re-indexed. - * - * @param int $index the index of the custom element to be deleted - * - * @return Zend_Gdata_Spreadsheets_ListEntry provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function removeCustom($index) - { - if (array_key_exists($index, $this->_custom)) { - $element = $this->_custom[$index]; - // Remove element - unset($this->_custom[$index]); - // Re-index the array - $this->_custom = array_values($this->_custom); - // Be sure to delete form both arrays! - $key = array_search($element, $this->_customByName); - unset($this->_customByName[$key]); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Element does not exist.'); - } - - return $this; - } - - /** - * Remove an individual row element from this list entry by name. - * - * @param string $name the name of the custom element to be deleted - * - * @return Zend_Gdata_Spreadsheets_ListEntry provides a fluent interface - * - * @throws Zend_Gdata_App_InvalidArgumentException - */ - public function removeCustomByName($name) - { - if (array_key_exists($name, $this->_customByName)) { - $element = $this->_customByName[$name]; - // Remove element - unset($this->_customByName[$name]); - // Be sure to delete from both arrays! - $key = array_search($element, $this->_custom); - unset($this->_custom[$key]); - } else { - // require_once 'Zend/Gdata/App/InvalidArgumentException.php'; - throw new Zend_Gdata_App_InvalidArgumentException('Element does not exist.'); - } - - return $this; - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListFeed.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListFeed.php deleted file mode 100644 index e11550d48..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListFeed.php +++ /dev/null @@ -1,61 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListQuery.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListQuery.php deleted file mode 100644 index c71ccca8b..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/ListQuery.php +++ /dev/null @@ -1,334 +0,0 @@ -_spreadsheetKey = $value; - - return $this; - } - - /** - * Gets the spreadsheet key for the query. - * - * @return string|null spreadsheet key - */ - public function getSpreadsheetKey() - { - return $this->_spreadsheetKey; - } - - /** - * Sets the worksheet id for the query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setWorksheetId($value) - { - $this->_worksheetId = $value; - - return $this; - } - - /** - * Gets the worksheet id for the query. - * - * @return string worksheet id - */ - public function getWorksheetId() - { - return $this->_worksheetId; - } - - /** - * Sets the row id for the query. - * - * @param string $value row id - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setRowId($value) - { - $this->_rowId = $value; - - return $this; - } - - /** - * Gets the row id for the query. - * - * @return string|null row id - */ - public function getRowId() - { - return $this->_rowId; - } - - /** - * Sets the projection for the query. - * - * @param string $value Projection - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setProjection($value) - { - $this->_projection = $value; - - return $this; - } - - /** - * Sets the visibility for this query. - * - * @param string $value visibility - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setVisibility($value) - { - $this->_visibility = $value; - - return $this; - } - - /** - * Gets the projection for this query. - * - * @return string projection - */ - public function getProjection() - { - return $this->_projection; - } - - /** - * Gets the visibility for this query. - * - * @return string visibility - */ - public function getVisibility() - { - return $this->_visibility; - } - - /** - * Sets the spreadsheet key for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setSpreadsheetQuery($value) - { - if (null != $value) { - $this->_params['sq'] = $value; - } else { - unset($this->_params['sq']); - } - - return $this; - } - - /** - * Gets the spreadsheet key for this query. - * - * @return string spreadsheet query - */ - public function getSpreadsheetQuery() - { - if (array_key_exists('sq', $this->_params)) { - return $this->_params['sq']; - } else { - return null; - } - } - - /** - * Sets the orderby attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setOrderBy($value) - { - if (null != $value) { - $this->_params['orderby'] = $value; - } else { - unset($this->_params['orderby']); - } - - return $this; - } - - /** - * Gets the orderby attribute for this query. - * - * @return string orderby - */ - public function getOrderBy() - { - if (array_key_exists('orderby', $this->_params)) { - return $this->_params['orderby']; - } else { - return null; - } - } - - /** - * Sets the reverse attribute for this query. - * - * @param string $value - * - * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface - */ - public function setReverse($value) - { - if (null != $value) { - $this->_params['reverse'] = $value; - } else { - unset($this->_params['reverse']); - } - - return $this; - } - - /** - * Gets the reverse attribute for this query. - * - * @return string reverse - */ - public function getReverse() - { - if (array_key_exists('reverse', $this->_params)) { - return $this->_params['reverse']; - } else { - return null; - } - } - - /** - * Gets the full query URL for this query. - * - * @return string url - */ - public function getQueryUrl() - { - $uri = $this->_defaultFeedUri; - - if (null != $this->_spreadsheetKey) { - $uri .= '/'.$this->_spreadsheetKey; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for list queries.'); - } - - if (null != $this->_worksheetId) { - $uri .= '/'.$this->_worksheetId; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A worksheet id must be provided for list queries.'); - } - - if (null != $this->_visibility) { - $uri .= '/'.$this->_visibility; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A visibility must be provided for list queries.'); - } - - if (null != $this->_projection) { - $uri .= '/'.$this->_projection; - } else { - // require_once 'Zend/Gdata/App/Exception.php'; - throw new Zend_Gdata_App_Exception('A projection must be provided for list queries.'); - } - - if (null != $this->_rowId) { - $uri .= '/'.$this->_rowId; - } - - $uri .= $this->getQueryString(); - - return $uri; - } - - /** - * Gets the attribute query string for this query. - * - * @return string query string - */ - public function getQueryString() - { - return parent::getQueryString(); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/SpreadsheetEntry.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/SpreadsheetEntry.php deleted file mode 100644 index 9ad3363c3..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/SpreadsheetEntry.php +++ /dev/null @@ -1,63 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } - - /** - * Returns the worksheets in this spreadsheet. - * - * @return string|Zend_Gdata_App_Feed The worksheets - */ - public function getWorksheets() - { - $service = new Zend_Gdata_Spreadsheets($this->getHttpClient()); - - return $service->getWorksheetFeed($this); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/SpreadsheetFeed.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/SpreadsheetFeed.php deleted file mode 100644 index 806154d89..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/SpreadsheetFeed.php +++ /dev/null @@ -1,61 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/WorksheetEntry.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/WorksheetEntry.php deleted file mode 100644 index c76aef1aa..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/WorksheetEntry.php +++ /dev/null @@ -1,190 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } - - /** - * Retrieves a DOMElement which corresponds to this element and all - * child properties. This is used to build an entry back into a DOM - * and eventually XML text for sending to the server upon updates, or - * for application storage/persistence. - * - * @param DOMDocument $doc The DOMDocument used to construct DOMElements - * - * @return DOMElement the DOMElement representing this element and all - * child properties - */ - public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) - { - $element = parent::getDOM($doc, $majorVersion, $minorVersion); - if (null != $this->_rowCount) { - $element->appendChild($this->_rowCount->getDOM($element->ownerDocument)); - } - if (null != $this->_colCount) { - $element->appendChild($this->_colCount->getDOM($element->ownerDocument)); - } - - return $element; - } - - /** - * Creates individual Entry objects of the appropriate type and - * stores them in the $_entry array based upon DOM data. - * - * @param DOMNode $child The DOMNode to process - */ - protected function takeChildFromDOM($child) - { - $absoluteNodeName = $child->namespaceURI.':'.$child->localName; - switch ($absoluteNodeName) { - case $this->lookupNamespace('gs').':rowCount': - $rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount(); - $rowCount->transferFromDOM($child); - $this->_rowCount = $rowCount; - break; - case $this->lookupNamespace('gs').':colCount': - $colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount(); - $colCount->transferFromDOM($child); - $this->_colCount = $colCount; - break; - default: - parent::takeChildFromDOM($child); - break; - } - } - - /** - * Gets the row count for this entry. - * - * @return string|null the row count for the entry - */ - public function getRowCount() - { - return $this->_rowCount; - } - - /** - * Gets the column count for this entry. - * - * @return string|null the column count for the entry - */ - public function getColumnCount() - { - return $this->_colCount; - } - - /** - * Sets the row count for this entry. - * - * @param string $rowCount the new row count for the entry - */ - public function setRowCount($rowCount) - { - $this->_rowCount = $rowCount; - - return $this; - } - - /** - * Sets the column count for this entry. - * - * @param string $colCount the new column count for the entry - */ - public function setColumnCount($colCount) - { - $this->_colCount = $colCount; - - return $this; - } - - /** - * Returns the content of all rows as an associative array. - * - * @return array An array of rows. Each element of the array is an associative array of data - */ - public function getContentsAsRows() - { - $service = new Zend_Gdata_Spreadsheets($this->getHttpClient()); - - return $service->getSpreadsheetListFeedContents($this); - } - - /** - * Returns the content of all cells as an associative array, indexed - * off the cell location (ie 'A1', 'D4', etc). Each element of - * the array is an associative array with a 'value' and a 'function'. - * Only non-empty cells are returned by default. 'range' is the - * value of the 'range' query parameter specified at: - * http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters. - * - * @param string $range The range of cells to retrieve - * @param bool $empty Whether to retrieve empty cells - * - * @return array An associative array of cells - */ - public function getContentsAsCells($range = null, $empty = false) - { - $service = new Zend_Gdata_Spreadsheets($this->getHttpClient()); - - return $service->getSpreadsheetCellFeedContents($this, $range, $empty); - } -} diff --git a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/WorksheetFeed.php b/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/WorksheetFeed.php deleted file mode 100644 index c61209d65..000000000 --- a/packages/zend-gdata/library/Zend/Gdata/Spreadsheets/WorksheetFeed.php +++ /dev/null @@ -1,61 +0,0 @@ -registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); - parent::__construct($element); - } - - /** - * The classname for individual feed elements. - * - * @var string - */ - protected $_entryClassName = 'Zend_Gdata_Spreadsheets_WorksheetEntry'; - - /** - * The classname for the feed. - * - * @var string - */ - protected $_feedClassName = 'Zend_Gdata_Spreadsheets_WorksheetFeed'; -} diff --git a/packages/zend-tool/LICENSE.txt b/packages/zend-tool/LICENSE.txt deleted file mode 100644 index 6eab5aa14..000000000 --- a/packages/zend-tool/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2005-2015, Zend Technologies USA, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of Zend Technologies USA, Inc. nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/zend-tool/README.md b/packages/zend-tool/README.md deleted file mode 100644 index 54488a754..000000000 --- a/packages/zend-tool/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# zend-tool (Zend Framework 1) - -This package is a part of the Zend Framework 1. Each component was separated and put into its own composer package. -**PHP 5.3-8.0** compatible. - -- [Report issues](https://github.com/zf1s/zf1/issues) and - [send Pull Requests](https://github.com/zf1s/zf1/pulls) - in the [main repository](https://github.com/zf1s/zf1) -- This package can also be found at [Packagist](http://packagist.org/packages/zf1s). - -## Installation - -``` -composer require zf1s/zend-tool -``` - -## Resources - -- [Main Repository](https://github.com/zf1s/zf1) -- [Original documentation](https://framework.zend.com/manual/1.12/en/manual.html) -- [Changelog](https://github.com/zf1s/zf1/blob/master/CHANGELOG.md) diff --git a/packages/zend-tool/bin/zf.php b/packages/zend-tool/bin/zf.php deleted file mode 100644 index 6f9ff5965..000000000 --- a/packages/zend-tool/bin/zf.php +++ /dev/null @@ -1,619 +0,0 @@ -bootstrap(); - $zf->run(); - } - - /** - * bootstrap(). - * - * @return void - */ - public function bootstrap() - { - // detect settings - $this->_mode = $this->_detectMode(); - $this->_homeDirectory = $this->_detectHomeDirectory(); - $this->_storageDirectory = $this->_detectStorageDirectory(); - $this->_configFile = $this->_detectConfigFile(); - - // setup - $this->_setupPHPRuntime(); - $this->_setupToolRuntime(); - } - - /** - * run(). - * - * @return ZF - */ - public function run() - { - switch ($this->_mode) { - case 'runError': - $this->_runError(); - $this->_runInfo(); - break; - case 'runSetup': - if (false === $this->_runSetup()) { - $this->_runInfo(); - } - break; - case 'runInfo': - $this->_runInfo(); - break; - case 'runTool': - default: - $this->_runTool(); - break; - } - - return $this; - } - - /** - * _detectMode(). - * - * @return string - */ - protected function _detectMode() - { - $arguments = $_SERVER['argv']; - - $mode = 'runTool'; - - if (!isset($arguments[0])) { - return $mode; - } - - if ($arguments[0] == $_SERVER['PHP_SELF']) { - $this->_executable = array_shift($arguments); - } - - if (!isset($arguments[0])) { - return $mode; - } - - if ('--setup' == $arguments[0]) { - $mode = 'runSetup'; - } elseif ('--info' == $arguments[0]) { - $mode = 'runInfo'; - } - - return $mode; - } - - /** - * _detectHomeDirectory() - detect the home directory in a variety of different places. - * - * @param bool $mustExist Should the returned value already exist in the file system - * @param bool $returnMessages Should it log messages for output later - * - * @return string - */ - protected function _detectHomeDirectory($mustExist = true, $returnMessages = true) - { - $homeDirectory = null; - - $homeDirectory = getenv('ZF_HOME'); // check env var ZF_HOME - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable ZF_HOME with value '.$homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at '.$homeDirectory, $returnMessages); - } - } - - $homeDirectory = getenv('HOME'); // HOME environment variable - - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable HOME with value '.$homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at '.$homeDirectory, $returnMessages); - } - } - - $homeDirectory = getenv('HOMEPATH'); - - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable HOMEPATH with value '.$homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at '.$homeDirectory, $returnMessages); - } - } - - $homeDirectory = getenv('USERPROFILE'); - - if ($homeDirectory) { - $this->_logMessage('Home directory found in environment variable USERPROFILE with value '.$homeDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $homeDirectory))) { - return $homeDirectory; - } else { - $this->_logMessage('Home directory does not exist at '.$homeDirectory, $returnMessages); - } - } - - return false; - } - - /** - * _detectStorageDirectory() - Detect where the storage directory is from a variaty of possiblities. - * - * @param bool $mustExist Should the returned value already exist in the file system - * @param bool $returnMessages Should it log messages for output later - * - * @return string - */ - protected function _detectStorageDirectory($mustExist = true, $returnMessages = true) - { - $storageDirectory = false; - - $storageDirectory = getenv('ZF_STORAGE_DIR'); - if ($storageDirectory) { - $this->_logMessage('Storage directory path found in environment variable ZF_STORAGE_DIR with value '.$storageDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $storageDirectory))) { - return $storageDirectory; - } else { - $this->_logMessage('Storage directory does not exist at '.$storageDirectory, $returnMessages); - } - } - - $homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false); - - if ($homeDirectory) { - $storageDirectory = $homeDirectory.'/.zf/'; - $this->_logMessage('Storage directory assumed in home directory at location '.$storageDirectory, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $storageDirectory))) { - return $storageDirectory; - } else { - $this->_logMessage('Storage directory does not exist at '.$storageDirectory, $returnMessages); - } - } - - return false; - } - - /** - * _detectConfigFile() - Detect config file location from a variety of possibilities. - * - * @param bool $mustExist Should the returned value already exist in the file system - * @param bool $returnMessages Should it log messages for output later - * - * @return string - */ - protected function _detectConfigFile($mustExist = true, $returnMessages = true) - { - $configFile = null; - - $configFile = getenv('ZF_CONFIG_FILE'); - if ($configFile) { - $this->_logMessage('Config file found environment variable ZF_CONFIG_FILE at '.$configFile, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $configFile))) { - return $configFile; - } else { - $this->_logMessage('Config file does not exist at '.$configFile, $returnMessages); - } - } - - $homeDirectory = ($this->_homeDirectory) ? $this->_homeDirectory : $this->_detectHomeDirectory(true, false); - if ($homeDirectory) { - $configFile = $homeDirectory.'/.zf.ini'; - $this->_logMessage('Config file assumed in home directory at location '.$configFile, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $configFile))) { - return $configFile; - } else { - $this->_logMessage('Config file does not exist at '.$configFile, $returnMessages); - } - } - - $storageDirectory = ($this->_storageDirectory) ? $this->_storageDirectory : $this->_detectStorageDirectory(true, false); - if ($storageDirectory) { - $configFile = $storageDirectory.'/zf.ini'; - $this->_logMessage('Config file assumed in storage directory at location '.$configFile, $returnMessages); - if (!$mustExist || ($mustExist && file_exists((string) $configFile))) { - return $configFile; - } else { - $this->_logMessage('Config file does not exist at '.$configFile, $returnMessages); - } - } - - return false; - } - - /** - * _setupPHPRuntime() - parse the config file if it exists for php ini values to set. - * - * @return void - */ - protected function _setupPHPRuntime() - { - // set php runtime settings - ini_set('display_errors', true); - - // support the changing of the current working directory, necessary for some providers - $cwd = getenv('ZEND_TOOL_CURRENT_WORKING_DIRECTORY'); - if ('' != $cwd && realpath($cwd)) { - chdir($cwd); - } - - if (!$this->_configFile) { - return; - } - $zfINISettings = parse_ini_file($this->_configFile); - $phpINISettings = ini_get_all(); - foreach ($zfINISettings as $zfINIKey => $zfINIValue) { - if ('php.' === substr((string) $zfINIKey, 0, 4)) { - $phpINIKey = substr((string) $zfINIKey, 4); - if (array_key_exists($phpINIKey, $phpINISettings)) { - ini_set($phpINIKey, $zfINIValue); - } - } - } - } - - /** - * _setupToolRuntime() - setup the tools include_path and load the proper framwork parts that - * enable Zend_Tool to work. - * - * @return void - */ - protected function _setupToolRuntime() - { - $includePathPrepend = getenv('ZEND_TOOL_INCLUDE_PATH_PREPEND'); - $includePathFull = getenv('ZEND_TOOL_INCLUDE_PATH'); - - // check if the user has not provided anything - if (!($includePathPrepend || $includePathFull)) { - if ($this->_tryClientLoad()) { - return; - } - } - - // if ZF is not in the include_path, but relative to this file, put it in the include_path - if ($includePathPrepend || $includePathFull) { - if (isset($includePathPrepend) && (false !== $includePathPrepend)) { - set_include_path($includePathPrepend.PATH_SEPARATOR.get_include_path()); - } elseif (isset($includePathFull) && (false !== $includePathFull)) { - set_include_path($includePathFull); - } - } - - if ($this->_tryClientLoad()) { - return; - } - - $zfIncludePath['relativePath'] = __DIR__.'/../library/'; - if (file_exists((string) $zfIncludePath['relativePath'].'Zend/Tool/Framework/Client/Console.php')) { - set_include_path(realpath($zfIncludePath['relativePath']).PATH_SEPARATOR.get_include_path()); - } - - if (!$this->_tryClientLoad()) { - $this->_mode = 'runError'; - - return; - } - } - - /** - * _tryClientLoad() - Attempt to load the Zend_Tool_Framework_Client_Console to enable the tool to run. - * - * This method will return false if its not loaded to allow the consumer to alter the environment in such - * a way that it can be called again to try loading the proper file/class. - * - * @return bool if the client is actuall loaded or not - */ - protected function _tryClientLoad() - { - $this->_clientLoaded = false; - $fh = @fopen('Zend/Tool/Framework/Client/Console.php', 'r', true); - if (!$fh) { - return $this->_clientLoaded; // false - } else { - fclose($fh); - unset($fh); - include 'Zend/Tool/Framework/Client/Console.php'; - $this->_clientLoaded = class_exists('Zend_Tool_Framework_Client_Console'); - } - - return $this->_clientLoaded; - } - - /** - * _runError() - Output the error screen that tells the user that the tool was not setup - * in a sane way. - * - * @return void - */ - protected function _runError() - { - echo <<_messages).PHP_EOL; - - echo PHP_EOL; - - echo 'To change the setup of this tool, run: "zf --setup"'; - - echo PHP_EOL; - } - - /** - * _runSetup() - parse the request to see which setup command to run. - * - * @return void - */ - protected function _runSetup() - { - $setupCommand = (isset($_SERVER['argv'][2])) ? $_SERVER['argv'][2] : null; - - switch ($setupCommand) { - case 'storage-directory': - $this->_runSetupStorageDirectory(); - break; - case 'config-file': - $this->_runSetupConfigFile(); - break; - default: - $this->_runSetupMoreInfo(); - break; - } - } - - /** - * _runSetupStorageDirectory() - if the storage directory does not exist, create it. - * - * @return void - */ - protected function _runSetupStorageDirectory() - { - $storageDirectory = $this->_detectStorageDirectory(false, false); - - if (file_exists((string) $storageDirectory)) { - echo 'Directory already exists at '.$storageDirectory.PHP_EOL - .'Cannot create storage directory.'; - - return; - } - - mkdir($storageDirectory); - - echo 'Storage directory created at '.$storageDirectory.PHP_EOL; - } - - /** - * _runSetupConfigFile(). - * - * @return void - */ - protected function _runSetupConfigFile() - { - $configFile = $this->_detectConfigFile(false, false); - - if (file_exists((string) $configFile)) { - echo 'File already exists at '.$configFile.PHP_EOL - .'Cannot write new config file.'; - - return; - } - - $includePath = get_include_path(); - - $contents = 'php.include_path = "'.$includePath.'"'; - - file_put_contents($configFile, $contents); - - $iniValues = ini_get_all(); - if ($iniValues['include_path']['global_value'] != $iniValues['include_path']['local_value']) { - echo 'NOTE: the php include_path to be used with the tool has been written'.PHP_EOL - .'to the config file, using ZEND_TOOL_INCLUDE_PATH (or other include_path setters)'.PHP_EOL - .'is no longer necessary.'.PHP_EOL.PHP_EOL; - } - - echo 'Config file written to '.$configFile.PHP_EOL; - } - - /** - * _runSetupMoreInfo() - return more information about what can be setup, and what is setup. - * - * @return void - */ - protected function _runSetupMoreInfo() - { - $homeDirectory = $this->_detectHomeDirectory(false, false); - $storageDirectory = $this->_detectStorageDirectory(false, false); - $configFile = $this->_detectConfigFile(false, false); - - echo <<_configFile) && $this->_configFile) { - $configOptions['configOptions']['configFilepath'] = $this->_configFile; - } - if (isset($this->_storageDirectory) && $this->_storageDirectory) { - $configOptions['storageOptions']['directory'] = $this->_storageDirectory; - } - - // ensure that zf.php loads the Zend_Tool_Project features - $configOptions['classesToLoad'] = 'Zend_Tool_Project_Provider_Manifest'; - - $console = new Zend_Tool_Framework_Client_Console($configOptions); - $console->dispatch(); - } - - /** - * _logMessage() - Internal method used to log setup and information messages. - * - * @param string $message - * @param bool $storeMessage - * - * @return void - */ - protected function _logMessage($message, $storeMessage = true) - { - if (!$storeMessage) { - return; - } - - $this->_messages[] = $message; - } -} - -if (!getenv('ZF_NO_MAIN')) { - ZF::main(); -} diff --git a/packages/zend-tool/bin/zf.sh b/packages/zend-tool/bin/zf.sh deleted file mode 100644 index 28a42ec51..000000000 --- a/packages/zend-tool/bin/zf.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -############################################################################# -# 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. -# -# Zend -# Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) -# http://framework.zend.com/license/new-bsd New BSD License -############################################################################# - - -# find php: pear first, command -v second, straight up php lastly -if test "@php_bin@" != '@'php_bin'@'; then - PHP_BIN="@php_bin@" -elif command -v php 1>/dev/null 2>/dev/null; then - PHP_BIN=`command -v php` -else - PHP_BIN=php -fi - -# find zf.php: pear first, same directory 2nd, -if test "@php_dir@" != '@'php_dir'@'; then - PHP_DIR="@php_dir@" -else - SELF_LINK="$0" - SELF_LINK_TMP="$(readlink "$SELF_LINK")" - while test -n "$SELF_LINK_TMP"; do - SELF_LINK="$SELF_LINK_TMP" - SELF_LINK_TMP="$(readlink "$SELF_LINK")" - done - PHP_DIR="$(dirname "$SELF_LINK")" -fi - -"$PHP_BIN" -d safe_mode=Off -f "$PHP_DIR/zf.php" -- "$@" - diff --git a/packages/zend-tool/composer.json b/packages/zend-tool/composer.json deleted file mode 100644 index ced57f2bf..000000000 --- a/packages/zend-tool/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "zf1s/zend-tool", - "description": "Zend Framework 1 Tool package", - "keywords": ["framework", "zf1", "zend", "tool"], - "homepage": "http://framework.zend.com/", - "license": "BSD-3-Clause", - "require": { - "jworman/polyfill-php81": "^1.25", - "php": ">=5.3.3" - }, - "autoload": { - "psr-0": { - "Zend_Tool": "library/" - } - }, - "suggest": { - "zf1s/zend-config": "Used in special situations or with special adapters", - "zf1s/zend-loader": "Used in special situations or with special adapters" - }, - "bin": [ - "bin/zf.sh", - "bin/zf.php" - ], - "replace": { - "zf1/zend-tool": "^1.12" - }, - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Action/Base.php b/packages/zend-tool/library/Zend/Tool/Framework/Action/Base.php deleted file mode 100644 index 4cdaa1b2e..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Action/Base.php +++ /dev/null @@ -1,96 +0,0 @@ -setName($options); - } - // implement $options here in the future if this is needed - } - } - - /** - * setName(). - * - * @param string $name - * - * @return Zend_Tool_Framework_Action_Base - */ - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - if (null == $this->_name) { - $this->_name = $this->_parseName(); - } - - return $this->_name; - } - - /** - * _parseName - internal method to determine the name of an action when one is not explicity provided. - * - * @return string - */ - protected function _parseName() - { - $className = get_class($this); - $actionName = substr((string) $className, strrpos($className, '_') + 1); - - return $actionName; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Action/Exception.php b/packages/zend-tool/library/Zend/Tool/Framework/Action/Exception.php deleted file mode 100644 index e595d2493..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Action/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -_registry = $registry; - } - - /** - * addAction(). - * - * @return Zend_Tool_Framework_Action_Repository - */ - public function addAction(Zend_Tool_Framework_Action_Interface $action, $overrideExistingAction = false) - { - $actionName = $action->getName(); - - if ('' == $actionName || 'Base' == $actionName) { - // require_once 'Zend/Tool/Framework/Action/Exception.php'; - throw new Zend_Tool_Framework_Action_Exception('An action name for the provided action could not be determined.'); - } - - if (!$overrideExistingAction && array_key_exists(strtolower((string) $actionName), $this->_actions)) { - // require_once 'Zend/Tool/Framework/Action/Exception.php'; - throw new Zend_Tool_Framework_Action_Exception('An action by the name '.$actionName.' is already registered and $overrideExistingAction is set to false.'); - } - - $this->_actions[strtolower((string) $actionName)] = $action; - - return $this; - } - - /** - * process() - this is called when the client is done constructing (after init()). - * - * @return unknown|null - */ - public function process() - { - return null; - } - - /** - * getActions() - get all actions in the repository. - * - * @return array - */ - public function getActions() - { - return $this->_actions; - } - - /** - * getAction() - get an action by a specific name. - * - * @param string $actionName - * - * @return Zend_Tool_Framework_Action_Interface - */ - public function getAction($actionName) - { - if (!array_key_exists(strtolower((string) $actionName), $this->_actions)) { - return null; - } - - return $this->_actions[strtolower((string) $actionName)]; - } - - /** - * count() required by the Countable interface. - * - * @return int - */ - #[ReturnTypeWillChange] - public function count() - { - return count($this->_actions); - } - - /** - * getIterator() - get all actions, this supports the IteratorAggregate interface. - * - * @return ArrayIterator - */ - #[ReturnTypeWillChange] - public function getIterator() - { - return new ArrayIterator($this->_actions); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Abstract.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Abstract.php deleted file mode 100644 index ab95b9683..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Abstract.php +++ /dev/null @@ -1,324 +0,0 @@ -setClient($this); - - // NOTE: at this moment, $this->_registry should contain the registry object - - if ($options) { - $this->setOptions($options); - } - } - - public function setOptions(array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethodName = 'set'.$optionName; - if (method_exists($this, $setMethodName)) { - $this->{$setMethodName}($optionValue); - } - } - } - - /** - * getName() - Return the client name which can be used to - * query the manifest if need be. - * - * @return string The client name - */ - abstract public function getName(); - - /** - * initialized() - This will initialize the client for use. - */ - public function initialize() - { - // if its already initialized, no need to initialize again - if ($this->_isInitialized) { - return; - } - - // run any preInit - $this->_preInit(); - - $manifest = $this->_registry->getManifestRepository(); - $manifest->addManifest(new Zend_Tool_Framework_Client_Manifest()); - - // setup the debug log - if (!$this->_debugLogger instanceof Zend_Log) { - // require_once 'Zend/Log.php'; - // require_once 'Zend/Log/Writer/Null.php'; - $this->_debugLogger = new Zend_Log(new Zend_Log_Writer_Null()); - } - - // let the loader load, then the repositories process whats been loaded - $this->_registry->getLoader()->load(); - - // process the action repository - $this->_registry->getActionRepository()->process(); - - // process the provider repository - $this->_registry->getProviderRepository()->process(); - - // process the manifest repository - $this->_registry->getManifestRepository()->process(); - - if ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface) { - // require_once 'Zend/Tool/Framework/Client/Interactive/InputHandler.php'; - } - - if ($this instanceof Zend_Tool_Framework_Client_Interactive_OutputInterface) { - $this->_registry->getResponse()->setContentCallback([$this, 'handleInteractiveOutput']); - } - } - - /** - * This method should be implemented by the client implementation to - * construct and set custom inflectors, request and response objects. - */ - protected function _preInit() - { - } - - /** - * This method *must* be implemented by the client implementation to - * parse out and setup the request objects action, provider and parameter - * information. - */ - abstract protected function _preDispatch(); - - /** - * This method should be implemented by the client implementation to - * take the output of the response object and return it (in an client - * specific way) back to the Tooling Client. - */ - protected function _postDispatch() - { - } - - /** - * setRegistry() - Required by the Zend_Tool_Framework_Registry_EnabledInterface - * interface which ensures proper registry dependency resolution. - * - * @return Zend_Tool_Framework_Client_Abstract - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - $this->_registry = $registry; - - return $this; - } - - /** - * getRegistry();. - * - * @return Zend_Tool_Framework_Registry_Interface - */ - public function getRegistry() - { - return $this->_registry; - } - - /** - * hasInteractiveInput() - Convienence method for determining if this - * client can handle interactive input, and thus be able to run the - * promptInteractiveInput. - * - * @return bool - */ - public function hasInteractiveInput() - { - return $this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface; - } - - public function promptInteractiveInput($inputRequest) - { - if (!$this->hasInteractiveInput()) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('promptInteractive() cannot be called on a non-interactive client.'); - } - - $inputHandler = new Zend_Tool_Framework_Client_Interactive_InputHandler(); - $inputHandler->setClient($this); - $inputHandler->setInputRequest($inputRequest); - - return $inputHandler->handle(); - } - - /** - * This method should be called in order to "handle" a Tooling Client - * request that has come to the client that has been implemented. - */ - public function dispatch() - { - $this->initialize(); - - try { - $this->_preDispatch(); - - if ($this->_registry->getRequest()->isDispatchable()) { - if (null == $this->_registry->getRequest()->getActionName()) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Client failed to setup the action name.'); - } - - if (null == $this->_registry->getRequest()->getProviderName()) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Client failed to setup the provider name.'); - } - - $this->_handleDispatch(); - } - } catch (Throwable $exception) { - $this->_registry->getResponse()->setException($exception); - } - - $this->_postDispatch(); - } - - public function convertToClientNaming($string) - { - return $string; - } - - public function convertFromClientNaming($string) - { - return $string; - } - - protected function _handleDispatch() - { - // get the provider repository - $providerRepository = $this->_registry->getProviderRepository(); - - $request = $this->_registry->getRequest(); - - // get the dispatchable provider signature - $providerSignature = $providerRepository->getProviderSignature($request->getProviderName()); - - // get the actual provider - $provider = $providerSignature->getProvider(); - - // ensure that we can pretend if this is a pretend request - if ($request->isPretend() && (!$provider instanceof Zend_Tool_Framework_Provider_Pretendable)) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - provider does not support pretend'); - } - - // get the action name - $actionName = $this->_registry->getRequest()->getActionName(); - $specialtyName = $this->_registry->getRequest()->getSpecialtyName(); - - if (!$actionableMethod = $providerSignature->getActionableMethodByActionName($actionName, $specialtyName)) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - actionable method not found'); - } - - // get the actual method and param information - $methodName = $actionableMethod['methodName']; - $methodParameters = $actionableMethod['parameterInfo']; - - // get the provider params - $requestParameters = $this->_registry->getRequest()->getProviderParameters(); - - // @todo This seems hackish, determine if there is a better way - $callParameters = []; - foreach ($methodParameters as $methodParameterName => $methodParameterValue) { - if (!array_key_exists($methodParameterName, $requestParameters) && false == $methodParameterValue['optional']) { - if ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface) { - $promptSting = $this->getMissingParameterPromptString($provider, $actionableMethod['action'], $methodParameterValue['name']); - $parameterPromptValue = $this->promptInteractiveInput($promptSting)->getContent(); - if (null == $parameterPromptValue) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Value supplied for required parameter "'.$methodParameterValue['name'].'" is empty'); - } - $callParameters[] = $parameterPromptValue; - } else { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('A required parameter "'.$methodParameterValue['name'].'" was not supplied.'); - } - } else { - $callParameters[] = (array_key_exists($methodParameterName, $requestParameters)) ? $requestParameters[$methodParameterName] : $methodParameterValue['default']; - } - } - - $this->_handleDispatchExecution($provider, $methodName, $callParameters); - } - - protected function _handleDispatchExecution($class, $methodName, $callParameters) - { - if (method_exists($class, $methodName)) { - call_user_func_array([$class, $methodName], $callParameters); - } elseif (method_exists($class, $methodName.'Action')) { - call_user_func_array([$class, $methodName.'Action'], $callParameters); - } else { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Not a supported method.'); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Config.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Config.php deleted file mode 100644 index 30d9aace4..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Config.php +++ /dev/null @@ -1,239 +0,0 @@ -setOptions($options); - } - } - - public function setOptions(array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethodName = 'set'.$optionName; - if (method_exists($this, $setMethodName)) { - $this->{$setMethodName}($optionValue); - } - } - } - - /** - * @param string $configFilepath - * - * @return Zend_Tool_Framework_Client_Config - */ - public function setConfigFilepath($configFilepath) - { - if (!file_exists((string) $configFilepath)) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Provided path to config '.$configFilepath.' does not exist'); - } - - $this->_configFilepath = $configFilepath; - $this->loadConfig($configFilepath); - - return $this; - } - - /** - * Load the configuration from the given path. - * - * @param string $configFilepath - */ - protected function loadConfig($configFilepath) - { - $suffix = substr((string) $configFilepath, -4); - - switch ($suffix) { - case '.ini': - // require_once 'Zend/Config/Ini.php'; - $this->_config = new Zend_Config_Ini($configFilepath, null, ['allowModifications' => true]); - break; - case '.xml': - // require_once 'Zend/Config/Xml.php'; - $this->_config = new Zend_Config_Xml($configFilepath, null, ['allowModifications' => true]); - break; - case '.php': - // require_once 'Zend/Config.php'; - $this->_config = new Zend_Config(include $configFilepath, true); - break; - default: - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Unknown config file type '.$suffix.' at location '.$configFilepath); - } - } - - /** - * Return the filepath of the configuration. - * - * @return string|null - */ - public function getConfigFilepath() - { - return $this->_configFilepath; - } - - /** - * Get a configuration value. - * - * @param string $name - * @param string $defaultValue - */ - public function get($name, $defaultValue = null) - { - return $this->getConfigInstance()->get($name, $defaultValue); - } - - /** - * Get a configuration value. - * - * @param string $name - */ - public function __get($name) - { - return $this->getConfigInstance()->{$name}; - } - - /** - * Check if a configuration value isset. - * - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - if (false == $this->exists()) { - return false; - } - - return isset($this->getConfigInstance()->{$name}); - } - - /** - * @param string $name - */ - public function __unset($name) - { - unset($this->getConfigInstance()->$name); - } - - /** - * @param string $name - */ - public function __set($name, $value) - { - return $this->getConfigInstance()->$name = $value; - } - - /** - * Check if the User profile has a configuration. - * - * @return bool - */ - public function exists() - { - return null !== $this->_config; - } - - /** - * @return Zend_Config - * - * @throws Zend_Tool_Framework_Client_Exception - */ - public function getConfigInstance() - { - if (!$this->exists()) { - // require_once "Zend/Tool/Framework/Client/Exception.php"; - throw new Zend_Tool_Framework_Client_Exception('Client has no persistent configuration.'); - } - - return $this->_config; - } - - /** - * Save changes to the configuration into persistence. - * - * @return bool - */ - public function save() - { - if ($this->exists()) { - $writer = $this->getConfigWriter(); - $writer->write($this->getConfigFilepath(), $this->getConfigInstance(), true); - $this->loadConfig($this->getConfigFilepath()); - - return true; - } - - return false; - } - - /** - * Get the config writer that corresponds to the current config file type. - * - * @return Zend_Config_Writer_FileAbstract - */ - protected function getConfigWriter() - { - $suffix = substr((string) $this->getConfigFilepath(), -4); - switch ($suffix) { - case '.ini': - // require_once "Zend/Config/Writer/Ini.php"; - $writer = new Zend_Config_Writer_Ini(); - $writer->setRenderWithoutSections(); - break; - case '.xml': - // require_once "Zend/Config/Writer/Xml.php"; - $writer = new Zend_Config_Writer_Xml(); - break; - case '.php': - // require_once "Zend/Config/Writer/Array.php"; - $writer = new Zend_Config_Writer_Array(); - break; - default: - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Unknown config file type '.$suffix.' at location '.$this->getConfigFilepath()); - } - - return $writer; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Console.php deleted file mode 100644 index cc6454b21..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console.php +++ /dev/null @@ -1,306 +0,0 @@ -dispatch(); - } - - /** - * getName() - return the name of the client, in this case 'console'. - * - * @return string - */ - public function getName() - { - return 'console'; - } - - /** - * setConfigOptions(). - * - * @param array $configOptions - */ - public function setConfigOptions($configOptions) - { - $this->_configOptions = $configOptions; - - return $this; - } - - /** - * setStorageOptions(). - * - * @param array $storageOptions - */ - public function setStorageOptions($storageOptions) - { - $this->_storageOptions = $storageOptions; - - return $this; - } - - /** - * @param array $classesToLoad - */ - public function setClassesToLoad($classesToLoad) - { - $this->_classesToLoad = $classesToLoad; - - return $this; - } - - /** - * _init() - Tasks processed before the constructor, generally setting up objects to use. - */ - protected function _preInit() - { - $config = $this->_registry->getConfig(); - - if (null != $this->_configOptions) { - $config->setOptions($this->_configOptions); - } - - $storage = $this->_registry->getStorage(); - - if (null != $this->_storageOptions && isset($this->_storageOptions['directory'])) { - $storage->setAdapter( - new Zend_Tool_Framework_Client_Storage_Directory($this->_storageOptions['directory']) - ); - } - - // which classes are essential to initializing Zend_Tool_Framework_Client_Console - $classesToLoad = [ - 'Zend_Tool_Framework_Client_Console_Manifest', - 'Zend_Tool_Framework_System_Manifest', - ]; - - if ($this->_classesToLoad) { - if (is_string($this->_classesToLoad)) { - $classesToLoad[] = $this->_classesToLoad; - } elseif (is_array($this->_classesToLoad)) { - $classesToLoad = array_merge($classesToLoad, $this->_classesToLoad); - } - } - - // add classes to the basic loader from the config file basicloader.classes.1 .. - if (isset($config->basicloader) && isset($config->basicloader->classes)) { - foreach ($config->basicloader->classes as $classKey => $className) { - array_push($classesToLoad, $className); - } - } - - $this->_registry->setLoader( - new Zend_Tool_Framework_Loader_BasicLoader(['classesToLoad' => $classesToLoad]) - ); - - return; - } - - /** - * _preDispatch() - Tasks handed after initialization but before dispatching. - */ - protected function _preDispatch() - { - $response = $this->_registry->getResponse(); - - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_AlignCenter()); - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Indention()); - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Blockize()); - - if (function_exists('posix_isatty')) { - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Colorizer()); - } - - $response->addContentDecorator(new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator()) - ->setDefaultDecoratorOptions(['separator' => true]); - - $optParser = new Zend_Tool_Framework_Client_Console_ArgumentParser(); - $optParser->setArguments($_SERVER['argv']) - ->setRegistry($this->_registry) - ->parse(); - - return; - } - - /** - * _postDispatch() - Tasks handled after dispatching. - */ - protected function _postDispatch() - { - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - if ($response->isException()) { - $helpSystem = new Zend_Tool_Framework_Client_Console_HelpSystem(); - $helpSystem->setRegistry($this->_registry) - ->respondWithErrorMessage($response->getException()->getMessage(), $response->getException()) - ->respondWithSpecialtyAndParamHelp( - $request->getProviderName(), - $request->getActionName() - ); - } - - echo PHP_EOL; - - return; - } - - /** - * handleInteractiveInputRequest() is required by the Interactive InputInterface. - * - * @return string - */ - public function handleInteractiveInputRequest(Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest) - { - fwrite(STDOUT, $inputRequest->getContent().PHP_EOL.'zf> '); - $inputContent = fgets(STDIN); - - return rtrim((string) $inputContent); // remove the return from the end of the string - } - - /** - * handleInteractiveOutput() is required by the Interactive OutputInterface. - * - * This allows us to display output immediately from providers, rather - * than displaying it after the provider is done. - * - * @param string $output - */ - public function handleInteractiveOutput($output) - { - echo $output; - } - - /** - * getMissingParameterPromptString(). - * - * @param string $missingParameterName - * - * @return string - */ - public function getMissingParameterPromptString(Zend_Tool_Framework_Provider_Interface $provider, Zend_Tool_Framework_Action_Interface $actionInterface, $missingParameterName) - { - return 'Please provide a value for $'.$missingParameterName; - } - - /** - * convertToClientNaming(). - * - * Convert words to client specific naming, in this case is lower, dash separated - * - * Filters are lazy-loaded. - * - * @param string $string - * - * @return string - */ - public function convertToClientNaming($string) - { - if (!$this->_filterToClientNaming) { - $filter = new Zend_Filter(); - $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()); - $filter->addFilter(new Zend_Filter_StringToLower()); - - $this->_filterToClientNaming = $filter; - } - - return $this->_filterToClientNaming->filter($string); - } - - /** - * convertFromClientNaming(). - * - * Convert words from client specific naming to code naming - camelcased - * - * Filters are lazy-loaded. - * - * @param string $string - * - * @return string - */ - public function convertFromClientNaming($string) - { - if (!$this->_filterFromClientNaming) { - $this->_filterFromClientNaming = new Zend_Filter_Word_DashToCamelCase(); - } - - return $this->_filterFromClientNaming->filter($string); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ArgumentParser.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ArgumentParser.php deleted file mode 100644 index d83d8618b..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ArgumentParser.php +++ /dev/null @@ -1,538 +0,0 @@ -_argumentsOriginal = $this->_argumentsWorking = $arguments; - - return $this; - } - - /** - * setRegistry(). - * - * @return Zend_Tool_Framework_Client_Console_ArgumentParser - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - // get the client registry - $this->_registry = $registry; - - // set manifest repository, request, response for easy access - $this->_manifestRepository = $this->_registry->getManifestRepository(); - $this->_request = $this->_registry->getRequest(); - $this->_response = $this->_registry->getResponse(); - - return $this; - } - - /** - * Parse() - This method does the work of parsing the arguments into the enpooint request, - * this will also (during help operations) fill the response in with information as needed. - * - * @return null - */ - public function parse() - { - if (null == $this->_request || null == $this->_response) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('The client registry must have both a request and response registered.'); - } - - // setup the help options - $helpResponseOptions = []; - - // check to see if the first cli arg is the script name - if ($this->_argumentsWorking[0] == $_SERVER['SCRIPT_NAME']) { - array_shift($this->_argumentsWorking); - } - - // process global options - try { - $this->_parseGlobalPart(); - } catch (Zend_Tool_Framework_Client_Exception $exception) { - $this->_createHelpResponse(['error' => $exception->getMessage()]); - - return; - } - - // ensure there are arguments left - if (0 == count($this->_argumentsWorking)) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - - // check to see if this was a help request - if ($this->_help) { - $this->_createHelpResponse(); - } else { - $this->_createHelpResponse(['error' => 'An action and provider is required.']); - } - - return; - } - - // process the action part of the command line - try { - $this->_parseActionPart(); - } catch (Zend_Tool_Framework_Client_Exception $exception) { - $this->_request->setDispatchable(false); - $this->_createHelpResponse(['error' => $exception->getMessage()]); - - return; - } - - if ($this->_helpKnownAction) { - $helpResponseOptions = array_merge( - $helpResponseOptions, - ['actionName' => $this->_request->getActionName()] - ); - } - - /* @TODO Action Parameter Requirements */ - - // make sure there are more "words" on the command line - if (0 == count($this->_argumentsWorking)) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - - // check to see if this is a help request - if ($this->_help) { - $this->_createHelpResponse($helpResponseOptions); - } else { - $this->_createHelpResponse(array_merge($helpResponseOptions, ['error' => 'A provider is required.'])); - } - - return; - } - - // process the provider part of the command line - try { - $this->_parseProviderPart(); - } catch (Zend_Tool_Framework_Client_Exception $exception) { - $this->_request->setDispatchable(false); - $this->_createHelpResponse(['error' => $exception->getMessage()]); - - return; - } - - if ($this->_helpKnownProvider) { - $helpResponseOptions = array_merge( - $helpResponseOptions, - ['providerName' => $this->_request->getProviderName()] - ); - } - - if ($this->_helpKnownSpecialty) { - $helpResponseOptions = array_merge( - $helpResponseOptions, - ['specialtyName' => $this->_request->getSpecialtyName()] - ); - } - - // if there are arguments on the command line, lets process them as provider options - if (0 != count($this->_argumentsWorking)) { - $this->_parseProviderOptionsPart(); - } - - // if there is still arguments lingering around, we can assume something is wrong - if (0 != count($this->_argumentsWorking)) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - if ($this->_help) { - $this->_createHelpResponse($helpResponseOptions); - } else { - $this->_createHelpResponse(array_merge( - $helpResponseOptions, - ['error' => 'Unknown arguments left on the command line: '.implode(' ', $this->_argumentsWorking)] - )); - } - - return; - } - - // everything was processed and this is a request for help information - if ($this->_help) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - $this->_createHelpResponse($helpResponseOptions); - } - - return; - } - - /** - * Internal routine for parsing global options from the command line. - * - * @return null - */ - protected function _parseGlobalPart() - { - $getoptOptions = []; - $getoptOptions['help|h'] = 'HELP'; - $getoptOptions['verbose|v'] = 'VERBOSE'; - $getoptOptions['pretend|p'] = 'PRETEND'; - $getoptOptions['debug|d'] = 'DEBUG'; - $getoptParser = new Zend_Console_Getopt($getoptOptions, $this->_argumentsWorking, ['parseAll' => false]); - - // @todo catch any exceptions here - $getoptParser->parse(); - - foreach ($getoptParser->getOptions() as $option) { - if ('pretend' == $option) { - $this->_request->setPretend(true); - } elseif ('debug' == $option) { - $this->_request->setDebug(true); - } elseif ('verbose' == $option) { - $this->_request->setVerbose(true); - } else { - $property = '_'.$option; - $this->{$property} = true; - } - } - - $this->_argumentsWorking = $getoptParser->getRemainingArgs(); - - return; - } - - /** - * Internal routine for parsing the action name from the arguments. - * - * @return null - */ - protected function _parseActionPart() - { - // the next "word" should be the action name - $consoleActionName = array_shift($this->_argumentsWorking); - - if ('?' == $consoleActionName) { - $this->_help = true; - - return; - } - - $actionSearchCriteria = [ - 'type' => 'Tool', - 'name' => 'actionName', - 'value' => $consoleActionName, - 'clientName' => 'console', - ]; - - // is the action name valid? - $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria); - - // check for normalized names as well (all lower, no separators) - if (!$actionMetadata) { - $actionSearchCriteria['name'] = 'normalizedActionName'; - $actionSearchCriteria['value'] = strtolower((string) str_replace(['-', '_'], '', $consoleActionName)); - $actionSearchCriteria['clientName'] = 'all'; - $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria); - } - - // if no action, handle error - if (!$actionMetadata) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Action \''.$consoleActionName.'\' is not a valid action.'); - } - - // prepare action request name - $this->_helpKnownAction = true; - $this->_request->setActionName($actionMetadata->getActionName()); - - return; - } - - /** - * Internal routine for parsing the provider part of the command line arguments. - * - * @return null - */ - protected function _parseProviderPart() - { - // get the cli "word" as the provider name from command line - $consoleProviderFull = array_shift($this->_argumentsWorking); - $consoleSpecialtyName = '_global'; - - // if there is notation for specialties? If so, break them up - if (strstr((string) $consoleProviderFull, '.')) { - list($consoleProviderName, $consoleSpecialtyName) = explode('.', $consoleProviderFull); - } else { - $consoleProviderName = $consoleProviderFull; - } - - if ('?' == $consoleProviderName) { - $this->_help = true; - - return; - } - - $providerSearchCriteria = [ - 'type' => 'Tool', - 'name' => 'providerName', - 'value' => $consoleProviderName, - 'clientName' => 'console', - ]; - - // get the cli provider names from the manifest - $providerMetadata = $this->_manifestRepository->getMetadata($providerSearchCriteria); - - // check for normalized names as well (all lower, no separators) - if (!$providerMetadata) { - $providerSearchCriteria['name'] = 'normalizedProviderName'; - $providerSearchCriteria['value'] = strtolower((string) str_replace(['-', '_'], '', $consoleProviderName)); - $providerSearchCriteria['clientName'] = 'all'; - $providerMetadata = $this->_manifestRepository->getMetadata($providerSearchCriteria); - } - - if (!$providerMetadata) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Provider \''.$consoleProviderFull.'\' is not a valid provider.'); - } - - $this->_helpKnownProvider = true; - $this->_request->setProviderName($providerMetadata->getProviderName()); - - if ('?' == $consoleSpecialtyName) { - $this->_help = true; - - return; - } - - $providerSpecialtySearchCriteria = [ - 'type' => 'Tool', - 'name' => 'specialtyName', - 'value' => $consoleSpecialtyName, - 'providerName' => $providerMetadata->getProviderName(), - 'clientName' => 'console', - ]; - - $providerSpecialtyMetadata = $this->_manifestRepository->getMetadata($providerSpecialtySearchCriteria); - - if (!$providerSpecialtyMetadata) { - $providerSpecialtySearchCriteria['name'] = 'normalizedSpecialtyName'; - $providerSpecialtySearchCriteria['value'] = strtolower((string) str_replace(['-', '_'], '', $consoleSpecialtyName)); - $providerSpecialtySearchCriteria['clientName'] = 'all'; - $providerSpecialtyMetadata = $this->_manifestRepository->getMetadata($providerSpecialtySearchCriteria); - } - - if (!$providerSpecialtyMetadata) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Provider \''.$consoleSpecialtyName.'\' is not a valid specialty.'); - } - - $this->_helpKnownSpecialty = true; - $this->_request->setSpecialtyName($providerSpecialtyMetadata->getSpecialtyName()); - - return; - } - - /** - * Internal routine for parsing the provider options from the command line. - * - * @return null - */ - protected function _parseProviderOptionsPart() - { - if ('?' == current($this->_argumentsWorking)) { - $this->_help = true; - - return; - } - - $searchParams = [ - 'type' => 'Tool', - 'providerName' => $this->_request->getProviderName(), - 'actionName' => $this->_request->getActionName(), - 'specialtyName' => $this->_request->getSpecialtyName(), - 'clientName' => 'console', - ]; - - $actionableMethodLongParamsMetadata = $this->_manifestRepository->getMetadata( - array_merge($searchParams, ['name' => 'actionableMethodLongParams']) - ); - - $actionableMethodShortParamsMetadata = $this->_manifestRepository->getMetadata( - array_merge($searchParams, ['name' => 'actionableMethodShortParams']) - ); - - $paramNameShortValues = $actionableMethodShortParamsMetadata->getValue(); - - $getoptOptions = []; - $wordArguments = []; - $longParamCanonicalNames = []; - - $actionableMethodLongParamsMetadataReference = $actionableMethodLongParamsMetadata->getReference(); - foreach ($actionableMethodLongParamsMetadata->getValue() as $parameterNameLong => $consoleParameterNameLong) { - $optionConfig = $consoleParameterNameLong.'|'; - - $parameterInfo = $actionableMethodLongParamsMetadataReference['parameterInfo'][$parameterNameLong]; - - // process ParameterInfo into array for command line option matching - if ('string' == $parameterInfo['type'] || 'bool' == $parameterInfo['type']) { - $optionConfig .= $paramNameShortValues[$parameterNameLong] - .(($parameterInfo['optional']) ? '-' : '=').'s'; - } elseif (in_array($parameterInfo['type'], ['int', 'integer', 'float'])) { - $optionConfig .= $paramNameShortValues[$parameterNameLong] - .(($parameterInfo['optional']) ? '-' : '=').'i'; - } else { - $optionConfig .= $paramNameShortValues[$parameterNameLong].'-s'; - } - - $getoptOptions[$optionConfig] = ('' != $parameterInfo['description']) ? $parameterInfo['description'] : 'No description available.'; - - // process ParameterInfo into array for command line WORD (argument) matching - $wordArguments[$parameterInfo['position']]['parameterName'] = $parameterInfo['name']; - $wordArguments[$parameterInfo['position']]['optional'] = $parameterInfo['optional']; - $wordArguments[$parameterInfo['position']]['type'] = $parameterInfo['type']; - - // keep a translation of console to canonical names - $longParamCanonicalNames[$consoleParameterNameLong] = $parameterNameLong; - } - - if (!$getoptOptions) { - // no options to parse here, return - return; - } - - // if non-option arguments exist, attempt to process them before processing options - $wordStack = []; - while ($wordOnTop = array_shift($this->_argumentsWorking)) { - if ('-' != substr((string) $wordOnTop, 0, 1)) { - array_push($wordStack, $wordOnTop); - } else { - // put word back on stack and move on - array_unshift($this->_argumentsWorking, $wordOnTop); - break; - } - - if (count($wordStack) == count($wordArguments)) { - // when we get at most the number of arguments we are expecting - // then break out. - break; - } - } - - if ($wordStack && $wordArguments) { - for ($wordIndex = 1; $wordIndex <= count($wordArguments); ++$wordIndex) { - if (!array_key_exists($wordIndex - 1, $wordStack) || !array_key_exists($wordIndex, $wordArguments)) { - break; - } - $this->_request->setProviderParameter($wordArguments[$wordIndex]['parameterName'], $wordStack[$wordIndex - 1]); - unset($wordStack[$wordIndex - 1]); - } - } - - $getoptParser = new Zend_Console_Getopt($getoptOptions, $this->_argumentsWorking, ['parseAll' => false]); - $getoptParser->parse(); - foreach ($getoptParser->getOptions() as $option) { - $value = $getoptParser->getOption($option); - $providerParamOption = $longParamCanonicalNames[$option]; - $this->_request->setProviderParameter($providerParamOption, $value); - } - - $this->_argumentsWorking = $getoptParser->getRemainingArgs(); - - return; - } - - /** - * _createHelpResponse. - * - * @param unknown_type $options - */ - protected function _createHelpResponse($options = []) - { - // require_once 'Zend/Tool/Framework/Client/Console/HelpSystem.php'; - $helpSystem = new Zend_Tool_Framework_Client_Console_HelpSystem(); - $helpSystem->setRegistry($this->_registry); - - if (isset($options['error'])) { - $helpSystem->respondWithErrorMessage($options['error']); - } - - if (isset($options['actionName']) && isset($options['providerName'])) { - $helpSystem->respondWithSpecialtyAndParamHelp($options['providerName'], $options['actionName']); - } elseif (isset($options['actionName'])) { - $helpSystem->respondWithActionHelp($options['actionName']); - } elseif (isset($options['providerName'])) { - $helpSystem->respondWithProviderHelp($options['providerName']); - } else { - $helpSystem->respondWithGeneralHelp(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/HelpSystem.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/HelpSystem.php deleted file mode 100644 index 032287c1b..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/HelpSystem.php +++ /dev/null @@ -1,376 +0,0 @@ -_registry = $registry; - $this->_response = $registry->getResponse(); - - return $this; - } - - /** - * respondWithErrorMessage(). - * - * @param string $errorMessage - */ - public function respondWithErrorMessage($errorMessage, Throwable $exception = null) - { - // break apart the message into wrapped chunks - $errorMessages = explode(PHP_EOL, wordwrap($errorMessage, 70, PHP_EOL, false)); - - $text = 'An Error Has Occurred'; - $this->_response->appendContent($text, ['color' => ['hiWhite', 'bgRed'], 'aligncenter' => true]); - $this->_response->appendContent($errorMessage, ['indention' => 1, 'blockize' => 72, 'color' => ['white', 'bgRed']]); - - if ($exception && $this->_registry->getRequest()->isDebug()) { - $this->_response->appendContent($exception->getTraceAsString()); - } - - $this->_response->appendContent(null, ['separator' => true]); - - return $this; - } - - /** - * respondWithGeneralHelp(). - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithGeneralHelp() - { - $this->_respondWithHeader(); - - $noSeparator = ['separator' => false]; - - $this->_response->appendContent('Usage:', ['color' => 'green']) - ->appendContent(' ', $noSeparator) - ->appendContent('zf', array_merge(['color' => 'cyan'], $noSeparator)) - ->appendContent(' [--global-opts]', $noSeparator) - ->appendContent(' action-name', array_merge(['color' => 'cyan'], $noSeparator)) - ->appendContent(' [--action-opts]', $noSeparator) - ->appendContent(' provider-name', array_merge(['color' => 'cyan'], $noSeparator)) - ->appendContent(' [--provider-opts]', $noSeparator) - ->appendContent(' [provider parameters ...]') - ->appendContent(' Note: You may use "?" in any place of the above usage string to ask for more specific help information.', ['color' => 'yellow']) - ->appendContent(' Example: "zf ? version" will list all available actions for the version provider.', ['color' => 'yellow', 'separator' => 2]) - ->appendContent('Providers and their actions:', ['color' => 'green']); - - $this->_respondWithSystemInformation(); - - return $this; - } - - /** - * respondWithActionHelp(). - * - * @param string $actionName - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithActionHelp($actionName) - { - $this->_respondWithHeader(); - $this->_response->appendContent('Providers that support the action "'.$actionName.'"', ['color' => 'green']); - $this->_respondWithSystemInformation(null, $actionName); - - return $this; - } - - /** - * respondWithSpecialtyAndParamHelp(). - * - * @param string $providerName - * @param string $actionName - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithSpecialtyAndParamHelp($providerName, $actionName) - { - $this->_respondWithHeader(); - $this->_response->appendContent( - 'Details for action "'.$actionName.'" and provider "'.$providerName.'"', - ['color' => 'green'] - ); - $this->_respondWithSystemInformation($providerName, $actionName, true); - - return $this; - } - - /** - * respondWithProviderHelp(). - * - * @param string $providerName - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithProviderHelp($providerName) - { - $this->_respondWithHeader(); - $this->_response->appendContent('Actions supported by provider "'.$providerName.'"', ['color' => 'green']); - $this->_respondWithSystemInformation($providerName); - - return $this; - } - - /** - * _respondWithHeader(). - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithHeader() - { - /* - * @see Zend_Version - */ - // require_once 'Zend/Version.php'; - $this->_response->appendContent('Zend Framework', ['color' => ['hiWhite'], 'separator' => false]); - $this->_response->appendContent(' Command Line Console Tool v'.Zend_Version::VERSION.''); - - return $this; - } - - /** - * _respondWithSystemInformation(). - * - * @param string $providerNameFilter - * @param string $actionNameFilter - * @param bool $includeAllSpecialties - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithSystemInformation($providerNameFilter = null, $actionNameFilter = null, $includeAllSpecialties = false) - { - $manifest = $this->_registry->getManifestRepository(); - - $providerMetadatasSearch = [ - 'type' => 'Tool', - 'name' => 'providerName', - 'clientName' => 'console', - ]; - - if (is_string($providerNameFilter)) { - $providerMetadatasSearch = array_merge($providerMetadatasSearch, ['providerName' => $providerNameFilter]); - } - - $actionMetadatasSearch = [ - 'type' => 'Tool', - 'name' => 'actionName', - 'clientName' => 'console', - ]; - - if (is_string($actionNameFilter)) { - $actionMetadatasSearch = array_merge($actionMetadatasSearch, ['actionName' => $actionNameFilter]); - } - - // get the metadata's for the things to display - $displayProviderMetadatas = $manifest->getMetadatas($providerMetadatasSearch); - $displayActionMetadatas = $manifest->getMetadatas($actionMetadatasSearch); - - // create index of actionNames - for ($i = 0; $i < count($displayActionMetadatas); ++$i) { - $displayActionNames[] = $displayActionMetadatas[$i]->getActionName(); - } - - foreach ($displayProviderMetadatas as $providerMetadata) { - $providerNameDisplayed = false; - - $providerName = $providerMetadata->getProviderName(); - $providerSignature = $providerMetadata->getReference(); - - foreach ($providerSignature->getActions() as $actionInfo) { - $actionName = $actionInfo->getName(); - - // check to see if this action name is valid - if (($foundActionIndex = array_search($actionName, $displayActionNames)) === false) { - continue; - } else { - $actionMetadata = $displayActionMetadatas[$foundActionIndex]; - } - - $specialtyMetadata = $manifest->getMetadata([ - 'type' => 'Tool', - 'name' => 'specialtyName', - 'providerName' => $providerName, - 'specialtyName' => '_Global', - 'clientName' => 'console', - ]); - - // lets do the main _Global action first - $actionableGlobalLongParamMetadata = $manifest->getMetadata([ - 'type' => 'Tool', - 'name' => 'actionableMethodLongParams', - 'providerName' => $providerName, - 'specialtyName' => '_Global', - 'actionName' => $actionName, - 'clientName' => 'console', - ]); - - $actionableGlobalMetadatas = $manifest->getMetadatas([ - 'type' => 'Tool', - 'name' => 'actionableMethodLongParams', - 'providerName' => $providerName, - 'actionName' => $actionName, - 'clientName' => 'console', - ]); - - if ($actionableGlobalLongParamMetadata) { - if (!$providerNameDisplayed) { - $this->_respondWithProviderName($providerMetadata); - $providerNameDisplayed = true; - } - - $this->_respondWithCommand($providerMetadata, $actionMetadata, $specialtyMetadata, $actionableGlobalLongParamMetadata); - - $actionIsGlobal = true; - } else { - $actionIsGlobal = false; - } - - // check for providers without a _Global action - $isSingleSpecialProviderAction = false; - if (!$actionIsGlobal && 1 == count($actionableGlobalMetadatas)) { - $isSingleSpecialProviderAction = true; - $this->_respondWithProviderName($providerMetadata); - $providerNameDisplayed = true; - } - - if ($includeAllSpecialties || $isSingleSpecialProviderAction) { - foreach ($providerSignature->getSpecialties() as $specialtyName) { - if ('_Global' == $specialtyName) { - continue; - } - - $specialtyMetadata = $manifest->getMetadata([ - 'type' => 'Tool', - 'name' => 'specialtyName', - 'providerName' => $providerMetadata->getProviderName(), - 'specialtyName' => $specialtyName, - 'clientName' => 'console', - ]); - - $actionableSpecialtyLongMetadata = $manifest->getMetadata([ - 'type' => 'Tool', - 'name' => 'actionableMethodLongParams', - 'providerName' => $providerMetadata->getProviderName(), - 'specialtyName' => $specialtyName, - 'actionName' => $actionName, - 'clientName' => 'console', - ]); - - if ($actionableSpecialtyLongMetadata) { - $this->_respondWithCommand($providerMetadata, $actionMetadata, $specialtyMetadata, $actionableSpecialtyLongMetadata); - } - } - } - - // reset the special flag for single provider action with specialty - $isSingleSpecialProviderAction = false; - - if (!$includeAllSpecialties && count($actionableGlobalMetadatas) > 1) { - $this->_response->appendContent(' Note: There are specialties, use ', ['color' => 'yellow', 'separator' => false]); - $this->_response->appendContent( - 'zf '.$actionMetadata->getValue().' '.$providerMetadata->getValue().'.?', - ['color' => 'cyan', 'separator' => false] - ); - $this->_response->appendContent(' to get specific help on them.', ['color' => 'yellow']); - } - } - - if ($providerNameDisplayed) { - $this->_response->appendContent(null, ['separator' => true]); - } - } - - return $this; - } - - /** - * _respondWithProviderName(). - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithProviderName(Zend_Tool_Framework_Metadata_Tool $providerMetadata) - { - $this->_response->appendContent(' '.$providerMetadata->getProviderName()); - - return $this; - } - - /** - * _respondWithCommand(). - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithCommand( - Zend_Tool_Framework_Metadata_Tool $providerMetadata, - Zend_Tool_Framework_Metadata_Tool $actionMetadata, - Zend_Tool_Framework_Metadata_Tool $specialtyMetadata, - Zend_Tool_Framework_Metadata_Tool $parameterLongMetadata)// , - // Zend_Tool_Framework_Metadata_Tool $parameterShortMetadata) - { - $this->_response->appendContent( - ' zf '.$actionMetadata->getValue().' '.$providerMetadata->getValue(), - ['color' => 'cyan', 'separator' => false] - ); - - if ('_Global' != $specialtyMetadata->getSpecialtyName()) { - $this->_response->appendContent('.'.$specialtyMetadata->getValue(), ['color' => 'cyan', 'separator' => false]); - } - - foreach ($parameterLongMetadata->getValue() as $paramName => $consoleParamName) { - $methodInfo = $parameterLongMetadata->getReference(); - $paramString = ' '.$consoleParamName; - if (($defaultValue = $methodInfo['parameterInfo'][$paramName]['default']) != null) { - $paramString .= '[='.$defaultValue.']'; - } - $this->_response->appendContent($paramString.'', ['separator' => false]); - } - - $this->_response->appendContent(null, ['separator' => true]); - - return $this; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/Manifest.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/Manifest.php deleted file mode 100644 index 97149f596..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/Manifest.php +++ /dev/null @@ -1,198 +0,0 @@ -_registry = $registry; - - return $this; - } - - /** - * getMetadata() is required by the Manifest Interface. - * - * These are the following metadatas that will be setup: - * - * actionName - * - metadata for actions - * - value will be a dashed name for the action named in 'actionName' - * providerName - * - metadata for providers - * - value will be a dashed-name for the provider named in 'providerName' - * providerSpecialtyNames - * - metadata for providers - * actionableMethodLongParameters - * - metadata for providers - * actionableMethodShortParameters - * - metadata for providers - * - * @return array Array of Metadatas - */ - public function getMetadata() - { - $metadatas = []; - - // setup the camelCase to dashed filter to use since cli expects dashed named - $ccToDashedFilter = new Zend_Filter(); - $ccToDashedFilter - ->addFilter(new Zend_Filter_Word_CamelCaseToDash()) - ->addFilter(new Zend_Filter_StringToLower()); - - // get the registry to get the action and provider repository - $actionRepository = $this->_registry->getActionRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - // loop through all actions and create a metadata for each - foreach ($actionRepository->getActions() as $action) { - // each action metadata will be called - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'actionName', - 'value' => $ccToDashedFilter->filter($action->getName()), - 'reference' => $action, - 'actionName' => $action->getName(), - 'clientName' => 'console', - 'clientReference' => $this->_registry->getClient(), - ]); - } - - foreach ($providerRepository->getProviderSignatures() as $providerSignature) { - // create the metadata for the provider's cliProviderName - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'providerName', - 'value' => $ccToDashedFilter->filter($providerSignature->getName()), - 'reference' => $providerSignature, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'clientReference' => $this->_registry->getClient(), - ]); - - // create the metadatas for the per provider specialites in providerSpecaltyNames - foreach ($providerSignature->getSpecialties() as $specialty) { - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'specialtyName', - 'value' => $ccToDashedFilter->filter($specialty), - 'reference' => $providerSignature, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $specialty, - 'clientReference' => $this->_registry->getClient(), - ]); - } - - // $actionableMethod is keyed by the methodName (but not used) - foreach ($providerSignature->getActionableMethods() as $actionableMethodData) { - $methodLongParams = []; - $methodShortParams = []; - - // $actionableMethodData get both the long and short names - foreach ($actionableMethodData['parameterInfo'] as $parameterInfoData) { - // filter to dashed - $methodLongParams[$parameterInfoData['name']] = $ccToDashedFilter->filter($parameterInfoData['name']); - - // simply lower the character, (its only 1 char after all) - $methodShortParams[$parameterInfoData['name']] = strtolower((string) $parameterInfoData['name'][0]); - } - - // create metadata for the long name cliActionableMethodLongParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'actionableMethodLongParams', - 'value' => $methodLongParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData, - 'clientReference' => $this->_registry->getClient(), - ]); - - // create metadata for the short name cliActionableMethodShortParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'actionableMethodShortParams', - 'value' => $methodShortParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData, - 'clientReference' => $this->_registry->getClient(), - ]); - } - } - - return $metadatas; - } - - public function getIndex() - { - return 10000; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php deleted file mode 100644 index 2a278c2eb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php +++ /dev/null @@ -1,65 +0,0 @@ - '30m', - 'hiBlack' => '1;30m', - 'bgBlack' => '40m', - // reds - 'red' => '31m', - 'hiRed' => '1;31m', - 'bgRed' => '41m', - // greens - 'green' => '32m', - 'hiGreen' => '1;32m', - 'bgGreen' => '42m', - // yellows - 'yellow' => '33m', - 'hiYellow' => '1;33m', - 'bgYellow' => '43m', - // blues - 'blue' => '34m', - 'hiBlue' => '1;34m', - 'bgBlue' => '44m', - // magentas - 'magenta' => '35m', - 'hiMagenta' => '1;35m', - 'bgMagenta' => '45m', - // cyans - 'cyan' => '36m', - 'hiCyan' => '1;36m', - 'bgCyan' => '46m', - // whites - 'white' => '37m', - 'hiWhite' => '1;37m', - 'bgWhite' => '47m', - ]; - - public function getName() - { - return 'color'; - } - - public function decorate($content, $color) - { - if (is_string($color)) { - $color = [$color]; - } - - $newContent = ''; - - foreach ($color as $c) { - if (array_key_exists($c, $this->_colorOptions)) { - $newContent .= "\033[".$this->_colorOptions[$c]; - } - } - - $newContent .= $content."\033[m"; - - return $newContent; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php deleted file mode 100644 index 61e87a79d..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php +++ /dev/null @@ -1,57 +0,0 @@ -_client = $client; - - return $this; - } - - public function setInputRequest($inputRequest) - { - if (is_string($inputRequest)) { - // require_once 'Zend/Tool/Framework/Client/Interactive/InputRequest.php'; - $inputRequest = new Zend_Tool_Framework_Client_Interactive_InputRequest($inputRequest); - } elseif (!$inputRequest instanceof Zend_Tool_Framework_Client_Interactive_InputRequest) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('promptInteractive() requires either a string or an instance of Zend_Tool_Framework_Client_Interactive_InputRequest.'); - } - - $this->_inputRequest = $inputRequest; - - return $this; - } - - public function handle() - { - $inputResponse = $this->_client->handleInteractiveInputRequest($this->_inputRequest); - - if (is_string($inputResponse)) { - // require_once 'Zend/Tool/Framework/Client/Interactive/InputResponse.php'; - $inputResponse = new Zend_Tool_Framework_Client_Interactive_InputResponse($inputResponse); - } elseif (!$inputResponse instanceof Zend_Tool_Framework_Client_Interactive_InputResponse) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('The registered $_interactiveCallback for the client must either return a string or an instance of Zend_Tool_Framework_Client_Interactive_InputResponse.'); - } - - return $inputResponse; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/InputInterface.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/InputInterface.php deleted file mode 100644 index e18d441b6..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/InputInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -setContent($content); - } - } - - public function setContent($content) - { - $this->_content = $content; - - return $this; - } - - public function getContent() - { - return $this->_content; - } - - public function __toString() - { - return $this->_content; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/InputResponse.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/InputResponse.php deleted file mode 100644 index ae8ae69bb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/InputResponse.php +++ /dev/null @@ -1,51 +0,0 @@ -setContent($content); - } - } - - public function setContent($content) - { - $this->_content = $content; - - return $this; - } - - public function getContent() - { - return $this->_content; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/OutputInterface.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/OutputInterface.php deleted file mode 100644 index 78ae78adb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Interactive/OutputInterface.php +++ /dev/null @@ -1,32 +0,0 @@ -_registry = $registry; - - return $this; - } - - /** - * getMetadata() is required by the Manifest Interface. - * - * These are the following metadatas that will be setup: - * - * normalizedActionName - * - metadata for actions - * - value will be a dashed name for the action named in 'actionName' - * normalizedProviderName - * - metadata for providers - * - value will be a dashed-name for the provider named in 'providerName' - * normalizedProviderSpecialtyNames - * - metadata for providers - * normalizedActionableMethodLongParameters - * - metadata for providers - * normalizedActionableMethodShortParameters - * - metadata for providers - * - * @return array Array of Metadatas - */ - public function getMetadata() - { - $metadatas = []; - - // setup the camelCase to dashed filter to use since cli expects dashed named - $lowerFilter = new Zend_Filter(); - $lowerFilter->addFilter(new Zend_Filter_StringToLower()); - - // get the registry to get the action and provider repository - $actionRepository = $this->_registry->getActionRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - // loop through all actions and create a metadata for each - foreach ($actionRepository->getActions() as $action) { - // each action metadata will be called - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'normalizedActionName', - 'value' => $lowerFilter->filter($action->getName()), - 'reference' => $action, - 'actionName' => $action->getName(), - 'clientName' => 'all', - ]); - } - - foreach ($providerRepository->getProviderSignatures() as $providerSignature) { - // create the metadata for the provider's cliProviderName - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'normalizedProviderName', - 'value' => $lowerFilter->filter($providerSignature->getName()), - 'reference' => $providerSignature, - 'clientName' => 'all', - 'providerName' => $providerSignature->getName(), - ]); - - // create the metadatas for the per provider specialites in providerSpecaltyNames - foreach ($providerSignature->getSpecialties() as $specialty) { - if ('_Global' == $specialty) { - continue; - } - - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'normalizedSpecialtyName', - 'value' => $lowerFilter->filter($specialty), - 'reference' => $providerSignature, - 'clientName' => 'all', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $specialty, - ]); - } - - // $actionableMethod is keyed by the methodName (but not used) - foreach ($providerSignature->getActionableMethods() as $actionableMethodData) { - $methodLongParams = []; - $methodShortParams = []; - - // $actionableMethodData get both the long and short names - foreach ($actionableMethodData['parameterInfo'] as $parameterInfoData) { - // filter to dashed - $methodLongParams[$parameterInfoData['name']] = $lowerFilter->filter($parameterInfoData['name']); - - // simply lower the character, (its only 1 char after all) - $methodShortParams[$parameterInfoData['name']] = strtolower((string) $parameterInfoData['name'][0]); - } - - // create metadata for the long name cliActionableMethodLongParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'normalizedActionableMethodLongParams', - 'value' => $methodLongParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData, - ]); - - // create metadata for the short name cliActionableMethodShortParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool([ - 'name' => 'normalizedActionableMethodShortParams', - 'value' => $methodShortParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData, - ]); - } - } - - return $metadatas; - } - - public function getIndex() - { - return 100000; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Request.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Request.php deleted file mode 100644 index 27465beeb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Request.php +++ /dev/null @@ -1,315 +0,0 @@ -_providerName = $providerName; - - return $this; - } - - /** - * getProviderName(). - * - * @return string - */ - public function getProviderName() - { - return $this->_providerName; - } - - /** - * setSpecialtyName(). - * - * @param string $specialtyName - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setSpecialtyName($specialtyName) - { - $this->_specialtyName = $specialtyName; - - return $this; - } - - /** - * getSpecialtyName(). - * - * @return string - */ - public function getSpecialtyName() - { - return $this->_specialtyName; - } - - /** - * setActionName(). - * - * @param string $actionName - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setActionName($actionName) - { - $this->_actionName = $actionName; - - return $this; - } - - /** - * getActionName(). - * - * @return string - */ - public function getActionName() - { - return $this->_actionName; - } - - /** - * setActionParameter(). - * - * @param string $parameterName - * @param string $parameterValue - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setActionParameter($parameterName, $parameterValue) - { - $this->_actionParameters[$parameterName] = $parameterValue; - - return $this; - } - - /** - * getActionParameters(). - * - * @return array - */ - public function getActionParameters() - { - return $this->_actionParameters; - } - - /** - * getActionParameter(). - * - * @param string $parameterName - * - * @return string - */ - public function getActionParameter($parameterName) - { - return (isset($this->_actionParameters[$parameterName])) ? $this->_actionParameters[$parameterName] : null; - } - - /** - * setProviderParameter(). - * - * @param string $parameterName - * @param string $parameterValue - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setProviderParameter($parameterName, $parameterValue) - { - $this->_providerParameters[$parameterName] = $parameterValue; - - return $this; - } - - /** - * getProviderParameters(). - * - * @return array - */ - public function getProviderParameters() - { - return $this->_providerParameters; - } - - /** - * getProviderParameter(). - * - * @param string $parameterName - * - * @return string - */ - public function getProviderParameter($parameterName) - { - return (isset($this->_providerParameters[$parameterName])) ? $this->_providerParameters[$parameterName] : null; - } - - /** - * setPretend(). - * - * @param bool $pretend - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setPretend($pretend) - { - $this->_isPretend = (bool) $pretend; - - return $this; - } - - /** - * isPretend() - Whether or not this is a pretend request. - * - * @return bool - */ - public function isPretend() - { - return $this->_isPretend; - } - - /** - * setDebug(). - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setDebug($debug) - { - $this->_isDebug = (bool) $debug; - - return $this; - } - - /** - * isDebug() - Whether or not this is a debug enabled request. - * - * @return bool - */ - public function isDebug() - { - return $this->_isDebug; - } - - /** - * setVerbose(). - * - * @param bool $verbose - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setVerbose($verbose) - { - $this->_isVerbose = (bool) $verbose; - - return $this; - } - - /** - * isVerbose() - Whether or not this is a verbose enabled request. - * - * @return bool - */ - public function isVerbose() - { - return $this->_isVerbose; - } - - /** - * setDispatchable(). - * - * @param bool $dispatchable - * - * @return Zend_Tool_Framework_Client_Request - */ - public function setDispatchable($dispatchable) - { - $this->_isDispatchable = (bool) $dispatchable; - - return $this; - } - - /** - * isDispatchable() Is this request Dispatchable? - * - * @return bool - */ - public function isDispatchable() - { - return $this->_isDispatchable; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Response.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Response.php deleted file mode 100644 index 65d27ee00..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Response.php +++ /dev/null @@ -1,227 +0,0 @@ -_callback = $callback; - - return $this; - } - - /** - * setContent(). - * - * @param string $content - * - * @return Zend_Tool_Framework_Client_Response - */ - public function setContent($content, array $decoratorOptions = []) - { - $content = $this->_applyDecorators($content, $decoratorOptions); - - $this->_content = []; - $this->appendContent($content); - - return $this; - } - - /** - * appendCallback. - * - * @param string $content - * - * @return Zend_Tool_Framework_Client_Response - */ - public function appendContent($content, array $decoratorOptions = []) - { - $content = $this->_applyDecorators($content, $decoratorOptions); - - if (null !== $this->_callback) { - call_user_func($this->_callback, $content); - } - - $this->_content[] = $content; - - return $this; - } - - /** - * setDefaultDecoratorOptions(). - * - * @param bool $mergeIntoExisting - * - * @return Zend_Tool_Framework_Client_Response - */ - public function setDefaultDecoratorOptions(array $decoratorOptions, $mergeIntoExisting = false) - { - if (false == $mergeIntoExisting) { - $this->_defaultDecoratorOptions = []; - } - - $this->_defaultDecoratorOptions = array_merge($this->_defaultDecoratorOptions, $decoratorOptions); - - return $this; - } - - /** - * getContent(). - * - * @return string - */ - public function getContent() - { - return implode('', $this->_content); - } - - /** - * isException(). - * - * @return bool - */ - public function isException() - { - return isset($this->_exception); - } - - /** - * setException(). - * - * @return Zend_Tool_Framework_Client_Response - */ - public function setException(Throwable $exception) - { - $this->_exception = $exception; - - return $this; - } - - /** - * getException(). - * - * @return Throwable - */ - public function getException() - { - return $this->_exception; - } - - /** - * Add Content Decorator. - * - * @return Zend_Tool_Framework_Client_Response - */ - public function addContentDecorator(Zend_Tool_Framework_Client_Response_ContentDecorator_Interface $contentDecorator) - { - $decoratorName = strtolower((string) $contentDecorator->getName()); - $this->_decorators[$decoratorName] = $contentDecorator; - - return $this; - } - - /** - * getContentDecorators(). - * - * @return array - */ - public function getContentDecorators() - { - return $this->_decorators; - } - - /** - * __toString() to cast to a string. - * - * @return string - */ - public function __toString() - { - return (string) implode('', $this->_content); - } - - /** - * _applyDecorators() apply a group of decorators. - * - * @param string $content - * - * @return string - */ - protected function _applyDecorators($content, array $decoratorOptions) - { - $options = array_merge($this->_defaultDecoratorOptions, $decoratorOptions); - - $options = array_change_key_case($options, CASE_LOWER); - - if ($options) { - foreach ($this->_decorators as $decoratorName => $decorator) { - if (array_key_exists($decoratorName, $options)) { - $content = $decorator->decorate($content, $options[$decoratorName]); - } - } - } - - return $content; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php deleted file mode 100644 index b3c1016c7..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php +++ /dev/null @@ -1,34 +0,0 @@ -_separator = $separator; - - return $this; - } - - /** - * getSeparator(). - * - * @return string - */ - public function getSeparator() - { - return $this->_separator; - } - - public function decorate($content, $decoratorValue) - { - $run = 1; - if (is_bool($decoratorValue) && false === $decoratorValue) { - return $content; - } - - if (is_int($decoratorValue)) { - $run = $decoratorValue; - } - - for ($i = 0; $i < $run; ++$i) { - $content .= $this->_separator; - } - - return $content; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Storage.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Storage.php deleted file mode 100644 index edf64ff0c..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Storage.php +++ /dev/null @@ -1,117 +0,0 @@ -setAdapter($options['adapter']); - } - } - - public function setAdapter($adapter) - { - if (is_string($adapter)) { - $storageAdapterClass = 'Zend_Tool_Framework_Client_Storage_'.ucfirst($adapter); - if (!class_exists($storageAdapterClass)) { - Zend_Loader::loadClass($storageAdapterClass); - } - $adapter = new $storageAdapterClass(); - } - $this->_adapter = $adapter; - } - - public function isEnabled() - { - return $this->_adapter instanceof Zend_Tool_Framework_Client_Storage_AdapterInterface; - } - - public function put($name, $value) - { - if (!$this->_adapter) { - return false; - } - - $this->_adapter->put($name, $value); - - return $this; - } - - public function get($name, $defaultValue = false) - { - if (!$this->_adapter) { - return false; - } - - if ($this->_adapter->has($name)) { - return $this->_adapter->get($name); - } else { - return $defaultValue; - } - } - - public function has($name) - { - if (!$this->_adapter) { - return false; - } - - return $this->_adapter->has($name); - } - - public function remove($name) - { - if (!$this->_adapter) { - return false; - } - - $this->_adapter->remove($name); - - return $this; - } - - public function getStreamUri($name) - { - if (!$this->_adapter) { - return false; - } - - return $this->_adapter->getStreamUri($name); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Client/Storage/AdapterInterface.php b/packages/zend-tool/library/Zend/Tool/Framework/Client/Storage/AdapterInterface.php deleted file mode 100644 index 8d95406ab..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Client/Storage/AdapterInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -_directoryPath = $directoryPath; - } - - public function put($name, $value) - { - return file_put_contents($this->_directoryPath.DIRECTORY_SEPARATOR.$name, $value); - } - - public function get($name) - { - return file_get_contents($this->_directoryPath.DIRECTORY_SEPARATOR.$name); - } - - public function has($name) - { - return file_exists((string) $this->_directoryPath.DIRECTORY_SEPARATOR.$name); - } - - public function remove($name) - { - return unlink($this->_directoryPath.DIRECTORY_SEPARATOR.$name); - } - - public function getStreamUri($name) - { - return $this->_directoryPath.DIRECTORY_SEPARATOR.$name; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Exception.php b/packages/zend-tool/library/Zend/Tool/Framework/Exception.php deleted file mode 100644 index c4aa4e04b..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -_registry = $registry; - - return $this; - } - - /** - * load() - called by the client initialize routine to load files. - */ - public function load() - { - $this->_retrievedFiles = $this->getRetrievedFiles(); - $this->_loadedClasses = []; - - $manifestRepository = $this->_registry->getManifestRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - $loadedClasses = []; - - // loop through files and find the classes declared by loading the file - foreach ($this->_retrievedFiles as $file) { - if (is_dir($file)) { - continue; - } - - $classesLoadedBefore = get_declared_classes(); - $oldLevel = error_reporting(E_ALL | ~E_STRICT); // remove strict so that other packages wont throw warnings - // should we lint the files here? i think so - include_once $file; - error_reporting($oldLevel); // restore old error level - $classesLoadedAfter = get_declared_classes(); - $loadedClasses = array_merge($loadedClasses, array_diff($classesLoadedAfter, $classesLoadedBefore)); - } - - // loop through the loaded classes and ensure that - foreach ($loadedClasses as $loadedClass) { - // reflect class to see if its something we want to load - $reflectionClass = new ReflectionClass($loadedClass); - if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface') - && !$reflectionClass->isAbstract()) { - $manifestRepository->addManifest($reflectionClass->newInstance()); - $this->_loadedClasses[] = $loadedClass; - } - - if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface') - && !$reflectionClass->isAbstract() - && !$providerRepository->hasProvider($reflectionClass->getName(), false)) { - $providerRepository->addProvider($reflectionClass->newInstance()); - $this->_loadedClasses[] = $loadedClass; - } - } - - return $this->_loadedClasses; - } - - /** - * getRetrievedFiles(). - * - * @return array Array of Files Retrieved - */ - public function getRetrievedFiles() - { - if (null == $this->_retrievedFiles) { - $this->_retrievedFiles = $this->_getFiles(); - } - - return $this->_retrievedFiles; - } - - /** - * getLoadedClasses(). - * - * @return array Array of Loaded Classes - */ - public function getLoadedClasses() - { - return $this->_loadedClasses; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Loader/BasicLoader.php b/packages/zend-tool/library/Zend/Tool/Framework/Loader/BasicLoader.php deleted file mode 100644 index 2a06bb294..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Loader/BasicLoader.php +++ /dev/null @@ -1,155 +0,0 @@ -setOptions($options); - } - } - - public function setOptions(array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethod = 'set'.$optionName; - if (method_exists($this, $setMethod)) { - $this->{$setMethod}($optionValue); - } - } - } - - /** - * setRegistry() - required by the enabled interface to get an instance of - * the registry. - * - * @return Zend_Tool_Framework_Loader_BasicLoader - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - $this->_registry = $registry; - - return $this; - } - - /** - * @return Zend_Tool_Framework_Loader_BasicLoader - */ - public function setClassesToLoad(array $classesToLoad) - { - $this->_classesToLoad = $classesToLoad; - - return $this; - } - - public function load() - { - $manifestRegistry = $this->_registry->getManifestRepository(); - $providerRegistry = $this->_registry->getProviderRepository(); - - $loadedClasses = []; - - // loop through the loaded classes and ensure that - foreach ($this->_classesToLoad as $class) { - if (!class_exists($class)) { - Zend_Loader::loadClass($class); - } - - // reflect class to see if its something we want to load - $reflectionClass = new ReflectionClass($class); - if ($this->_isManifestImplementation($reflectionClass)) { - $manifestRegistry->addManifest($reflectionClass->newInstance()); - $loadedClasses[] = $class; - } - - if ($this->_isProviderImplementation($reflectionClass)) { - $providerRegistry->addProvider($reflectionClass->newInstance()); - $loadedClasses[] = $class; - } - } - - return $loadedClasses; - } - - /** - * @param ReflectionClass $reflectionClass - * - * @return bool - */ - private function _isManifestImplementation($reflectionClass) - { - return - $reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface') - && !$reflectionClass->isAbstract() - ; - } - - /** - * @param ReflectionClass $reflectionClass - * - * @return bool - */ - private function _isProviderImplementation($reflectionClass) - { - $providerRegistry = $this->_registry->getProviderRepository(); - - return - $reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface') - && !$reflectionClass->isAbstract() - && !$providerRegistry->hasProvider($reflectionClass->getName(), false) - ; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Loader/IncludePathLoader.php b/packages/zend-tool/library/Zend/Tool/Framework/Loader/IncludePathLoader.php deleted file mode 100644 index 3eebbcab7..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Loader/IncludePathLoader.php +++ /dev/null @@ -1,138 +0,0 @@ -_fileIsBlacklisted($file)) { - continue; - } - - // ensure that the same named file from separate include_paths is not loaded - $relativeItem = preg_replace('#^'.preg_quote($realIncludePath.DIRECTORY_SEPARATOR, '#').'#', '', $item->getRealPath()); - - // no links allowed here for now - if ($item->isLink()) { - continue; - } - - // no items that are relavitely the same are allowed - if (in_array($relativeItem, $relativeItems)) { - continue; - } - - $relativeItems[] = $relativeItem; - $files[] = $item->getRealPath(); - } - } - - return $files; - } - - /** - * @param string $file - * - * @return bool - */ - protected function _fileIsBlacklisted($file) - { - $blacklist = [ - 'PHPUnit'.DIRECTORY_SEPARATOR.'Framework', - 'Zend'.DIRECTORY_SEPARATOR.'OpenId'.DIRECTORY_SEPARATOR.'Provider', - ]; - - foreach ($blacklist as $blacklitedPattern) { - if (false !== strpos((string) $file, $blacklitedPattern)) { - return true; - } - } - - return false; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php b/packages/zend-tool/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php deleted file mode 100644 index 012c2b6b0..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php +++ /dev/null @@ -1,90 +0,0 @@ -_denyDirectoryPattern = $denyDirectoryPattern; - $this->_acceptFilePattern = $acceptFilePattern; - parent::__construct($iterator); - } - - /** - * accept() - Which iterable items to accept or deny, required by FilterInterface. - * - * @return bool - */ - #[ReturnTypeWillChange] - public function accept() - { - $currentNode = $this->current(); - $currentNodeRealPath = $currentNode->getRealPath(); - - // if the current node is a directory AND doesn't match the denyDirectory pattern, accept - if ($currentNode->isDir() - && !preg_match('#'.$this->_denyDirectoryPattern.'#', $currentNodeRealPath)) { - return true; - } - - // if the file matches the accept file pattern, accept - $acceptable = (preg_match('#'.$this->_acceptFilePattern.'#', $currentNodeRealPath)) ? true : false; - - return $acceptable; - } - - /** - * getChildren() - overridden from RecursiveFilterIterator to allow the persistence of - * the $_denyDirectoryPattern and the $_acceptFilePattern when sub iterators of this filter - * are needed to be created. - * - * @return object - */ - #[ReturnTypeWillChange] - public function getChildren() - { - if (empty($this->ref)) { - $this->ref = new ReflectionClass($this); - } - - return $this->ref->newInstance( - $this->getInnerIterator()->getChildren(), - $this->_denyDirectoryPattern, - $this->_acceptFilePattern - ); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Loader/Interface.php b/packages/zend-tool/library/Zend/Tool/Framework/Loader/Interface.php deleted file mode 100644 index d4bb274cb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Loader/Interface.php +++ /dev/null @@ -1,41 +0,0 @@ -_registry = $registry; - - return $this; - } - - /** - * addManifest() - Add a manifest for later processing. - * - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function addManifest(Zend_Tool_Framework_Manifest_Interface $manifest) - { - // we need to get an index number so that manifests with - // higher indexes have priority over others - $index = count($this->_manifests); - - if ($manifest instanceof Zend_Tool_Framework_Registry_EnabledInterface) { - $manifest->setRegistry($this->_registry); - } - - // if the manifest supplies a getIndex() method, use it - if ($manifest instanceof Zend_Tool_Framework_Manifest_Indexable) { - $index = $manifest->getIndex(); - } - - // get the required objects from the framework registry - $actionRepository = $this->_registry->getActionRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - // load providers if interface supports that method - if ($manifest instanceof Zend_Tool_Framework_Manifest_ProviderManifestable) { - $providers = $manifest->getProviders(); - if (!is_array($providers)) { - $providers = [$providers]; - } - - foreach ($providers as $provider) { - // if provider is a string, try and load it as an object - if (is_string($provider)) { - $provider = new $provider(); - } - - if (!$provider instanceof Zend_Tool_Framework_Provider_Interface) { - // require_once 'Zend/Tool/Framework/Manifest/Exception.php'; - throw new Zend_Tool_Framework_Manifest_Exception('A provider provided by the '.get_class($manifest).' does not implement Zend_Tool_Framework_Provider_Interface'); - } - if (!$providerRepository->hasProvider($provider, false)) { - $providerRepository->addProvider($provider); - } - } - } - - // load actions if interface supports that method - if ($manifest instanceof Zend_Tool_Framework_Manifest_ActionManifestable) { - $actions = $manifest->getActions(); - if (!is_array($actions)) { - $actions = [$actions]; - } - - foreach ($actions as $action) { - if (is_string($action)) { - $action = new Zend_Tool_Framework_Action_Base($action); - } - $actionRepository->addAction($action); - } - } - - // should we detect collisions here? does it even matter? - $this->_manifests[$index] = $manifest; - ksort($this->_manifests); - - return $this; - } - - /** - * getManifests(). - * - * @return Zend_Tool_Framework_Manifest_Interface[] - */ - public function getManifests() - { - return $this->_manifests; - } - - /** - * addMetadata() - add a metadata peice by peice. - * - * @param Zend_Tool_Framework_Manifest_Metadata $metadata - * - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function addMetadata(Zend_Tool_Framework_Metadata_Interface $metadata) - { - $this->_metadatas[] = $metadata; - - return $this; - } - - /** - * process() - Process is expected to be called at the end of client construction time. - * By this time, the loader has run and loaded any found manifests into the repository - * for loading. - * - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function process() - { - foreach ($this->_manifests as $manifest) { - if ($manifest instanceof Zend_Tool_Framework_Manifest_MetadataManifestable) { - $metadatas = $manifest->getMetadata(); - if (!is_array($metadatas)) { - $metadatas = [$metadatas]; - } - - foreach ($metadatas as $metadata) { - if (is_array($metadata)) { - if (!class_exists('Zend_Tool_Framework_Metadata_Dynamic')) { - // require_once 'Zend/Tool/Framework/Metadata/Dynamic.php'; - } - $metadata = new Zend_Tool_Framework_Metadata_Dynamic($metadata); - } - - if (!$metadata instanceof Zend_Tool_Framework_Metadata_Interface) { - // require_once 'Zend/Tool/Framework/Manifest/Exception.php'; - throw new Zend_Tool_Framework_Manifest_Exception('A Zend_Tool_Framework_Metadata_Interface object was not found in manifest '.get_class($manifest)); - } - - $this->addMetadata($metadata); - } - } - } - - return $this; - } - - /** - * getMetadatas() - This is the main search function for the repository. - * - * example: This will retrieve all metadata that matches the following criteria - * $manifestRepo->getMetadatas(array( - * 'providerName' => 'Version', - * 'actionName' => 'show' - * )); - * - * @param bool $includeNonExistentProperties - * - * @return Zend_Tool_Framework_Manifest_Metadata[] - */ - public function getMetadatas(array $searchProperties = [], $includeNonExistentProperties = true) - { - $returnMetadatas = []; - - // loop through the metadatas so that we can search each individual one - foreach ($this->_metadatas as $metadata) { - // each value will be retrieved from the metadata, each metadata should - // implement a getter method to retrieve the value - foreach ($searchProperties as $searchPropertyName => $searchPropertyValue) { - if (method_exists($metadata, 'get'.$searchPropertyName)) { - if ($metadata->{'get'.$searchPropertyName}() != $searchPropertyValue) { - // if the metadata supports a specific property but the value does not - // match, move on - continue 2; - } - } elseif (!$includeNonExistentProperties) { - // if the option $includeNonExitentProperties is false, then move on as - // we dont want to include this metadata if non existent - // search properties are not inside the target (current) metadata - continue 2; - } - } - - // all searching has been accounted for, if we reach this point, then the metadata - // is good and we can return it - $returnMetadatas[] = $metadata; - } - - return $returnMetadatas; - } - - /** - * getMetadata() - This will proxy to getMetadatas(), but will only return a single metadata. This method - * should be used in situations where the search criteria is known to only find a single metadata object. - * - * @param bool $includeNonExistentProperties - * - * @return Zend_Tool_Framework_Manifest_Metadata - */ - public function getMetadata(array $searchProperties = [], $includeNonExistentProperties = true) - { - $metadatas = $this->getMetadatas($searchProperties, $includeNonExistentProperties); - - return array_shift($metadatas); - } - - /** - * __toString() - cast to string. - * - * @return string - */ - public function __toString() - { - $metadatasByType = []; - - foreach ($this->_metadatas as $metadata) { - if (!array_key_exists($metadata->getType(), $metadatasByType)) { - $metadatasByType[$metadata->getType()] = []; - } - $metadatasByType[$metadata->getType()][] = $metadata; - } - - $string = ''; - foreach ($metadatasByType as $type => $metadatas) { - $string .= $type.PHP_EOL; - foreach ($metadatas as $metadata) { - $metadataString = ' '.$metadata->__toString().PHP_EOL; - // $metadataString = str_replace((string) PHP_EOL, PHP_EOL . ' ', $metadataString); - $string .= $metadataString; - } - } - - return $string; - } - - /** - * count() - required by the Countable Interface. - * - * @return int - */ - #[ReturnTypeWillChange] - public function count() - { - return count($this->_metadatas); - } - - /** - * getIterator() - required by the IteratorAggregate interface. - * - * @return ArrayIterator - */ - #[ReturnTypeWillChange] - public function getIterator() - { - return new ArrayIterator($this->_metadatas); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Attributable.php b/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Attributable.php deleted file mode 100644 index 1984c05e6..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Attributable.php +++ /dev/null @@ -1,32 +0,0 @@ -setOptions($options); - } - } - - /** - * setOptions() - standard issue implementation, this will set any - * options that are supported via a set method. - * - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setOptions(array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethod = 'set'.$optionName; - if (method_exists($this, $setMethod)) { - $this->{$setMethod}($optionValue); - } - } - - return $this; - } - - /** - * getType(). - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * setType(). - * - * @param string $type - * - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setType($type) - { - $this->_type = $type; - - return $this; - } - - /** - * getName(). - * - * @return string|null - */ - public function getName() - { - return $this->_name; - } - - /** - * setName(). - * - * @param string $name - * - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - /** - * getValue(). - */ - public function getValue() - { - return $this->_value; - } - - /** - * setValue(). - * - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * setReference(). - * - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setReference($reference) - { - $this->_reference = $reference; - - return $this; - } - - /** - * getReference(). - */ - public function getReference() - { - return $this->_reference; - } - - /** - * getAttributes() - this will retrieve any attributes of this object that exist as properties - * This is most useful for printing metadata. - * - * @param const $type - * - * @return array - */ - public function getAttributes($type = self::ATTRIBUTES_ALL, $stringRepresentationOfNonScalars = false) - { - $thisReflection = new ReflectionObject($this); - - $metadataPairValues = []; - - foreach (get_object_vars($this) as $varName => $varValue) { - if (self::ATTRIBUTES_NO_PARENT == $type && ('Zend_Tool_Framework_Metadata_Basic' == $thisReflection->getProperty($varName)->getDeclaringClass()->getName())) { - continue; - } - - if ($stringRepresentationOfNonScalars) { - if (is_object($varValue)) { - $varValue = '(object)'; - } - - if (null === $varValue) { - $varValue = '(null)'; - } - } - - $metadataPairValues[ltrim((string) $varName, '_')] = $varValue; - } - - return $metadataPairValues; - } - - /** - * __toString() - string representation of this object. - * - * @return string - */ - public function __toString() - { - return 'Type: '.$this->_type.', Name: '.$this->_name.', Value: '.(is_array($this->_value) ? http_build_query($this->_value) : (string) $this->_value); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Dynamic.php b/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Dynamic.php deleted file mode 100644 index a75f7dc68..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Dynamic.php +++ /dev/null @@ -1,223 +0,0 @@ -setOptions($options); - } - } - - public function setOptions(array $options = []) - { - foreach ($options as $optName => $optValue) { - $methodName = 'set'.$optName; - $this->{$methodName}($optValue); - } - } - - /** - * setType(). - * - * @param string $type - * - * @return Zend_Tool_Framework_Metadata_Dynamic - */ - public function setType($type) - { - $this->_type = $type; - - return $this; - } - - /** - * getType(). - * - * The type of metadata this describes - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * setName(). - * - * @param string $name - * - * @return Zend_Tool_Framework_Metadata_Dynamic - */ - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - /** - * getName(). - * - * Metadata name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * setValue(). - * - * @return Zend_Tool_Framework_Metadata_Dynamic - */ - public function setValue($value) - { - $this->_value = $value; - - return $this; - } - - /** - * getValue(). - * - * Metadata Value - * - * @return string - */ - public function getValue() - { - return $this->_value; - } - - public function getAttributes() - { - return $this->_dynamicAttributes; - } - - /** - * __isset(). - * - * Check if an attrbute is set - * - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - return isset($this->_dynamicAttributes[$name]); - } - - /** - * __unset(). - * - * @param string $name - * - * @return null - */ - public function __unset($name) - { - unset($this->_dynamicAttributes[$name]); - - return; - } - - /** - * __get() - Get a property via property call $metadata->foo. - * - * @param string $name - */ - public function __get($name) - { - if (method_exists($this, 'get'.$name)) { - return $this->{'get'.$name}(); - } elseif (array_key_exists($name, $this->_dynamicAttributes)) { - return $this->_dynamicAttributes[$name]; - } else { - // require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Property '.$name.' was not located in this metadata.'); - } - } - - /** - * __set() - Set a property via the magic set $metadata->foo = 'foo'. - * - * @param string $name - */ - public function __set($name, $value) - { - if (method_exists($this, 'set'.$name)) { - $this->{'set'.$name}($value); - - return $this; - } else { - $this->_dynamicAttributes[$name] = $value; - - return $this; - } - // { - // // require_once 'Zend/Tool/Framework/Registry/Exception.php'; - // throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this registry.'); - // } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Interface.php b/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Interface.php deleted file mode 100644 index 5f4e31869..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Metadata/Interface.php +++ /dev/null @@ -1,47 +0,0 @@ -_clientName = $clientName; - - return $this; - } - - public function getClientName() - { - return $this->_clientName; - } - - /** - * setActionName(). - * - * @param string $actionName - * - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setActionName($actionName) - { - $this->_actionName = $actionName; - - return $this; - } - - /** - * getActionName(). - * - * @return string|null - */ - public function getActionName() - { - return $this->_actionName; - } - - /** - * setProviderName(). - * - * @param string $providerName - * - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setProviderName($providerName) - { - $this->_providerName = $providerName; - - return $this; - } - - /** - * getProviderName(). - * - * @return string|null - */ - public function getProviderName() - { - return $this->_providerName; - } - - /** - * setSpecialtyName(). - * - * @param string $specialtyName - * - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setSpecialtyName($specialtyName) - { - $this->_specialtyName = $specialtyName; - - return $this; - } - - /** - * getSpecialtyName(). - * - * @return string|null - */ - public function getSpecialtyName() - { - return $this->_specialtyName; - } - - /** - * setClientReference(). - * - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setClientReference(Zend_Tool_Framework_Client_Abstract $client) - { - $this->_clientReference = $client; - - return $this; - } - - /** - * getClientReference(). - * - * @return string|null - */ - public function getClientReference() - { - return $this->_clientReference; - } - - /** - * setActionReference(). - * - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setActionReference(Zend_Tool_Framework_Action_Interface $action) - { - $this->_actionReference = $action; - - return $this; - } - - /** - * getActionReference(). - * - * @return Zend_Tool_Framework_Action_Interface|null - */ - public function getActionReference() - { - return $this->_actionReference; - } - - /** - * setProviderReference(). - * - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setProviderReference(Zend_Tool_Framework_Provider_Interface $provider) - { - $this->_providerReference = $provider; - - return $this; - } - - /** - * getProviderReference(). - * - * @return Zend_Tool_Framework_Provider_Interface|null - */ - public function getProviderReference() - { - return $this->_providerReference; - } - - /** - * __toString() cast to string. - * - * @return string - */ - public function __toString() - { - $string = parent::__toString(); - $string .= ' (ProviderName: '.$this->_providerName - .', ActionName: '.$this->_actionName - .', SpecialtyName: '.$this->_specialtyName - .')'; - - return $string; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Provider/Abstract.php b/packages/zend-tool/library/Zend/Tool/Framework/Provider/Abstract.php deleted file mode 100644 index 9874c4fa3..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Provider/Abstract.php +++ /dev/null @@ -1,62 +0,0 @@ -_registry = $registry; - - return $this; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Provider/DocblockManifestable.php b/packages/zend-tool/library/Zend/Tool/Framework/Provider/DocblockManifestable.php deleted file mode 100644 index 1e7c36d0b..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Provider/DocblockManifestable.php +++ /dev/null @@ -1,31 +0,0 @@ -_registry = $registry; - - return $this; - } - - /** - * Set the ProcessOnAdd flag. - * - * @param unknown_type $processOnAdd - * - * @return Zend_Tool_Framework_Provider_Repository - */ - public function setProcessOnAdd($processOnAdd = true) - { - $this->_processOnAdd = (bool) $processOnAdd; - - return $this; - } - - /** - * Add a provider to the repository for processing. - * - * @return Zend_Tool_Framework_Provider_Repository - */ - public function addProvider(Zend_Tool_Framework_Provider_Interface $provider, $overwriteExistingProvider = false) - { - if ($provider instanceof Zend_Tool_Framework_Registry_EnabledInterface) { - $provider->setRegistry($this->_registry); - } - - if (method_exists($provider, 'getName')) { - $providerName = $provider->getName(); - } else { - $providerName = $this->_parseName($provider); - } - - // if a provider by the given name already exist, and its not set as overwritable, throw exception - if (!$overwriteExistingProvider - && (array_key_exists($providerName, $this->_unprocessedProviders) - || array_key_exists($providerName, $this->_providers))) { - // require_once 'Zend/Tool/Framework/Provider/Exception.php'; - throw new Zend_Tool_Framework_Provider_Exception('A provider by the name '.$providerName.' is already registered and $overrideExistingProvider is set to false.'); - } - - $this->_unprocessedProviders[$providerName] = $provider; - - // if process has already been called, process immediately. - if ($this->_processOnAdd) { - $this->process(); - } - - return $this; - } - - public function hasProvider($providerOrClassName, $processedOnly = true) - { - if ($providerOrClassName instanceof Zend_Tool_Framework_Provider_Interface) { - $targetProviderClassName = get_class($providerOrClassName); - } else { - $targetProviderClassName = (string) $providerOrClassName; - } - - if (!$processedOnly) { - foreach ($this->_unprocessedProviders as $unprocessedProvider) { - if (get_class($unprocessedProvider) == $targetProviderClassName) { - return true; - } - } - } - - foreach ($this->_providers as $processedProvider) { - if (get_class($processedProvider) == $targetProviderClassName) { - return true; - } - } - - return false; - } - - /** - * Process all of the unprocessed providers. - */ - public function process() - { - // process all providers in the unprocessedProviders array - // foreach ($this->_unprocessedProviders as $providerName => $provider) { - reset($this->_unprocessedProviders); - while ($this->_unprocessedProviders) { - $providerName = key($this->_unprocessedProviders); - $provider = array_shift($this->_unprocessedProviders); - - // create a signature for the provided provider - $providerSignature = new Zend_Tool_Framework_Provider_Signature($provider); - - if ($providerSignature instanceof Zend_Tool_Framework_Registry_EnabledInterface) { - $providerSignature->setRegistry($this->_registry); - } - - $providerSignature->process(); - - // ensure the name is lowercased for easier searching - $providerName = strtolower((string) $providerName); - - // add to the appropraite place - $this->_providerSignatures[$providerName] = $providerSignature; - $this->_providers[$providerName] = $providerSignature->getProvider(); - - if ($provider instanceof Zend_Tool_Framework_Provider_Initializable) { - $provider->initialize(); - } - } - } - - /** - * getProviders() Get all the providers in the repository. - * - * @return array - */ - public function getProviders() - { - return $this->_providers; - } - - /** - * getProviderSignatures() Get all the provider signatures. - * - * @return array - */ - public function getProviderSignatures() - { - return $this->_providerSignatures; - } - - /** - * getProvider(). - * - * @param string $providerName - * - * @return Zend_Tool_Framework_Provider_Interface - */ - public function getProvider($providerName) - { - return $this->_providers[strtolower((string) $providerName)]; - } - - /** - * getProviderSignature(). - * - * @param string $providerName - * - * @return Zend_Tool_Framework_Provider_Signature - */ - public function getProviderSignature($providerName) - { - return $this->_providerSignatures[strtolower((string) $providerName)]; - } - - /** - * count() - return the number of providers. - * - * @return int - */ - #[ReturnTypeWillChange] - public function count() - { - return count($this->_providers); - } - - /** - * getIterator() - Required by the IteratorAggregate Interface. - * - * @return ArrayIterator - */ - #[ReturnTypeWillChange] - public function getIterator() - { - return new ArrayIterator($this->getProviders()); - } - - /** - * _parseName - internal method to determine the name of an action when one is not explicity provided. - * - * @return string - */ - protected function _parseName(Zend_Tool_Framework_Provider_Interface $provider) - { - $className = get_class($provider); - $providerName = $className; - if (false !== strpos((string) $providerName, '_')) { - $providerName = substr((string) $providerName, strrpos($providerName, '_') + 1); - } - if ('Provider' == substr((string) $providerName, -8)) { - $providerName = substr((string) $providerName, 0, strlen((string) $providerName) - 8); - } - - return $providerName; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Provider/Signature.php b/packages/zend-tool/library/Zend/Tool/Framework/Provider/Signature.php deleted file mode 100644 index 40b93f398..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Provider/Signature.php +++ /dev/null @@ -1,374 +0,0 @@ -_provider = $provider; - $this->_providerReflection = new Zend_Reflection_Class($provider); - } - - /** - * setRegistry(). - * - * @return Zend_Tool_Framework_Provider_Signature - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - $this->_registry = $registry; - - return $this; - } - - public function process() - { - if ($this->_isProcessed) { - return; - } - - $this->_process(); - } - - /** - * getName() of the provider. - * - * @return string|null - */ - public function getName() - { - return $this->_name; - } - - /** - * Get the provider for this signature. - * - * @return Zend_Tool_Framework_Provider_Interface - */ - public function getProvider() - { - return $this->_provider; - } - - /** - * getProviderReflection(). - * - * @return Zend_Reflection_Class - */ - public function getProviderReflection() - { - return $this->_providerReflection; - } - - /** - * getSpecialities(). - * - * @return array - */ - public function getSpecialties() - { - return $this->_specialties; - } - - /** - * getActions(). - * - * @return array Array of Actions - */ - public function getActions() - { - return $this->_actions; - } - - /** - * getActionableMethods(). - * - * @return array - */ - public function getActionableMethods() - { - return $this->_actionableMethods; - } - - /** - * getActionableMethod() - Get an actionable method by name, this will return an array of - * useful information about what can be exectued on this provider. - * - * @param string $methodName - * - * @return array - */ - public function getActionableMethod($methodName) - { - if (isset($this->_actionableMethods[$methodName])) { - return $this->_actionableMethods[$methodName]; - } - - return false; - } - - /** - * getActionableMethodByActionName() - Get an actionable method by its action name, this - * will return an array of useful information about what can be exectued on this provider. - * - * @param string $actionName - * - * @return array - */ - public function getActionableMethodByActionName($actionName, $specialtyName = '_Global') - { - foreach ($this->_actionableMethods as $actionableMethod) { - if ($actionName == $actionableMethod['actionName'] - && $specialtyName == $actionableMethod['specialty']) { - return $actionableMethod; - } - } - - return false; - } - - /** - * _process() is called at construction time and is what will build the signature information - * for determining what is actionable. - */ - protected function _process() - { - $this->_isProcessed = true; - $this->_processName(); - $this->_processSpecialties(); - $this->_processActionableMethods(); - } - - /** - * _processName();. - */ - protected function _processName() - { - if (method_exists($this->_provider, 'getName')) { - $this->_name = $this->_provider->getName(); - } - - if (null == $this->_name) { - $className = get_class($this->_provider); - $name = $className; - if (strpos((string) $name, '_')) { - $name = substr((string) $name, strrpos($name, '_') + 1); - } - $name = preg_replace('#(Provider|Manifest)$#', '', $name); - $this->_name = $name; - } - } - - /** - * _processSpecialties() - Break out the specialty names for this provider. - */ - protected function _processSpecialties() - { - $specialties = []; - - if ($this->_providerReflection->hasMethod('getSpecialties')) { - $specialties = $this->_provider->getSpecialties(); - if (!is_array($specialties)) { - // require_once 'Zend/Tool/Framework/Provider/Exception.php'; - throw new Zend_Tool_Framework_Provider_Exception('Provider '.get_class($this->_provider).' must return an array for method getSpecialties().'); - } - } else { - $defaultProperties = $this->_providerReflection->getDefaultProperties(); - $specialties = (isset($defaultProperties['_specialties'])) ? $defaultProperties['_specialties'] : []; - if (!is_array($specialties)) { - // require_once 'Zend/Tool/Framework/Provider/Exception.php'; - throw new Zend_Tool_Framework_Provider_Exception('Provider '.get_class($this->_provider).'\'s property $_specialties must be an array.'); - } - } - - $this->_specialties = array_merge(['_Global'], $specialties); - } - - /** - * _processActionableMethods() - process all methods that can be called on this provider. - */ - protected function _processActionableMethods() - { - $specialtyRegex = '#(.*)('.implode('|', $this->_specialties).')$#i'; - - $methods = $this->_providerReflection->getMethods(); - - $actionableMethods = []; - foreach ($methods as $method) { - $methodName = $method->getName(); - - /* - * the following will determine what methods are actually actionable - * public, non-static, non-underscore prefixed, classes that dont - * contain the name " - */ - if (!$method->getDeclaringClass()->isInstantiable() - || !$method->isPublic() - || '_' == $methodName[0] - || $method->isStatic() - || in_array($methodName, ['getContextClasses', 'getName']) // other protected public methods will nee to go here - ) { - continue; - } - - /* - * check to see if the method was a required method by a Zend_Tool_* interface - */ - foreach ($method->getDeclaringClass()->getInterfaces() as $methodDeclaringClassInterface) { - if (0 === strpos((string) $methodDeclaringClassInterface->getName(), 'Zend_Tool_') - && $methodDeclaringClassInterface->hasMethod($methodName)) { - continue 2; - } - } - - $actionableName = ucfirst($methodName); - - if ('Action' == substr((string) $actionableName, -6)) { - $actionableName = substr((string) $actionableName, 0, -6); - } - - $actionableMethods[$methodName]['methodName'] = $methodName; - - $matches = null; - if (preg_match($specialtyRegex, $actionableName, $matches)) { - $actionableMethods[$methodName]['actionName'] = $matches[1]; - $actionableMethods[$methodName]['specialty'] = $matches[2]; - } else { - $actionableMethods[$methodName]['actionName'] = $actionableName; - $actionableMethods[$methodName]['specialty'] = '_Global'; - } - - // get the action, and create non-existent actions when they dont exist (the true part below) - $action = $this->_registry->getActionRepository()->getAction($actionableMethods[$methodName]['actionName']); - if (null == $action) { - $action = new Zend_Tool_Framework_Action_Base($actionableMethods[$methodName]['actionName']); - $this->_registry->getActionRepository()->addAction($action); - } - $actionableMethods[$methodName]['action'] = $action; - - if (!in_array($actionableMethods[$methodName]['action'], $this->_actions)) { - $this->_actions[] = $actionableMethods[$methodName]['action']; - } - - $parameterInfo = []; - $position = 1; - foreach ($method->getParameters() as $parameter) { - $currentParam = $parameter->getName(); - $parameterInfo[$currentParam]['position'] = $position++; - $parameterInfo[$currentParam]['optional'] = $parameter->isOptional(); - $parameterInfo[$currentParam]['default'] = ($parameter->isOptional()) ? $parameter->getDefaultValue() : null; - $parameterInfo[$currentParam]['name'] = $currentParam; - $parameterInfo[$currentParam]['type'] = 'string'; - $parameterInfo[$currentParam]['description'] = null; - } - - $matches = null; - if (($docComment = $method->getDocComment()) != '' - && preg_match_all('/@param\s+(\w+)+\s+(\$\S+)\s+(.*?)(?=(?:\*\s*@)|(?:\*\/))/s', $docComment, $matches)) { - for ($i = 0; $i <= count($matches[0]) - 1; ++$i) { - $currentParam = ltrim((string) $matches[2][$i], '$'); - - if ('' != $currentParam && isset($parameterInfo[$currentParam])) { - $parameterInfo[$currentParam]['type'] = $matches[1][$i]; - - $descriptionSource = $matches[3][$i]; - - if ('' != $descriptionSource) { - $parameterInfo[$currentParam]['description'] = \trim((string) $descriptionSource); - } - } - } - } - - $actionableMethods[$methodName]['parameterInfo'] = $parameterInfo; - } - - $this->_actionableMethods = $actionableMethods; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Registry.php b/packages/zend-tool/library/Zend/Tool/Framework/Registry.php deleted file mode 100644 index 6307bc5e4..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Registry.php +++ /dev/null @@ -1,419 +0,0 @@ -_client); - unset($this->_loader); - unset($this->_actionRepository); - unset($this->_providerRepository); - unset($this->_request); - unset($this->_response); - } - - // public function __construct() - // { - // // no instantiation from outside - // } - - /** - * Enter description here... - * - * @return Zend_Tool_Framework_Registry - */ - public function setClient(Zend_Tool_Framework_Client_Abstract $client) - { - $this->_client = $client; - if ($this->isObjectRegistryEnablable($this->_client)) { - $this->enableRegistryOnObject($this->_client); - } - - return $this; - } - - /** - * getClient() return the client in the registry. - * - * @return Zend_Tool_Framework_Client_Abstract - */ - public function getClient() - { - return $this->_client; - } - - /** - * setConfig(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setConfig(Zend_Tool_Framework_Client_Config $config) - { - $this->_config = $config; - - return $this; - } - - /** - * getConfig(). - * - * @return Zend_Tool_Framework_Client_Config - */ - public function getConfig() - { - if (null === $this->_config) { - // require_once 'Zend/Tool/Framework/Client/Config.php'; - $this->setConfig(new Zend_Tool_Framework_Client_Config()); - } - - return $this->_config; - } - - /** - * setStorage(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setStorage(Zend_Tool_Framework_Client_Storage $storage) - { - $this->_storage = $storage; - - return $this; - } - - /** - * getConfig(). - * - * @return Zend_Tool_Framework_Client_Storage - */ - public function getStorage() - { - if (null === $this->_storage) { - // require_once 'Zend/Tool/Framework/Client/Storage.php'; - $this->setStorage(new Zend_Tool_Framework_Client_Storage()); - } - - return $this->_storage; - } - - /** - * setLoader(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setLoader(Zend_Tool_Framework_Loader_Interface $loader) - { - $this->_loader = $loader; - if ($this->isObjectRegistryEnablable($this->_loader)) { - $this->enableRegistryOnObject($this->_loader); - } - - return $this; - } - - /** - * getLoader(). - * - * @return Zend_Tool_Framework_Loader_Abstract - */ - public function getLoader() - { - if (null === $this->_loader) { - // require_once 'Zend/Tool/Framework/Loader/IncludePathLoader.php'; - $this->setLoader(new Zend_Tool_Framework_Loader_IncludePathLoader()); - } - - return $this->_loader; - } - - /** - * setActionRepository(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setActionRepository(Zend_Tool_Framework_Action_Repository $actionRepository) - { - $this->_actionRepository = $actionRepository; - if ($this->isObjectRegistryEnablable($this->_actionRepository)) { - $this->enableRegistryOnObject($this->_actionRepository); - } - - return $this; - } - - /** - * getActionRepository(). - * - * @return Zend_Tool_Framework_Action_Repository - */ - public function getActionRepository() - { - if (null == $this->_actionRepository) { - // require_once 'Zend/Tool/Framework/Action/Repository.php'; - $this->setActionRepository(new Zend_Tool_Framework_Action_Repository()); - } - - return $this->_actionRepository; - } - - /** - * setProviderRepository(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setProviderRepository(Zend_Tool_Framework_Provider_Repository $providerRepository) - { - $this->_providerRepository = $providerRepository; - if ($this->isObjectRegistryEnablable($this->_providerRepository)) { - $this->enableRegistryOnObject($this->_providerRepository); - } - - return $this; - } - - /** - * getProviderRepository(). - * - * @return Zend_Tool_Framework_Provider_Repository - */ - public function getProviderRepository() - { - if (null == $this->_providerRepository) { - // require_once 'Zend/Tool/Framework/Provider/Repository.php'; - $this->setProviderRepository(new Zend_Tool_Framework_Provider_Repository()); - } - - return $this->_providerRepository; - } - - /** - * setManifestRepository(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setManifestRepository(Zend_Tool_Framework_Manifest_Repository $manifestRepository) - { - $this->_manifestRepository = $manifestRepository; - if ($this->isObjectRegistryEnablable($this->_manifestRepository)) { - $this->enableRegistryOnObject($this->_manifestRepository); - } - - return $this; - } - - /** - * getManifestRepository(). - * - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function getManifestRepository() - { - if (null == $this->_manifestRepository) { - // require_once 'Zend/Tool/Framework/Manifest/Repository.php'; - $this->setManifestRepository(new Zend_Tool_Framework_Manifest_Repository()); - } - - return $this->_manifestRepository; - } - - /** - * setRequest(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setRequest(Zend_Tool_Framework_Client_Request $request) - { - $this->_request = $request; - - return $this; - } - - /** - * getRequest(). - * - * @return Zend_Tool_Framework_Client_Request - */ - public function getRequest() - { - if (null == $this->_request) { - // require_once 'Zend/Tool/Framework/Client/Request.php'; - $this->setRequest(new Zend_Tool_Framework_Client_Request()); - } - - return $this->_request; - } - - /** - * setResponse(). - * - * @return Zend_Tool_Framework_Registry - */ - public function setResponse(Zend_Tool_Framework_Client_Response $response) - { - $this->_response = $response; - - return $this; - } - - /** - * getResponse(). - * - * @return Zend_Tool_Framework_Client_Response - */ - public function getResponse() - { - if (null == $this->_response) { - // require_once 'Zend/Tool/Framework/Client/Response.php'; - $this->setResponse(new Zend_Tool_Framework_Client_Response()); - } - - return $this->_response; - } - - /** - * __get() - Get a property via property call $registry->foo. - * - * @param string $name - */ - public function __get($name) - { - if (method_exists($this, 'get'.$name)) { - return $this->{'get'.$name}(); - } else { - // require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Property '.$name.' was not located in this registry.'); - } - } - - /** - * __set() - Set a property via the magic set $registry->foo = 'foo'. - * - * @param string $name - */ - public function __set($name, $value) - { - if (method_exists($this, 'set'.$name)) { - $this->{'set'.$name}($value); - - return; - } else { - // require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Property '.$name.' was not located in this registry.'); - } - } - - /** - * isObjectRegistryEnablable() - Check whether an object is registry enablable. - * - * @param object $object - * - * @return bool - */ - public function isObjectRegistryEnablable($object) - { - if (!is_object($object)) { - // require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('isObjectRegistryEnablable() expects an object.'); - } - - return $object instanceof Zend_Tool_Framework_Registry_EnabledInterface; - } - - /** - * enableRegistryOnObject() - make an object registry enabled. - * - * @param object $object - * - * @return Zend_Tool_Framework_Registry - */ - public function enableRegistryOnObject($object) - { - if (!$this->isObjectRegistryEnablable($object)) { - // require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Object provided is not registry enablable, check first with Zend_Tool_Framework_Registry::isObjectRegistryEnablable()'); - } - - $object->setRegistry($this); - - return $this; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/Registry/EnabledInterface.php b/packages/zend-tool/library/Zend/Tool/Framework/Registry/EnabledInterface.php deleted file mode 100644 index 81d537394..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/Registry/EnabledInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -_registry->getConfig(); - - $resp = $this->_registry->getResponse(); - if ($userConfig->exists()) { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception('A configuration already exists, cannot create a new one.'); - } - - $homeDirectory = $this->_detectHomeDirectory(); - - $writer = new Zend_Config_Writer_Ini(); - $writer->setRenderWithoutSections(); - $filename = $homeDirectory.'/.zf.ini'; - - $config = [ - 'php' => [ - 'include_path' => get_include_path(), - ], - ]; - $writer->write($filename, new Zend_Config($config)); - - $resp = $this->_registry->getResponse(); - $resp->appendContent('Successfully written Zend Tool config.'); - $resp->appendContent('It is located at: '.$filename); - } - - /** - * @return string - */ - protected function _detectHomeDirectory() - { - $envVars = ['ZF_HOME', 'HOME', 'HOMEPATH']; - foreach ($envVars as $env) { - $homeDirectory = getenv($env); - if (false != $homeDirectory && file_exists((string) $homeDirectory)) { - return $homeDirectory; - } - } - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception('Cannot detect user home directory, set ZF_HOME enviroment variable.'); - } - - /** - * Show Zend Tool User Configuration. - * - * @return void - */ - public function show() - { - $userConfig = $this->_loadUserConfigIfExists(); - $configArray = $userConfig->getConfigInstance()->toArray(); - - $resp = $this->_registry->getResponse(); - - $i = 0; - $tree = ''; - foreach ($configArray as $k => $v) { - ++$i; - $tree .= $this->_printTree($k, $v, 1, count($configArray) == $i); - } - $resp->appendContent('User Configuration: '.$userConfig->getConfigFilepath(), ['color' => 'green']); - $resp->appendContent($tree, ['indention' => 2]); - } - - /** - * @param string $key - * @param string $value - * @param int $level - * - * @return string - */ - protected function _printTree($key, $value, $level = 1, $isLast = false) - { - $this->_levelCompleted[$level] = false; - - $prefix = ''; - for ($i = 1; $i < $level; ++$i) { - if (true == $this->_levelCompleted[$i]) { - $prefix .= ' '; - } else { - $prefix .= '| '; - } - } - if ($isLast) { - $pointer = '`-- '; - } else { - $pointer = '|-- '; - } - - $tree = ''; - if (is_array($value)) { - $tree .= $prefix.$pointer.$key.PHP_EOL; - - if (true == $isLast) { - $this->_levelCompleted[$level] = true; - } - - $i = 0; - foreach ($value as $k => $v) { - ++$i; - $tree .= $this->_printTree($k, $v, $level + 1, count($value) == $i); - } - } else { - $tree .= $prefix.$pointer.$key.': '.\trim((string) $value).PHP_EOL; - } - - return $tree; - } - - public function enable() - { - $resp = $this->_registry->getResponse(); - $resp->appendContent('Use either "zf enable config.provider" or "zf enable config.manifest".'); - } - - public function disable() - { - $resp = $this->_registry->getResponse(); - $resp->appendContent('Use either "zf disable config.provider" or "zf disable config.manifest".'); - } - - /** - * @param string $className - */ - public function enableProvider($className) - { - if (!class_exists($className)) { - Zend_Loader::loadClass($className); - } - $reflClass = new ReflectionClass($className); - if (!in_array('Zend_Tool_Framework_Provider_Interface', $reflClass->getInterfaceNames())) { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception('Given class is not a provider'); - } - $this->_doEnable($className); - } - - protected function _doEnable($className) - { - $userConfig = $this->_loadUserConfigIfExists(); - - if (!isset($userConfig->basicloader)) { - $userConfig->basicloader = []; - } - if (!isset($userConfig->basicloader->classes)) { - $userConfig->basicloader->classes = []; - } - - $providerClasses = $userConfig->basicloader->classes->toArray(); - if (!in_array($className, $providerClasses)) { - if (count($providerClasses)) { - $pos = max(array_keys($providerClasses)) + 1; - } else { - $pos = 0; - } - $userConfig->basicloader->classes->$pos = $className; - - if ($userConfig->save()) { - $this->_registry->getResponse()->appendContent( - "Provider/Manifest '".$className."' was enabled for usage with Zend Tool.", - ['color' => 'green', 'aligncenter' => true] - ); - } else { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception('Could not write user configuration to persistence.'); - } - } else { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception("Provider/Manifest '".$className."' is already enabled."); - } - } - - /** - * @param string $className - */ - public function enableManifest($className) - { - if (!class_exists($className)) { - Zend_Loader::loadClass($className); - } - $reflClass = new ReflectionClass($className); - if (!in_array('Zend_Tool_Framework_Manifest_Interface', $reflClass->getInterfaceNames())) { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception('Given class is not a manifest.'); - } - $this->_doEnable($className); - } - - /** - * @param string $className - */ - public function disableManifest($className) - { - $this->disableProvider($className); - } - - /** - * @param string $className - */ - public function disableProvider($className) - { - $userConfig = $this->_loadUserConfigIfExists(); - - if (!isset($userConfig->basicloader)) { - $userConfig->basicloader = []; - } - if (!isset($userConfig->basicloader->classes)) { - $userConfig->basicloader->classes = []; - } - - $providerClasses = $userConfig->basicloader->classes->toArray(); - if (($key = array_search($className, $providerClasses)) !== false) { - unset($userConfig->basicloader->classes->$key); - - if ($userConfig->save()) { - $this->_registry->getResponse()->appendContent( - "Provider/Manifest '".$className."' was disabled.", - ['color' => 'green', 'aligncenter' => true] - ); - } else { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception('Could not write user configuration to persistence.'); - } - } else { - // require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception("Provider/Manifest '".$className."' is not enabled."); - } - } - - /** - * @return Zend_Tool_Framework_Client_Config - */ - protected function _loadUserConfigIfExists() - { - /* @var $userConfig Zend_Tool_Framework_Client_Config */ - $userConfig = $this->_registry->getConfig(); - - $resp = $this->_registry->getResponse(); - if (!$userConfig->exists()) { - $resp->appendContent('User has no config file.', ['aligncenter' => true, 'color' => ['hiWhite', 'bgRed']]); - } - - return $userConfig; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/System/Provider/Manifest.php b/packages/zend-tool/library/Zend/Tool/Framework/System/Provider/Manifest.php deleted file mode 100644 index 5e5ff33fb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/System/Provider/Manifest.php +++ /dev/null @@ -1,109 +0,0 @@ -_registry = $registry; - } - - public function getName() - { - return 'Manifest'; - } - - public function show() - { - $manifestRepository = $this->_registry->getManifestRepository(); - $response = $this->_registry->getResponse(); - - $metadataTree = []; - - $longestAttrNameLen = 50; - - foreach ($manifestRepository as $metadata) { - $metadataType = $metadata->getType(); - $metadataName = $metadata->getName(); - $metadataAttrs = $metadata->getAttributes('attributesParent'); - - if (!$metadataAttrs) { - $metadataAttrs = '(None)'; - } else { - $metadataAttrs = urldecode(http_build_query($metadataAttrs, '', ', ')); - } - - if (!array_key_exists($metadataType, $metadataTree)) { - $metadataTree[$metadataType] = []; - } - - if (!array_key_exists($metadataName, $metadataTree[$metadataType])) { - $metadataTree[$metadataType][$metadataName] = []; - } - - if (!array_key_exists($metadataAttrs, $metadataTree[$metadataType][$metadataName])) { - $metadataTree[$metadataType][$metadataName][$metadataAttrs] = []; - } - - $longestAttrNameLen = (strlen((string) $metadataAttrs) > $longestAttrNameLen) ? strlen((string) $metadataAttrs) : $longestAttrNameLen; - - $metadataValue = $metadata->getValue(); - if (is_array($metadataValue) && count($metadataValue) > 0) { - $metadataValue = urldecode(http_build_query($metadataValue, '', ', ')); - } elseif (is_array($metadataValue)) { - $metadataValue = '(empty array)'; - } - - $metadataTree[$metadataType][$metadataName][$metadataAttrs][] = $metadataValue; - } - - foreach ($metadataTree as $metadataType => $metadatasByName) { - $response->appendContent($metadataType); - foreach ($metadatasByName as $metadataName => $metadatasByAttributes) { - $response->appendContent(' '.$metadataName); - foreach ($metadatasByAttributes as $metadataAttributeName => $metadataValues) { - foreach ($metadataValues as $metadataValue) { - $string = sprintf(" %-{$longestAttrNameLen}.{$longestAttrNameLen}s : ", $metadataAttributeName) - .$metadataValue; - $response->appendContent($string); - } - } - } - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Framework/System/Provider/Phpinfo.php b/packages/zend-tool/library/Zend/Tool/Framework/System/Provider/Phpinfo.php deleted file mode 100644 index fe4c0525e..000000000 --- a/packages/zend-tool/library/Zend/Tool/Framework/System/Provider/Phpinfo.php +++ /dev/null @@ -1,37 +0,0 @@ -_registry = $registry; - - return $this; - } - - /** - * Show Action. - * - * @param string $mode The mode switch can be one of: major, minor, or mini (default) - * @param bool $nameIncluded - */ - public function show($mode = self::MODE_MINI, $nameIncluded = true) - { - $versionInfo = $this->_splitVersion(); - - switch ($mode) { - case self::MODE_MINOR: - unset($versionInfo['mini']); - break; - case self::MODE_MAJOR: - unset($versionInfo['mini'], $versionInfo['minor']); - break; - } - - $output = implode('.', $versionInfo); - - if ($nameIncluded) { - $output = 'Zend Framework Version: '.$output; - } - - $this->_registry->response->appendContent($output); - } - - public function showMajorPart($nameIncluded = true) - { - $versionNumbers = $this->_splitVersion(); - $output = ((true == $nameIncluded) ? 'ZF Major Version: ' : null).$versionNumbers['major']; - $this->_registry->response->appendContent($output); - } - - public function showMinorPart($nameIncluded = true) - { - $versionNumbers = $this->_splitVersion(); - $output = ((true == $nameIncluded) ? 'ZF Minor Version: ' : null).$versionNumbers['minor']; - $this->_registry->response->appendContent($output); - } - - public function showMiniPart($nameIncluded = true) - { - $versionNumbers = $this->_splitVersion(); - $output = ((true == $nameIncluded) ? 'ZF Mini Version: ' : null).$versionNumbers['mini']; - $this->_registry->response->appendContent($output); - } - - protected function _splitVersion() - { - list($major, $minor, $mini) = explode('.', Zend_Version::VERSION); - - return ['major' => $major, 'minor' => $minor, 'mini' => $mini]; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine.php deleted file mode 100644 index 837630eec..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine.php +++ /dev/null @@ -1,100 +0,0 @@ -_storage = $storage; - $this->_engines = [ - new Zend_Tool_Project_Context_Content_Engine_CodeGenerator($storage, $this->_keyInStorage), - new Zend_Tool_Project_Context_Content_Engine_Phtml($storage, $this->_keyInStorage), - ]; - } - - /** - * getContent(). - * - * @param string $methodName - * - * @return false - */ - public function getContent(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters) - { - $content = null; - - foreach ($this->_engines as $engine) { - if ($engine->hasContent($context, $methodName, $parameters)) { - $content = $engine->getContent($context, $methodName, $parameters); - - if (null != $content) { - break; - } - } - } - - if (null == $content) { - return false; - } - - return $content; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php deleted file mode 100644 index 4cdc5657f..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php +++ /dev/null @@ -1,94 +0,0 @@ -_storage = $storage; - $this->_contentPrefix = $contentPrefix; - } - - /** - * hasContent(). - * - * @param string $method - * - * @return false - */ - public function hasContent(Zend_Tool_Project_Context_Interface $context, $method) - { - return $this->_storage->has($this->_contentPrefix.'/'.$context->getName().'/'.$method.'.php'); - } - - /** - * getContent(). - * - * @param string $method - * - * @return string - */ - public function getContent(Zend_Tool_Project_Context_Interface $context, $method, $parameters) - { - $streamUri = $this->_storage->getStreamUri($this->_contentPrefix.'/'.$context->getName().'/'.$method.'.php'); - - if (method_exists($context, 'getCodeGenerator')) { - $codeGenerator = $context->getCodeGenerator(); - } else { - $codeGenerator = new Zend_CodeGenerator_Php_File(); - } - - $codeGenerator = include $streamUri; - - if (!$codeGenerator instanceof Zend_CodeGenerator_Abstract) { - throw new Zend_Tool_Project_Exception('Custom file at '.$streamUri.' did not return the $codeGenerator object.'); - } - - return $codeGenerator->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine/Phtml.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine/Phtml.php deleted file mode 100644 index 30b1a11d3..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Content/Engine/Phtml.php +++ /dev/null @@ -1,84 +0,0 @@ -_storage = $storage; - $this->_contentPrefix = $contentPrefix; - } - - /** - * hasContext(). - * - * @param string $method - * - * @return false - */ - public function hasContent(Zend_Tool_Project_Context_Interface $context, $method) - { - return $this->_storage->has($this->_contentPrefix.'/'.$context.'/'.$method.'.phtml'); - } - - /** - * getContent(). - * - * @param string $method - */ - public function getContent(Zend_Tool_Project_Context_Interface $context, $method, $parameters) - { - $streamUri = $this->_storage->getStreamUri($this->_contentPrefix.'/'.$context->getName().'/'.$method.'.phtml'); - - ob_start(); - include $streamUri; - $content = ob_get_clean(); - - return $content; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Exception.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Exception.php deleted file mode 100644 index 27fdfec37..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Exception.php +++ /dev/null @@ -1,33 +0,0 @@ -_resource->getParentResource()->getContext()->getPath(); - $this->_baseDirectory = $parentBaseDirectory; - - return $this; - } - - /** - * setResource(). - * - * @return Zend_Tool_Project_Context_Filesystem_Abstract - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - - return $this; - } - - /** - * setBaseDirectory(). - * - * @param string $baseDirectory - * - * @return Zend_Tool_Project_Context_Filesystem_Abstract - */ - public function setBaseDirectory($baseDirectory) - { - $this->_baseDirectory = rtrim((string) str_replace((string) '\\', '/', $baseDirectory), '/'); - - return $this; - } - - /** - * getBaseDirectory(). - * - * @return string - */ - public function getBaseDirectory() - { - return $this->_baseDirectory; - } - - /** - * setFilesystemName(). - * - * @param string $filesystemName - * - * @return Zend_Tool_Project_Context_Filesystem_Abstract - */ - public function setFilesystemName($filesystemName) - { - $this->_filesystemName = $filesystemName; - - return $this; - } - - /** - * getFilesystemName(). - * - * @return string - */ - public function getFilesystemName() - { - return $this->_filesystemName; - } - - /** - * getPath(). - * - * @return string - */ - public function getPath() - { - $path = $this->_baseDirectory; - if ($this->_filesystemName) { - $path .= '/'.$this->_filesystemName; - } - - return $path; - } - - /** - * exists(). - * - * @return bool - */ - public function exists() - { - return file_exists((string) $this->getPath()); - } - - /** - * create(). - * - * Create this resource/context - */ - abstract public function create(); - - /** - * delete(). - * - * Delete this resouce/context - */ - abstract public function delete(); -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Filesystem/Directory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Filesystem/Directory.php deleted file mode 100644 index 9f0b012b5..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Filesystem/Directory.php +++ /dev/null @@ -1,85 +0,0 @@ -_resource->getParentResource()) instanceof Zend_Tool_Project_Profile_Resource) { - if ((($parentContext = $parentResource->getContext()) instanceof Zend_Tool_Project_Context_Filesystem_Abstract) - && (!$parentContext->exists())) { - $parentResource->create(); - } - } - - if (!file_exists((string) $this->getPath())) { - mkdir($this->getPath()); - } - - return $this; - } - - /** - * delete(). - * - * @return Zend_Tool_Project_Context_Filesystem_Directory - */ - public function delete() - { - $this->_resource->setDeleted(true); - rmdir($this->getPath()); - - return $this; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Filesystem/File.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Filesystem/File.php deleted file mode 100644 index 0ff2596f2..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Filesystem/File.php +++ /dev/null @@ -1,176 +0,0 @@ -_resource->hasAttribute('filesystemName')) { - $this->_filesystemName = $this->_resource->getAttribute('filesystemName'); - } - - // check to see if this file is - if ('file' == $this->getName()) { - $this->_initFileOnlyContext(); - } - - // @potential-todo check to ensure that this 'file' resource has no children - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - $returnAttrs = []; - if (null !== $this->_filesystemName) { - $returnAttrs['filesystemName'] = $this->_filesystemName; - } - - return $returnAttrs; - } - - /** - * setResource(). - * - * @param unknown_type $resource - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - $this->_resource->setAppendable(false); - - return $this; - } - - /** - * getResource(). - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function getResource() - { - return $this->_resource; - } - - /** - * create(). - * - * @return Zend_Tool_Project_Context_Filesystem_File - */ - public function create() - { - // check to ensure the parent exists, if not, call it and create it - if (($parentResource = $this->_resource->getParentResource()) instanceof Zend_Tool_Project_Profile_Resource) { - if ((($parentContext = $parentResource->getContext()) instanceof Zend_Tool_Project_Context_Filesystem_Abstract) - && (!$parentContext->exists())) { - $parentResource->create(); - } - } - - if (file_exists((string) $this->getPath())) { - // @todo propt user to determine if its ok to overwrite file - } - - file_put_contents($this->getPath(), $this->getContents()); - - return $this; - } - - /** - * delete(). - * - * @return Zend_Tool_Project_Context_Filesystem_File - */ - public function delete() - { - unlink($this->getPath()); - $this->_resource->setDeleted(true); - - return $this; - } - - /** - * getContents(). - * - * @return null - */ - public function getContents() - { - return $this->_content; - } - - protected function _initFileOnlyContext() - { - if ($this->_resource->hasAttribute('defaultContentCallback')) { - $contentFunc = $this->_resource->getAttribute('defaultContentCallback'); - if (is_callable($contentFunc)) { - $this->_content = call_user_func_array($contentFunc, [$this]); - } - } - if (null == $this->_filesystemName) { - $this->_filesystemName = 'file.txt'; - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Interface.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Interface.php deleted file mode 100644 index 8c0ecc02d..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Interface.php +++ /dev/null @@ -1,37 +0,0 @@ -addContextClass('Zend_Tool_Project_Context_System_ProjectDirectory') - ->addContextClass('Zend_Tool_Project_Context_System_ProjectProfileFile') - ->addContextClass('Zend_Tool_Project_Context_System_ProjectProvidersDirectory'); - self::$_isInitialized = true; - } - } - - public function addContextsFromDirectory($directory, $prefix) - { - $prefix = \trim((string) $prefix, '_').'_'; - foreach (new DirectoryIterator($directory) as $directoryItem) { - if ($directoryItem->isDot() || ('.php' !== substr((string) $directoryItem->getFilename(), -4))) { - continue; - } - $class = $prefix.substr((string) $directoryItem->getFilename(), 0, -4); - $this->addContextClass($class); - } - } - - public function addContextClass($contextClass) - { - if (!class_exists($contextClass)) { - // require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($contextClass); - } - $reflectionContextClass = new ReflectionClass($contextClass); - if ($reflectionContextClass->isInstantiable()) { - $context = new $contextClass(); - - return $this->addContext($context); - } - - return $this; - } - - /** - * Enter description here... - * - * @return Zend_Tool_Project_Context_Repository - */ - public function addContext(Zend_Tool_Project_Context_Interface $context) - { - $isSystem = $context instanceof Zend_Tool_Project_Context_System_Interface; - $isTopLevel = $context instanceof Zend_Tool_Project_Context_System_TopLevelRestrictable; - $isOverwritable = !($context instanceof Zend_Tool_Project_Context_System_NotOverwritable); - - $index = (count($this->_contexts)) ? max(array_keys($this->_contexts)) + 1 : 1; - - $normalName = $this->_normalizeName($context->getName()); - - if (isset($this->_shortContextNames[$normalName]) && (false === $this->_contexts[$this->_shortContextNames[$normalName]]['isOverwritable'])) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('Context '.$context->getName().' is not overwriteable.'); - } - - $this->_shortContextNames[$normalName] = $index; - $this->_contexts[$index] = [ - 'isTopLevel' => $isTopLevel, - 'isSystem' => $isSystem, - 'isOverwritable' => $isOverwritable, - 'normalName' => $normalName, - 'context' => $context, - ]; - - return $this; - } - - public function getContext($name) - { - if (!$this->hasContext($name)) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('Context by name '.$name.' does not exist in the registry.'); - } - - $name = $this->_normalizeName($name); - - return clone $this->_contexts[$this->_shortContextNames[$name]]['context']; - } - - public function hasContext($name) - { - $name = $this->_normalizeName($name); - - return isset($this->_shortContextNames[$name]) ? true : false; - } - - public function isSystemContext($name) - { - if (!$this->hasContext($name)) { - return false; - } - - $name = $this->_normalizeName($name); - $index = $this->_shortContextNames[$name]; - - return $this->_contexts[$index]['isSystemContext']; - } - - public function isTopLevelContext($name) - { - if (!$this->hasContext($name)) { - return false; - } - $name = $this->_normalizeName($name); - $index = $this->_shortContextNames[$name]; - - return $this->_contexts[$index]['isTopLevel']; - } - - public function isOverwritableContext($name) - { - if (!$this->hasContext($name)) { - return false; - } - $name = $this->_normalizeName($name); - $index = $this->_shortContextNames[$name]; - - return $this->_contexts[$index]['isOverwritable']; - } - - #[ReturnTypeWillChange] - public function count() - { - return count($this->_contexts); - } - - protected function _normalizeName($name) - { - return strtolower((string) $name); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/System/Interface.php b/packages/zend-tool/library/Zend/Tool/Project/Context/System/Interface.php deleted file mode 100644 index 707b428d5..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/System/Interface.php +++ /dev/null @@ -1,36 +0,0 @@ -_resource->getAttribute('path'); - - // if not, get from profile - if (null == $projectDirectory) { - $projectDirectory = $this->_resource->getProfile()->getAttribute('projectDirectory'); - } - - // if not, exception. - if (null == $projectDirectory) { - // require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('projectDirectory cannot find the directory for this project.'); - } - - $this->_baseDirectory = rtrim((string) $projectDirectory, '\\/'); - - return $this; - } - - /** - * create(). - * - * @return Zend_Tool_Project_Context_System_ProjectDirectory - */ - public function create() - { - if (file_exists((string) $this->getPath())) { - /* - foreach (new DirectoryIterator($this->getPath()) as $item) { - if (!$item->isDot()) { - if ($registry->getClient()->isInteractive()) { - // @todo prompt for override - } else { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('This directory is not empty, project creation aborted.'); - } - break; - } - } - */ - } - - parent::create(); - - return $this; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/System/ProjectProfileFile.php b/packages/zend-tool/library/Zend/Tool/Project/Context/System/ProjectProfileFile.php deleted file mode 100644 index 47026522a..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/System/ProjectProfileFile.php +++ /dev/null @@ -1,117 +0,0 @@ -_profile = $profile; - - return $this; - } - - /** - * save(). - * - * Proxy to create - * - * @return Zend_Tool_Project_Context_System_ProjectProfileFile - */ - public function save() - { - parent::create(); - - return $this; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $profile = $this->_resource->getProfile(); - $xml = $parser->serialize($profile); - - return $xml; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php deleted file mode 100644 index b2fc31af4..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php +++ /dev/null @@ -1,81 +0,0 @@ -getPath())) { - $providerRepository = $registry->getProviderRepository(); - - foreach (new DirectoryIterator($this->getPath()) as $item) { - if ($item->isFile() && (($suffixStart = strpos((string) $item->getFilename(), 'Provider.php')) !== false)) { - $className = substr((string) $item->getFilename(), 0, $suffixStart + 8); - // $loadableFiles[$className] = $item->getPathname(); - include_once $item->getPathname(); - $providerRepository->addProvider(new $className()); - } - } - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/System/TopLevelRestrictable.php b/packages/zend-tool/library/Zend/Tool/Project/Context/System/TopLevelRestrictable.php deleted file mode 100644 index d1158ece0..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/System/TopLevelRestrictable.php +++ /dev/null @@ -1,36 +0,0 @@ -_resource; - do { - $resourceName = $currentResource->getName(); - if ('ApplicationDirectory' == $resourceName || 'ModuleDirectory' == $resourceName) { - $containingResource = $currentResource; - break; - } - } while ($currentResource instanceof Zend_Tool_Project_Profile_Resource - && $currentResource = $currentResource->getParentResource()); - - $fullClassName = ''; - - // go find the proper prefix - if (isset($containingResource)) { - if ('ApplicationDirectory' == $containingResource->getName()) { - $prefix = $containingResource->getAttribute('classNamePrefix'); - $fullClassName = $prefix; - } elseif ('ModuleDirectory' == $containingResource->getName()) { - $filter = new Zend_Filter_Word_DashToCamelCase(); - $prefix = $filter->filter(ucfirst($containingResource->getAttribute('moduleName'))).'_'; - $fullClassName = $prefix; - } - } - - if ($classContextName) { - $fullClassName .= rtrim((string) $classContextName, '_').'_'; - } - $fullClassName .= $localClassName; - - return $fullClassName; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ActionMethod.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ActionMethod.php deleted file mode 100644 index 1c8faf092..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ActionMethod.php +++ /dev/null @@ -1,226 +0,0 @@ -_actionName = $this->_resource->getAttribute('actionName'); - - $this->_resource->setAppendable(false); - $this->_controllerResource = $this->_resource->getParentResource(); - if (!$this->_controllerResource->getContext() instanceof Zend_Tool_Project_Context_Zf_ControllerFile) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('ActionMethod must be a sub resource of a ControllerFile'); - } - // make the ControllerFile node appendable so we can tack on the actionMethod. - $this->_resource->getParentResource()->setAppendable(true); - - $this->_controllerPath = $this->_controllerResource->getContext()->getPath(); - - /* - * This code block is now commented, its doing to much for init() - * - if ($this->_controllerPath != '' && self::hasActionMethod($this->_controllerPath, $this->_actionName)) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('An action named ' . $this->_actionName . 'Action already exists in this controller'); - } - */ - - return $this; - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'actionName' => $this->getActionName(), - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ActionMethod'; - } - - /** - * setResource(). - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - - return $this; - } - - /** - * setActionName(). - * - * @param string $actionName - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function setActionName($actionName) - { - $this->_actionName = $actionName; - - return $this; - } - - /** - * getActionName(). - * - * @return string - */ - public function getActionName() - { - return $this->_actionName; - } - - /** - * create(). - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function create() - { - if (false === self::createActionMethod($this->_controllerPath, $this->_actionName)) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('Could not create action within controller '.$this->_controllerPath.' with action name '.$this->_actionName); - } - - return $this; - } - - /** - * delete(). - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function delete() - { - // @todo do this - return $this; - } - - /** - * createAcionMethod(). - * - * @param string $controllerPath - * @param string $actionName - * @param string $body - * - * @return true - */ - public static function createActionMethod($controllerPath, $actionName, $body = ' // action body') - { - if (!file_exists((string) $controllerPath)) { - return false; - } - - $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true); - $controllerCodeGenFile->getClass()->setMethod([ - 'name' => $actionName.'Action', - 'body' => $body, - ]); - - file_put_contents($controllerPath, $controllerCodeGenFile->generate()); - - return true; - } - - /** - * hasActionMethod(). - * - * @param string $controllerPath - * @param string $actionName - * - * @return bool - */ - public static function hasActionMethod($controllerPath, $actionName) - { - if (!file_exists((string) $controllerPath)) { - return false; - } - - $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true); - - return $controllerCodeGenFile->getClass()->hasMethod($actionName.'Action'); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ApisDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ApisDirectory.php deleted file mode 100644 index 5d30292e0..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ApisDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_type = $this->_resource->getAttribute('type'); - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - return ['type' => $this->_type]; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - if (null === $this->_content) { - if (file_exists((string) $this->getPath())) { - $this->_content = file_get_contents($this->getPath()); - } else { - $this->_content = $this->_getDefaultContents(); - } - } - - return $this->_content; - } - - public function getAsZendConfig($section = 'production') - { - return new Zend_Config_Ini($this->getPath(), $section); - } - - /** - * addStringItem(). - * - * @param string $key - * @param string $value - * @param string $section - * @param bool $quoteValue - * - * @return Zend_Tool_Project_Context_Zf_ApplicationConfigFile - */ - public function addStringItem($key, $value, $section = 'production', $quoteValue = true) - { - // null quote value means to auto-detect - if (null === $quoteValue) { - $quoteValue = preg_match('#[\"\']#', $value) ? false : true; - } - - if (true == $quoteValue) { - $value = '"'.$value.'"'; - } - - $contentLines = preg_split('#[\n\r]#', $this->getContents()); - - $newLines = []; - $insideSection = false; - - foreach ($contentLines as $contentLineIndex => $contentLine) { - if (false === $insideSection && preg_match('#^\['.$section.'#', $contentLine)) { - $insideSection = true; - } - - $newLines[] = $contentLine; - if ($insideSection) { - // if its blank, or a section heading - if (isset($contentLines[$contentLineIndex + 1][0]) && '[' == $contentLines[$contentLineIndex + 1][0]) { - $newLines[] = $key.' = '.$value; - $insideSection = null; - } elseif (!isset($contentLines[$contentLineIndex + 1])) { - $newLines[] = $key.' = '.$value; - $insideSection = null; - } - } - } - - $this->_content = implode("\n", $newLines); - - return $this; - } - - /** - * @param array $item - * @param string $section - * @param bool $quoteValue - * - * @return Zend_Tool_Project_Context_Zf_ApplicationConfigFile - */ - public function addItem($item, $section = 'production', $quoteValue = true) - { - $stringItems = []; - $stringValues = []; - $configKeyNames = []; - - $rii = new RecursiveIteratorIterator( - new RecursiveArrayIterator($item), - RecursiveIteratorIterator::SELF_FIRST - ); - - // loop through array structure recursively to create proper keys - foreach ($rii as $name => $value) { - if (is_array($value)) { - array_push($configKeyNames, $name); - } else { - $stringItems[] = implode('.', $configKeyNames).'.'.$name; - $stringValues[] = $value; - } - } - - foreach ($stringItems as $stringItemIndex => $stringItem) { - $this->addStringItem($stringItem, $stringValues[$stringItemIndex], $section, $quoteValue); - } - - return $this; - } - - public function removeStringItem($key, $section = 'production') - { - $contentLines = file($this->getPath()); - - $newLines = []; - $insideSection = false; - - foreach ($contentLines as $contentLineIndex => $contentLine) { - if (false === $insideSection && preg_match('#^\['.$section.'#', $contentLine)) { - $insideSection = true; - } - - if ($insideSection) { - // if its blank, or a section heading - if ((null == \trim((string) $contentLine)) || ('[' == $contentLines[$contentLineIndex + 1][0])) { - $insideSection = null; - } - } - - if (!preg_match('#'.$key.'\s?=.*#', $contentLine)) { - $newLines[] = $contentLine; - } - } - - $this->_content = implode('', $newLines); - } - - public function removeItem($item, $section = 'production') - { - $stringItems = []; - $stringValues = []; - $configKeyNames = []; - - $rii = new RecursiveIteratorIterator( - new RecursiveArrayIterator($item), - RecursiveIteratorIterator::SELF_FIRST - ); - - // loop through array structure recursively to create proper keys - foreach ($rii as $name => $value) { - if (is_array($value)) { - array_push($configKeyNames, $name); - } else { - $stringItems[] = implode('.', $configKeyNames).'.'.$name; - $stringValues[] = $value; - } - } - - foreach ($stringItems as $stringItemIndex => $stringItem) { - $this->removeStringItem($stringItem, $section); - } - - return $this; - } - - protected function _getDefaultContents() - { - $contents = <<_resource->hasAttribute('classNamePrefix')) { - $this->_classNamePrefix = $this->_resource->getAttribute('classNamePrefix'); - } - parent::init(); - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'classNamePrefix' => $this->getClassNamePrefix(), - ]; - } - - public function getName() - { - return 'ApplicationDirectory'; - } - - public function setClassNamePrefix($classNamePrefix) - { - $this->_classNamePrefix = $classNamePrefix; - } - - public function getClassNamePrefix() - { - return $this->_classNamePrefix; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/BootstrapFile.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/BootstrapFile.php deleted file mode 100644 index 4ae1a3bcb..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/BootstrapFile.php +++ /dev/null @@ -1,114 +0,0 @@ -_applicationConfigFile = $this->_resource->getProfile()->search('ApplicationConfigFile'); - $this->_applicationDirectory = $this->_resource->getProfile()->search('ApplicationDirectory'); - - if ((false === $this->_applicationConfigFile) || (false === $this->_applicationDirectory)) { - throw new Exception('To use the BootstrapFile context, your project requires the use of both the "ApplicationConfigFile" and "ApplicationDirectory" contexts.'); - } - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => 'Bootstrap', - 'extendedClass' => 'Zend_Application_Bootstrap_Bootstrap', - ]), - ], - ]); - - return $codeGenFile->generate(); - } - - public function getApplicationInstance() - { - if (null == $this->_applicationInstance) { - if ($this->_applicationConfigFile->getContext()->exists()) { - define('APPLICATION_PATH', $this->_applicationDirectory->getPath()); - $applicationOptions = []; - $applicationOptions['config'] = $this->_applicationConfigFile->getPath(); - - $this->_applicationInstance = new Zend_Application( - 'development', - $applicationOptions - ); - } - } - - return $this->_applicationInstance; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/CacheDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/CacheDirectory.php deleted file mode 100644 index 40aa2d3ce..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/CacheDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_controllerName = $this->_resource->getAttribute('controllerName'); - $this->_moduleName = $this->_resource->getAttribute('moduleName'); - $this->_filesystemName = ucfirst($this->_controllerName).'Controller.php'; - parent::init(); - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'controllerName' => $this->getControllerName(), - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ControllerFile'; - } - - /** - * getControllerName(). - * - * @return string - */ - public function getControllerName() - { - return $this->_controllerName; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = ($this->_moduleName) ? $filter->filter(ucfirst($this->_moduleName)).'_' : ''; - $className .= ucfirst($this->_controllerName).'Controller'; - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'fileName' => $this->getPath(), - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'Zend_Controller_Action', - 'methods' => [ - new Zend_CodeGenerator_Php_Method([ - 'name' => 'init', - 'body' => '/* Initialize action controller here */', - ]), - ], - ]), - ], - ]); - - if ('ErrorController' == $className) { - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'fileName' => $this->getPath(), - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'Zend_Controller_Action', - 'methods' => [ - new Zend_CodeGenerator_Php_Method([ - 'name' => 'errorAction', - 'body' => <<_getParam('error_handler'); - -if (!\$errors || !\$errors instanceof ArrayObject) { - \$this->view->message = 'You have reached the error page'; - return; -} - -switch (\$errors->type) { - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: - // 404 error -- controller or action not found - \$this->getResponse()->setHttpResponseCode(404); - \$priority = Zend_Log::NOTICE; - \$this->view->message = 'Page not found'; - break; - default: - // application error - \$this->getResponse()->setHttpResponseCode(500); - \$priority = Zend_Log::CRIT; - \$this->view->message = 'Application error'; - break; -} - -// Log exception, if logger available -if (\$log = \$this->getLog()) { - \$log->log(\$this->view->message, \$priority, \$errors->exception); - \$log->log('Request Parameters', \$priority, \$errors->request->getParams()); -} - -// conditionally display exceptions -if (\$this->getInvokeArg('displayExceptions') == true) { - \$this->view->exception = \$errors->exception; -} - -\$this->view->request = \$errors->request; -EOS - ]), - new Zend_CodeGenerator_Php_Method([ - 'name' => 'getLog', - 'body' => <<getInvokeArg('bootstrap'); -if (!\$bootstrap->hasResource('Log')) { - return false; -} -\$log = \$bootstrap->getResource('Log'); -return \$log; -EOS - ]), - ], - ]), - ], - ]); - } - - // store the generator into the registry so that the addAction command can use the same object later - Zend_CodeGenerator_Php_File::registerFileCodeGenerator($codeGenFile); // REQUIRES filename to be set - - return $codeGenFile->generate(); - } - - /** - * addAction(). - * - * @param string $actionName - */ - public function addAction($actionName) - { - $classCodeGen = $this->getCodeGenerator(); - $classCodeGen->setMethod(['name' => $actionName.'Action', 'body' => ' // action body here']); - file_put_contents($this->getPath(), $classCodeGen->generate()); - } - - /** - * getCodeGenerator(). - * - * @return Zend_CodeGenerator_Php_Class - */ - public function getCodeGenerator() - { - $codeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($this->getPath()); - $codeGenFileClasses = $codeGenFile->getClasses(); - $class = array_shift($codeGenFileClasses); - - return $class; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ControllersDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ControllersDirectory.php deleted file mode 100644 index 56e3dd008..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ControllersDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_dbTableName = $this->_resource->getAttribute('dbTableName'); - $this->_actualTableName = $this->_resource->getAttribute('actualTableName'); - $this->_filesystemName = ucfirst($this->_dbTableName).'.php'; - parent::init(); - } - - public function getPersistentAttributes() - { - return ['dbTableName' => $this->_dbTableName]; - } - - public function getContents() - { - $className = $this->getFullClassName($this->_dbTableName, 'Model_DbTable'); - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'fileName' => $this->getPath(), - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'Zend_Db_Table_Abstract', - 'properties' => [ - new Zend_CodeGenerator_Php_Property([ - 'name' => '_name', - 'visibility' => Zend_CodeGenerator_Php_Property::VISIBILITY_PROTECTED, - 'defaultValue' => $this->_actualTableName, - ]), - ], - ]), - ], - ]); - - return $codeGenFile->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/DocsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/DocsDirectory.php deleted file mode 100644 index d8b9db0e6..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/DocsDirectory.php +++ /dev/null @@ -1,60 +0,0 @@ -_formName = $this->_resource->getAttribute('formName'); - $this->_filesystemName = ucfirst($this->_formName).'.php'; - parent::init(); - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'formName' => $this->getFormName(), - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'FormFile'; - } - - public function getFormName() - { - return $this->_formName; - } - - public function getContents() - { - $className = $this->getFullClassName($this->_formName, 'Form'); - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'fileName' => $this->getPath(), - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'Zend_Form', - 'methods' => [ - new Zend_CodeGenerator_Php_Method([ - 'name' => 'init', - 'body' => '/* Form Elements & Other Definitions Here ... */', - ]), - ], - ]), - ], - ]); - - return $codeGenFile->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/FormsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/FormsDirectory.php deleted file mode 100644 index 7ce10fd80..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/FormsDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_resource->getAttribute('layoutName')) { - $this->_layoutName = $layoutName; - } else { - throw new Exception('Either a forActionName or scriptName is required.'); - } - - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - $attributes = []; - - if ($this->_layoutName) { - $attributes['layoutName'] = $this->_layoutName; - } - - return $attributes; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $contents = <<layout()->content; ?> -EOS; - - return $contents; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php deleted file mode 100644 index 1d9701e37..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_modelName = $this->_resource->getAttribute('modelName'); - $this->_filesystemName = ucfirst($this->_modelName).'.php'; - parent::init(); - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'modelName' => $this->getModelName(), - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ModelFile'; - } - - public function getModelName() - { - return $this->_modelName; - } - - public function getContents() - { - $className = $this->getFullClassName($this->_modelName, 'Model'); - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'fileName' => $this->getPath(), - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - ]), - ], - ]); - - return $codeGenFile->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ModelsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ModelsDirectory.php deleted file mode 100644 index 219cdc394..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ModelsDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_filesystemName = $this->_moduleName = $this->_resource->getAttribute('moduleName'); - parent::init(); - - return $this; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ModuleDirectory'; - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'moduleName' => $this->getModuleName(), - ]; - } - - /** - * getModuleName(). - * - * @return string - */ - public function getModuleName() - { - return $this->_moduleName; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ModulesDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ModulesDirectory.php deleted file mode 100644 index eb9daa35c..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ModulesDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_projectProviderName = $this->_resource->getAttribute('projectProviderName'); - $this->_actionNames = $this->_resource->getAttribute('actionNames'); - $this->_filesystemName = ucfirst($this->_projectProviderName).'Provider.php'; - - if (strpos((string) $this->_actionNames, ',')) { - $this->_actionNames = explode(',', $this->_actionNames); - } else { - $this->_actionNames = ($this->_actionNames) ? [$this->_actionNames] : []; - } - - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'projectProviderName' => $this->getProjectProviderName(), - 'actionNames' => implode(',', $this->_actionNames), - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ProjectProviderFile'; - } - - /** - * getProjectProviderName(). - * - * @return string - */ - public function getProjectProviderName() - { - return $this->_projectProviderName; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = $filter->filter($this->_projectProviderName).'Provider'; - - $class = new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'Zend_Tool_Project_Provider_Abstract', - ]); - - $methods = []; - foreach ($this->_actionNames as $actionName) { - $methods[] = new Zend_CodeGenerator_Php_Method([ - 'name' => $actionName, - 'body' => ' /** @todo Implementation */', - ]); - } - - if ($methods) { - $class->setMethods($methods); - } - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'requiredFiles' => [ - 'Zend/Tool/Project/Provider/Abstract.php', - 'Zend/Tool/Project/Provider/Exception.php', - ], - 'classes' => [$class], - ]); - - return $codeGenFile->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/PublicDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/PublicDirectory.php deleted file mode 100644 index 1f0943449..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/PublicDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ - <<bootstrap() - ->run(); -EOS - ]); - - return $codeGenerator->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php deleted file mode 100644 index c30145294..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_forActionName = $this->_resource->getAttribute('forActionName'); - - $this->_resource->setAppendable(false); - $this->_testApplicationControllerResource = $this->_resource->getParentResource(); - if (!$this->_testApplicationControllerResource->getContext() instanceof Zend_Tool_Project_Context_Zf_TestApplicationControllerFile) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('ActionMethod must be a sub resource of a TestApplicationControllerFile'); - } - // make the ControllerFile node appendable so we can tack on the actionMethod. - $this->_resource->getParentResource()->setAppendable(true); - - $this->_testApplicationControllerPath = $this->_testApplicationControllerResource->getContext()->getPath(); - - return $this; - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'forActionName' => $this->getForActionName(), - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'TestApplicationActionMethod'; - } - - /** - * setResource(). - * - * @return Zend_Tool_Project_Context_Zf_TestApplicationActionMethod - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - - return $this; - } - - /** - * getActionName(). - * - * @return string - */ - public function getForActionName() - { - return $this->_forActionName; - } - - /** - * create(). - * - * @return Zend_Tool_Project_Context_Zf_TestApplicationActionMethod - */ - public function create() - { - $file = $this->_testApplicationControllerPath; - - if (!file_exists((string) $file)) { - // require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('Could not create action within test controller '.$file.' with action name '.$this->_forActionName); - } - - $actionParam = $this->getForActionName(); - $controllerParam = $this->_resource->getParentResource()->getForControllerName(); - // $moduleParam = null;// - - /* @var $controllerDirectoryResource Zend_Tool_Project_Profile_Resource */ - $controllerDirectoryResource = $this->_resource->getParentResource()->getParentResource(); - if ('TestApplicationModuleDirectory' == $controllerDirectoryResource->getParentResource()->getName()) { - $moduleParam = $controllerDirectoryResource->getParentResource()->getForModuleName(); - } else { - $moduleParam = 'default'; - } - - if ('index' == $actionParam && 'Index' == $controllerParam && 'default' == $moduleParam) { - $assert = '$this->assertQueryContentContains("div#welcome h3", "This is your project\'s main page");'; - } else { - $assert = <<assertQueryContentContains( - 'div#view-content p', - 'View script for controller ' . \$params['controller'] . ' and script/action name ' . \$params['action'] . '' - ); -EOS; - } - - $codeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($file, true, true); - $codeGenFile->getClass()->setMethod([ - 'name' => 'test'.ucfirst($actionParam).'Action', - 'body' => << '$actionParam', 'controller' => '$controllerParam', 'module' => '$moduleParam'); -\$urlParams = \$this->urlizeOptions(\$params); -\$url = \$this->url(\$urlParams); -\$this->dispatch(\$url); - -// assertions -\$this->assertModule(\$urlParams['module']); -\$this->assertController(\$urlParams['controller']); -\$this->assertAction(\$urlParams['action']); -$assert - -EOS - ]); - - file_put_contents($file, $codeGenFile->generate()); - - return $this; - } - - /** - * delete(). - * - * @return Zend_Tool_Project_Context_Zf_TestApplicationActionMethod - */ - public function delete() - { - // @todo do this - return $this; - } - - /* - * hasActionMethod() - * - * @param string $controllerPath - * @param string $actionName - * @return bool - */ - /* - public static function hasActionMethod($controllerPath, $actionName) - { - if (!file_exists((string) $controllerPath)) { - return false; - } - - $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true); - return $controllerCodeGenFile->getClass()->hasMethod('test' . $actionName . 'Action'); - } - */ -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php deleted file mode 100644 index 767f20703..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php +++ /dev/null @@ -1,55 +0,0 @@ -_forControllerName = $this->_resource->getAttribute('forControllerName'); - $this->_filesystemName = ucfirst($this->_forControllerName).'ControllerTest.php'; - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - $attributes = []; - - if ($this->_forControllerName) { - $attributes['forControllerName'] = $this->getForControllerName(); - } - - return $attributes; - } - - public function getForControllerName() - { - return $this->_forControllerName; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = $filter->filter($this->_forControllerName).'ControllerTest'; - - /* @var $controllerDirectoryResource Zend_Tool_Project_Profile_Resource */ - $controllerDirectoryResource = $this->_resource->getParentResource(); - if ('TestApplicationModuleDirectory' == $controllerDirectoryResource->getParentResource()->getName()) { - $className = $filter->filter(ucfirst($controllerDirectoryResource->getParentResource()->getForModuleName())) - .'_'.$className; - } - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'Zend_Test_PHPUnit_ControllerTestCase', - 'methods' => [ - new Zend_CodeGenerator_Php_Method([ - 'name' => 'setUp', - 'body' => <<bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); -parent::setUp(); -EOS - ]), - ], - ]), - ], - ]); - - return $codeGenFile->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php deleted file mode 100644 index f370d7623..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_filesystemName = $this->_forModuleName = $this->_resource->getAttribute('forModuleName'); - parent::init(); - - return $this; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'TestApplicationModuleDirectory'; - } - - /** - * getPersistentAttributes. - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'forModuleName' => $this->getForModuleName(), - ]; - } - - /** - * getModuleName(). - * - * @return string - */ - public function getForModuleName() - { - return $this->_forModuleName; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php deleted file mode 100644 index e155cfb93..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_forClassName = $this->_resource->getAttribute('forClassName'); - $this->_filesystemName = ucfirst(ltrim((string) strrchr($this->_forClassName, '_'), '_')).'Test.php'; - parent::init(); - - return $this; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = $filter->filter($this->_forClassName).'Test'; - - $codeGenFile = new Zend_CodeGenerator_Php_File([ - 'requiredFiles' => [ - 'PHPUnit/Framework/TestCase.php', - ], - 'classes' => [ - new Zend_CodeGenerator_Php_Class([ - 'name' => $className, - 'extendedClass' => 'PHPUnit_Framework_TestCase', - 'methods' => [ - new Zend_CodeGenerator_Php_Method([ - 'name' => 'setUp', - 'body' => ' /* Setup Routine */', - ]), - new Zend_CodeGenerator_Php_Method([ - 'name' => 'tearDown', - 'body' => ' /* Tear Down Routine */', - ]), - ], - ]), - ], - ]); - - return $codeGenFile->generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php deleted file mode 100644 index 41cc3345e..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php +++ /dev/null @@ -1,87 +0,0 @@ -_namespaceName = $this->_resource->getAttribute('namespaceName'); - $this->_filesystemName = $this->_namespaceName; - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - $attributes = []; - $attributes['namespaceName'] = $this->_namespaceName; - - return $attributes; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php deleted file mode 100644 index 3ba980ae5..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php +++ /dev/null @@ -1,87 +0,0 @@ - <<generate(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php deleted file mode 100644 index 3588e8d7b..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php +++ /dev/null @@ -1,79 +0,0 @@ - - - ./application - - - ./library - - - - - - - - -EOS; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestsDirectory.php deleted file mode 100644 index 736e54dbf..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/TestsDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_forControllerName = $this->_resource->getAttribute('forControllerName'); - $this->_filesystemName = $this->_convertControllerNameToFilesystemName($this->_forControllerName); - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - return [ - 'forControllerName' => $this->_forControllerName, - ]; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ViewControllerScriptsDirectory'; - } - - protected function _convertControllerNameToFilesystemName($controllerName) - { - $filter = new Zend_Filter(); - $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()) - ->addFilter(new Zend_Filter_StringToLower()); - - return $filter->filter($controllerName); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php deleted file mode 100644 index 8a0b8069a..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_resource->getAttribute('forActionName')) { - $this->_forActionName = $forActionName; - $this->_filesystemName = $this->_convertActionNameToFilesystemName($forActionName).'.phtml'; - } elseif ($scriptName = $this->_resource->getAttribute('scriptName')) { - $this->_scriptName = $scriptName; - $this->_filesystemName = $scriptName.'.phtml'; - } else { - throw new Exception('Either a forActionName or scriptName is required.'); - } - - parent::init(); - - return $this; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - $attributes = []; - - if ($this->_forActionName) { - $attributes['forActionName'] = $this->_forActionName; - } - - if ($this->_scriptName) { - $attributes['scriptName'] = $this->_scriptName; - } - - return $attributes; - } - - /** - * getContents(). - * - * @return string - */ - public function getContents() - { - $contents = ''; - - $controllerName = $this->_resource->getParentResource()->getAttribute('forControllerName'); - - $viewsDirectoryResource = $this->_resource - ->getParentResource() // view script - ->getParentResource() // view controller dir - ->getParentResource(); // views dir - if ('ModuleDirectory' == $viewsDirectoryResource->getParentResource()->getName()) { - $moduleName = $viewsDirectoryResource->getParentResource()->getModuleName(); - } else { - $moduleName = 'default'; - } - - if ('error.phtml' == $this->_filesystemName) { // should also check that the above directory is forController=error - $contents .= << - - - - Zend Framework Default Application - - -

An error occurred

-

message ?>

- - exception)): ?> - -

Exception information:

-

- Message: exception->getMessage() ?> -

- -

Stack trace:

-
exception->getTraceAsString() ?>
-  
- -

Request Parameters:

-
escape(var_export(\$this->request->getParams(), true)) ?>
-  
- - - - - - -EOS; - } elseif ('index' == $this->_forActionName && 'Index' == $controllerName && 'default' == $moduleName) { - $contents = << - a:link, - a:visited - { - color: #0398CA; - } - - span#zf-name - { - color: #91BE3F; - } - - div#welcome - { - color: #FFFFFF; - background-image: url(http://framework.zend.com/images/bkg_header.jpg); - width: 600px; - height: 400px; - border: 2px solid #444444; - overflow: hidden; - text-align: center; - } - - div#more-information - { - background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif); - height: 100%; - } - -
-

Welcome to the Zend Framework!

- -

This is your project's main page

- -
-

-

- Helpful Links:
- Zend Framework Website | - Zend Framework Manual -

-
-
-EOS; - } else { - $controllerName = $this->_resource->getParentResource()->getAttribute('forControllerName'); - $actionName = $this->_forActionName; - $contents = <<
-
-

View script for controller $controllerName and script/action name $actionName

-
-EOS; - } - - return $contents; - } - - protected function _convertActionNameToFilesystemName($actionName) - { - $filter = new Zend_Filter(); - $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()) - ->addFilter(new Zend_Filter_StringToLower()); - - return $filter->filter($actionName); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php b/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php deleted file mode 100644 index be4966e0f..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_getZfPath(); - if (false != $zfPath) { - $zfIterator = new RecursiveDirectoryIterator($zfPath); - foreach ($rii = new RecursiveIteratorIterator($zfIterator, RecursiveIteratorIterator::SELF_FIRST) as $file) { - $relativePath = preg_replace('#^'.preg_quote(realpath($zfPath), '#').'#', '', realpath($file->getPath())).DIRECTORY_SEPARATOR.$file->getFilename(); - if (false !== strpos((string) $relativePath, DIRECTORY_SEPARATOR.'.')) { - continue; - } - - if ($file->isDir()) { - mkdir($this->getBaseDirectory().DIRECTORY_SEPARATOR.$this->getFilesystemName().$relativePath); - } else { - copy($file->getPathname(), $this->getBaseDirectory().DIRECTORY_SEPARATOR.$this->getFilesystemName().$relativePath); - } - } - } - } - - /** - * _getZfPath(). - * - * @return string|false - */ - protected function _getZfPath() - { - // require_once 'Zend/Loader.php'; - foreach (Zend_Loader::explodeIncludePath() as $includePath) { - if (!file_exists((string) $includePath) || '.' == $includePath[0]) { - continue; - } - - if (false !== realpath($checkedPath = rtrim((string) $includePath, '\\/').'/Zend/Loader.php') && file_exists((string) $checkedPath)) { - return dirname($checkedPath); - } - } - - return false; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Exception.php b/packages/zend-tool/library/Zend/Tool/Project/Exception.php deleted file mode 100644 index 96cfcf799..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -setOptions($options); - } - - $this->_topResources = new Zend_Tool_Project_Profile_Resource_Container(); - } - - /** - * Process options and either set a profile property or - * set a profile 'attribute'. - */ - public function setOptions(array $options) - { - $this->setAttributes($options); - } - - /** - * getIterator() - reqruied by the RecursiveIterator interface. - * - * @return RecursiveIteratorIterator - */ - #[ReturnTypeWillChange] - public function getIterator() - { - // require_once 'Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php'; - - return new RecursiveIteratorIterator( - new Zend_Tool_Project_Profile_Iterator_EnabledResourceFilter($this), - RecursiveIteratorIterator::SELF_FIRST - ); - } - - /** - * loadFromData() - Load a profile from data provided by the - * 'profilData' attribute. - */ - public function loadFromData() - { - if (!isset($this->_attributes['profileData'])) { - // require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('loadFromData() must have "profileData" set.'); - } - - $profileFileParser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $profileFileParser->unserialize($this->_attributes['profileData'], $this); - - $this->rewind(); - } - - /** - * isLoadableFromFile() - can a profile be loaded from a file. - * - * wether or not a profile can be loaded from the - * file in attribute 'projectProfileFile', or from a file named - * '.zfproject.xml' inside a directory in key 'projectDirectory' - * - * @return bool - */ - public function isLoadableFromFile() - { - if (!isset($this->_attributes['projectProfileFile']) && !isset($this->_attributes['projectDirectory'])) { - return false; - } - - if (isset($this->_attributes['projectProfileFile'])) { - $projectProfileFilePath = $this->_attributes['projectProfileFile']; - if (!file_exists((string) $projectProfileFilePath)) { - return false; - } - } else { - $projectProfileFilePath = rtrim((string) $this->_attributes['projectDirectory'], '/\\').'/.zfproject.xml'; - if (!file_exists((string) $projectProfileFilePath)) { - return false; - } - } - - return true; - } - - /** - * loadFromFile() - Load data from file. - * - * this attempts to load a project profile file from a variety of locations depending - * on what information the user provided vie $options or attributes, specifically the - * 'projectDirectory' or 'projectProfileFile' - */ - public function loadFromFile() - { - // if no data is supplied, need either a projectProfileFile or a projectDirectory - if (!isset($this->_attributes['projectProfileFile']) && !isset($this->_attributes['projectDirectory'])) { - // require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('loadFromFile() must have at least "projectProfileFile" or "projectDirectory" set.'); - } - - if (isset($this->_attributes['projectProfileFile'])) { - $projectProfileFilePath = $this->_attributes['projectProfileFile']; - if (!file_exists((string) $projectProfileFilePath)) { - // require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('"projectProfileFile" was supplied but file was not found at location '.$projectProfileFilePath); - } - $this->_attributes['projectDirectory'] = dirname($projectProfileFilePath); - } else { - $projectProfileFilePath = rtrim((string) $this->_attributes['projectDirectory'], '/\\').'/.zfproject.xml'; - if (!file_exists((string) $projectProfileFilePath)) { - // require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('"projectDirectory" was supplied but no profile file file was not found at location '.$projectProfileFilePath); - } - $this->_attributes['projectProfileFile'] = $projectProfileFilePath; - } - - $profileData = file_get_contents($projectProfileFilePath); - - $profileFileParser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $profileFileParser->unserialize($profileData, $this); - - $this->rewind(); - } - - /** - * storeToFile() - store the current profile to file. - * - * This will store the profile in memory to a place on disk determined by the attributes - * available, specifically if the key 'projectProfileFile' is available - */ - public function storeToFile() - { - $file = null; - - if (isset($this->_attributes['projectProfileFile'])) { - $file = $this->_attributes['projectProfileFile']; - } - - if (null == $file) { - // require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('storeToFile() must have a "projectProfileFile" attribute set.'); - } - - $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $xml = $parser->serialize($this); - file_put_contents($file, $xml); - } - - /** - * storeToData() - create a string representation of the profile in memory. - * - * @return string - */ - public function storeToData() - { - $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $xml = $parser->serialize($this); - - return $xml; - } - - /** - * __toString() - cast this profile to string to be able to view it. - * - * @return string - */ - public function __toString() - { - $string = ''; - foreach ($this as $resource) { - $string .= $resource->getName().PHP_EOL; - $rii = new RecursiveIteratorIterator($resource, RecursiveIteratorIterator::SELF_FIRST); - foreach ($rii as $item) { - $string .= str_repeat(' ', $rii->getDepth() + 1).$item->getName() - .((count($attributes = $item->getAttributes()) > 0) ? ' ['.http_build_query($attributes).']' : '') - .PHP_EOL; - } - } - - return $string; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Profile/Exception.php b/packages/zend-tool/library/Zend/Tool/Project/Profile/Exception.php deleted file mode 100644 index 5ef1bdf76..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Profile/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -_contextRepository = Zend_Tool_Project_Context_Repository::getInstance(); - } - - /** - * serialize(). - * - * create an xml string from the provided profile - * - * @return string - */ - public function serialize(Zend_Tool_Project_Profile $profile) - { - $profile = clone $profile; - - $this->_profile = $profile; - $xmlElement = new SimpleXMLElement(''); - - if ($profile->hasAttribute('type')) { - $xmlElement->addAttribute('type', $profile->getAttribute('type')); - } - - if ($profile->hasAttribute('version')) { - $xmlElement->addAttribute('version', $profile->getAttribute('version')); - } - - self::_serializeRecurser($profile, $xmlElement); - - $doc = new DOMDocument('1.0'); - $doc->formatOutput = true; - $domnode = dom_import_simplexml($xmlElement); - $domnode = $doc->importNode($domnode, true); - $domnode = $doc->appendChild($domnode); - - return $doc->saveXML(); - } - - /** - * unserialize(). - * - * Create a structure in the object $profile from the structure specficied - * in the xml string provided - * - * @param string xml data - * @param Zend_Tool_Project_Profile The profile to use as the top node - * - * @return Zend_Tool_Project_Profile - */ - public function unserialize($data, Zend_Tool_Project_Profile $profile) - { - if (null == $data) { - throw new Exception('contents not available to unserialize.'); - } - - $this->_profile = $profile; - - $xmlDataIterator = new SimpleXMLIterator($data); - - if ('projectProfile' != $xmlDataIterator->getName()) { - throw new Exception('Profiles must start with a projectProfile node'); - } - - if (isset($xmlDataIterator['type'])) { - $this->_profile->setAttribute('type', (string) $xmlDataIterator['type']); - } - - if (isset($xmlDataIterator['version'])) { - $this->_profile->setAttribute('version', (string) $xmlDataIterator['version']); - } - - // start un-serialization of the xml doc - $this->_unserializeRecurser($xmlDataIterator); - - // contexts should be initialized after the unwinding of the profile structure - $this->_lazyLoadContexts(); - - return $this->_profile; - } - - /** - * _serializeRecurser(). - * - * This method will be used to traverse the depths of the structure - * when *serializing* an xml structure into a string - * - * @param array $resources - */ - protected function _serializeRecurser($resources, SimpleXMLElement $xmlNode) - { - // @todo find a better way to handle concurrency.. if no clone, _position in node gets messed up - // if ($resources instanceof Zend_Tool_Project_Profile_Resource) { - // $resources = clone $resources; - // } - - foreach ($resources as $resource) { - if ($resource->isDeleted()) { - continue; - } - - $resourceName = $resource->getContext()->getName(); - $resourceName[0] = strtolower((string) $resourceName[0]); - - $newNode = $xmlNode->addChild($resourceName); - - // $reflectionClass = new ReflectionClass($resource->getContext()); - - if (false == $resource->isEnabled()) { - $newNode->addAttribute('enabled', 'false'); - } - - foreach ($resource->getPersistentAttributes() as $paramName => $paramValue) { - $newNode->addAttribute($paramName, $paramValue); - } - - if ($resource->hasChildren()) { - self::_serializeRecurser($resource, $newNode); - } - } - } - - /** - * _unserializeRecurser(). - * - * This method will be used to traverse the depths of the structure - * as needed to *unserialize* the profile from an xmlIterator - */ - protected function _unserializeRecurser(SimpleXMLIterator $xmlIterator, Zend_Tool_Project_Profile_Resource $resource = null) - { - foreach ($xmlIterator as $resourceName => $resourceData) { - $contextName = $resourceName; - $subResource = new Zend_Tool_Project_Profile_Resource($contextName); - $subResource->setProfile($this->_profile); - - if ($resourceAttributes = $resourceData->attributes()) { - $attributes = []; - foreach ($resourceAttributes as $attrName => $attrValue) { - $attributes[$attrName] = (string) $attrValue; - } - $subResource->setAttributes($attributes); - } - - if ($resource) { - $resource->append($subResource, false); - } else { - $this->_profile->append($subResource); - } - - if (false == $this->_contextRepository->isOverwritableContext($contextName)) { - $subResource->initializeContext(); - } - - if ($xmlIterator->hasChildren()) { - self::_unserializeRecurser($xmlIterator->getChildren(), $subResource); - } - } - } - - /** - * _lazyLoadContexts(). - * - * This method will call initializeContext on the resources in a profile - * - * @todo determine if this method belongs inside the profile - */ - protected function _lazyLoadContexts() - { - foreach ($this->_profile as $topResource) { - $rii = new RecursiveIteratorIterator($topResource, RecursiveIteratorIterator::SELF_FIRST); - foreach ($rii as $resource) { - $resource->initializeContext(); - } - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php b/packages/zend-tool/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php deleted file mode 100644 index c1a9518db..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Profile/Iterator/ContextFilter.php +++ /dev/null @@ -1,216 +0,0 @@ -_rawOptions = $options; - if ($options) { - $this->setOptions($options); - } - } - - /** - * setOptions(). - */ - public function setOptions(array $options) - { - foreach ($options as $optionName => $optionValue) { - if ('s' != substr((string) $optionName, -1, 1)) { - $optionName .= 's'; - } - if (method_exists($this, 'set'.$optionName)) { - $this->{'set'.$optionName}($optionValue); - } - } - } - - /** - * setAcceptTypes(). - * - * @param array|string $acceptTypes - * - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setAcceptTypes($acceptTypes) - { - if (!is_array($acceptTypes)) { - $acceptTypes = [$acceptTypes]; - } - - $this->_acceptTypes = $acceptTypes; - - return $this; - } - - /** - * setDenyTypes(). - * - * @param array|string $denyTypes - * - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setDenyTypes($denyTypes) - { - if (!is_array($denyTypes)) { - $denyTypes = [$denyTypes]; - } - - $this->_denyTypes = $denyTypes; - - return $this; - } - - /** - * setAcceptNames(). - * - * @param array|string $acceptNames - * - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setAcceptNames($acceptNames) - { - if (!is_array($acceptNames)) { - $acceptNames = [$acceptNames]; - } - - foreach ($acceptNames as $n => $v) { - $acceptNames[$n] = strtolower((string) $v); - } - - $this->_acceptNames = $acceptNames; - - return $this; - } - - /** - * setDenyNames(). - * - * @param array|string $denyNames - * - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setDenyNames($denyNames) - { - if (!is_array($denyNames)) { - $denyNames = [$denyNames]; - } - - foreach ($denyNames as $n => $v) { - $denyNames[$n] = strtolower((string) $v); - } - - $this->_denyNames = $denyNames; - - return $this; - } - - /** - * accept() is required by teh RecursiveFilterIterator. - * - * @return bool - */ - #[ReturnTypeWillChange] - public function accept() - { - $currentItem = $this->current(); - - if (in_array(strtolower((string) $currentItem->getName()), $this->_acceptNames)) { - return true; - } elseif (in_array(strtolower((string) $currentItem->getName()), $this->_denyNames)) { - return false; - } - - foreach ($this->_acceptTypes as $acceptType) { - if ($currentItem->getContent() instanceof $acceptType) { - return true; - } - } - - foreach ($this->_denyTypes as $denyType) { - if ($currentItem->getContext() instanceof $denyType) { - return false; - } - } - - return true; - } - - /** - * getChildren(). - * - * This is here due to a bug/design issue in PHP - * - * @return object - * - * @see - */ - #[ReturnTypeWillChange] - public function getChildren() - { - if (empty($this->ref)) { - $this->ref = new ReflectionClass($this); - } - - return $this->ref->newInstance($this->getInnerIterator()->getChildren(), $this->_rawOptions); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php b/packages/zend-tool/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php deleted file mode 100644 index ae14a6d8d..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php +++ /dev/null @@ -1,43 +0,0 @@ -current()->isEnabled(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource.php b/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource.php deleted file mode 100644 index 8dc62d113..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource.php +++ /dev/null @@ -1,269 +0,0 @@ -setContext($context); - } - - /** - * setContext(). - * - * @param string|Zend_Tool_Project_Context_Interface $context - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function setContext($context) - { - $this->_context = $context; - - return $this; - } - - /** - * getContext(). - * - * @return string|Zend_Tool_Project_Context|null - */ - public function getContext() - { - return $this->_context; - } - - /** - * getName() - Get the resource name. - * - * Name is derived from the context name - * - * @return string - */ - public function getName() - { - if (is_string($this->_context)) { - return $this->_context; - } elseif ($this->_context instanceof Zend_Tool_Project_Context_Interface) { - return $this->_context->getName(); - } else { - throw new Zend_Tool_Project_Exception('Invalid context in resource'); - } - } - - /** - * setProfile(). - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function setProfile(Zend_Tool_Project_Profile $profile) - { - $this->_profile = $profile; - - return $this; - } - - /** - * getProfile. - * - * @return Zend_Tool_Project_Profile - */ - public function getProfile() - { - return $this->_profile; - } - - /** - * getPersistentAttributes(). - * - * @return array - */ - public function getPersistentAttributes() - { - if (method_exists($this->_context, 'getPersistentAttributes')) { - return $this->_context->getPersistentAttributes(); - } - - return []; - } - - /** - * setEnabled(). - * - * @param bool $enabled - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function setEnabled($enabled = true) - { - // convert fuzzy types to bool - $this->_enabled = (!in_array($enabled, ['false', 'disabled', 0, -1, false], true)) ? true : false; - - return $this; - } - - /** - * isEnabled(). - * - * @return bool - */ - public function isEnabled() - { - return $this->_enabled; - } - - /** - * setDeleted(). - * - * @param bool $deleted - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function setDeleted($deleted = true) - { - $this->_deleted = (bool) $deleted; - - return $this; - } - - /** - * isDeleted(). - * - * @return bool - */ - public function isDeleted() - { - return $this->_deleted; - } - - /** - * initializeContext(). - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function initializeContext() - { - if ($this->_isContextInitialized) { - return; - } - if (is_string($this->_context)) { - $this->_context = Zend_Tool_Project_Context_Repository::getInstance()->getContext($this->_context); - } - - if (method_exists($this->_context, 'setResource')) { - $this->_context->setResource($this); - } - - if (method_exists($this->_context, 'init')) { - $this->_context->init(); - } - - $this->_isContextInitialized = true; - - return $this; - } - - /** - * __toString(). - * - * @return string - */ - public function __toString() - { - return $this->_context->getName(); - } - - /** - * __call(). - * - * @param string $method - * @param array $arguments - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function __call($method, $arguments) - { - if (method_exists($this->_context, $method)) { - if (!$this->isEnabled()) { - $this->setEnabled(true); - } - - return call_user_func_array([$this->_context, $method], $arguments); - } else { - throw new Zend_Tool_Project_Profile_Exception('cannot call '.$method); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource/Container.php b/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource/Container.php deleted file mode 100644 index 993a55484..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource/Container.php +++ /dev/null @@ -1,425 +0,0 @@ - - * - * - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function search($matchSearchConstraints, $nonMatchSearchConstraints = null) - { - if (!$matchSearchConstraints instanceof Zend_Tool_Project_Profile_Resource_SearchConstraints) { - $matchSearchConstraints = new Zend_Tool_Project_Profile_Resource_SearchConstraints($matchSearchConstraints); - } - - $this->rewind(); - - /* - * @todo This should be re-written with better support for a filter iterator, its the way to go - */ - - if ($nonMatchSearchConstraints) { - $filterIterator = new Zend_Tool_Project_Profile_Iterator_ContextFilter($this, ['denyNames' => $nonMatchSearchConstraints]); - $riIterator = new RecursiveIteratorIterator($filterIterator, RecursiveIteratorIterator::SELF_FIRST); - } else { - $riIterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST); - } - - $foundResource = false; - $currentConstraint = $matchSearchConstraints->getConstraint(); - $foundDepth = 0; - - foreach ($riIterator as $currentResource) { - // if current depth is less than found depth, end - if ($riIterator->getDepth() < $foundDepth) { - break; - } - - if (strtolower((string) $currentResource->getName()) == strtolower((string) $currentConstraint->name)) { - $paramsMatch = true; - - // @todo check to ensure params match (perhaps) - if (count($currentConstraint->params) > 0) { - $currentResourceAttributes = $currentResource->getAttributes(); - if (!is_array($currentConstraint->params)) { - // require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('Search parameter specifics must be in the form of an array for key "'.$currentConstraint->name.'"'); - } - foreach ($currentConstraint->params as $paramName => $paramValue) { - if (!isset($currentResourceAttributes[$paramName]) || $currentResourceAttributes[$paramName] != $paramValue) { - $paramsMatch = false; - break; - } - } - } - - if ($paramsMatch) { - $foundDepth = $riIterator->getDepth(); - - if (($currentConstraint = $matchSearchConstraints->getConstraint()) == null) { - $foundResource = $currentResource; - break; - } - } - } - } - - return $foundResource; - } - - /** - * createResourceAt(). - * - * @param array|Zend_Tool_Project_Profile_Resource_SearchConstraints $appendResourceOrSearchConstraints - * @param string $context - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function createResourceAt($appendResourceOrSearchConstraints, $context, array $attributes = []) - { - if (!$appendResourceOrSearchConstraints instanceof Zend_Tool_Project_Profile_Resource_Container) { - if (($parentResource = $this->search($appendResourceOrSearchConstraints)) == false) { - // require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('No node was found to append to.'); - } - } else { - $parentResource = $appendResourceOrSearchConstraints; - } - - return $parentResource->createResource($context, $attributes); - } - - /** - * createResource(). - * - * Method to create a resource with a given context with specific attributes - * - * @param string $context - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function createResource($context, array $attributes = []) - { - if (is_string($context)) { - $contextRegistry = Zend_Tool_Project_Context_Repository::getInstance(); - if ($contextRegistry->hasContext($context)) { - $context = $contextRegistry->getContext($context); - } else { - // require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('Context by name '.$context.' was not found in the context registry.'); - } - } elseif (!$context instanceof Zend_Tool_Project_Context_Interface) { - // require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('Context must be of type string or Zend_Tool_Project_Context_Interface.'); - } - - $newResource = new Zend_Tool_Project_Profile_Resource($context); - - if ($attributes) { - $newResource->setAttributes($attributes); - } - - /* - * Interesting logic here: - * - * First set the parentResource (this will also be done inside append). This will allow - * the initialization routine to change the appendability of the parent resource. This - * is important to allow specific resources to be appendable by very specific sub-resources. - */ - $newResource->setParentResource($this); - $newResource->initializeContext(); - $this->append($newResource); - - return $newResource; - } - - /** - * setAttributes(). - * - * persist the attributes if the resource will accept them - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setAttributes(array $attributes) - { - foreach ($attributes as $attrName => $attrValue) { - $setMethod = 'set'.$attrName; - if (method_exists($this, $setMethod)) { - $this->{$setMethod}($attrValue); - } else { - $this->setAttribute($attrName, $attrValue); - } - } - - return $this; - } - - /** - * getAttributes(). - * - * @return array - */ - public function getAttributes() - { - return $this->_attributes; - } - - /** - * setAttribute(). - * - * @param string $name - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setAttribute($name, $value) - { - $this->_attributes[$name] = $value; - - return $this; - } - - /** - * getAttribute(). - * - * @param string $name - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function getAttribute($name) - { - return (array_key_exists($name, $this->_attributes)) ? $this->_attributes[$name] : null; - } - - /** - * hasAttribute(). - * - * @param string $name - * - * @return bool - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->_attributes); - } - - /** - * setAppendable(). - * - * @param bool $appendable - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setAppendable($appendable) - { - $this->_appendable = (bool) $appendable; - - return $this; - } - - /** - * isAppendable(). - * - * @return bool - */ - public function isAppendable() - { - return $this->_appendable; - } - - /** - * setParentResource(). - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setParentResource(Zend_Tool_Project_Profile_Resource_Container $parentResource) - { - $this->_parentResource = $parentResource; - - return $this; - } - - /** - * getParentResource(). - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function getParentResource() - { - return $this->_parentResource; - } - - /** - * append(). - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function append(Zend_Tool_Project_Profile_Resource_Container $resource) - { - if (!$this->isAppendable()) { - throw new Exception('Resource by name '.(string) $this.' is not appendable'); - } - array_push($this->_subResources, $resource); - $resource->setParentResource($this); - - return $this; - } - - /** - * current() - required by RecursiveIterator. - * - * @return Zend_Tool_Project_Profile_Resource - */ - #[ReturnTypeWillChange] - public function current() - { - return current($this->_subResources); - } - - /** - * key() - required by RecursiveIterator. - * - * @return int - */ - #[ReturnTypeWillChange] - public function key() - { - return key($this->_subResources); - } - - /** - * next() - required by RecursiveIterator. - * - * @return bool - */ - #[ReturnTypeWillChange] - public function next() - { - return next($this->_subResources); - } - - /** - * rewind() - required by RecursiveIterator. - * - * @return bool - */ - #[ReturnTypeWillChange] - public function rewind() - { - return reset($this->_subResources); - } - - /** - * valid() - - required by RecursiveIterator. - * - * @return bool - */ - #[ReturnTypeWillChange] - public function valid() - { - return (bool) $this->current(); - } - - /** - * hasChildren(). - * - * @return bool - */ - #[ReturnTypeWillChange] - public function hasChildren() - { - return count($this->_subResources) > 0; - } - - /** - * getChildren(). - * - * @return Zend_Tool_Project_Profile_Resource - */ - #[ReturnTypeWillChange] - public function getChildren() - { - return $this->current(); - } - - /** - * count(). - * - * @return int - */ - #[ReturnTypeWillChange] - public function count() - { - return count($this->_subResources); - } - - /** - * __clone(). - */ - public function __clone() - { - $this->rewind(); - foreach ($this->_subResources as $index => $resource) { - $this->_subResources[$index] = clone $resource; - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource/SearchConstraints.php b/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource/SearchConstraints.php deleted file mode 100644 index cc3fa6631..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Profile/Resource/SearchConstraints.php +++ /dev/null @@ -1,117 +0,0 @@ -addConstraint($options); - } elseif (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * setOptions(). - * - * @return Zend_Tool_Project_Profile_Resource_SearchConstraints - */ - public function setOptions(array $option) - { - foreach ($option as $optionName => $optionValue) { - if (is_int($optionName)) { - $this->addConstraint($optionValue); - } elseif (is_string($optionName)) { - $this->addConstraint(['name' => $optionName, 'params' => $optionValue]); - } - } - - return $this; - } - - /** - * addConstraint(). - * - * @param string|array $constraint - * - * @return Zend_Tool_Project_Profile_Resource_SearchConstraints - */ - public function addConstraint($constraint) - { - if (is_string($constraint)) { - $name = $constraint; - $params = []; - } elseif (is_array($constraint)) { - $name = $constraint['name']; - $params = $constraint['params']; - } - - $constraint = $this->_makeConstraint($name, $params); - - array_push($this->_constraints, $constraint); - - return $this; - } - - /** - * getConstraint(). - * - * @return ArrayObject - */ - public function getConstraint() - { - return array_shift($this->_constraints); - } - - /** - * _makeConstraint. - * - * @param string $name - * - * @return ArrayObject - */ - protected function _makeConstraint($name, $params) - { - $value = ['name' => $name, 'params' => $params]; - - return new ArrayObject($value, ArrayObject::ARRAY_AS_PROPS); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Abstract.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Abstract.php deleted file mode 100644 index 6b87731df..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Abstract.php +++ /dev/null @@ -1,278 +0,0 @@ -addContextsFromDirectory( - dirname(__DIR__).'/Context/Zf/', 'Zend_Tool_Project_Context_Zf_' - ); - $contextRegistry->addContextsFromDirectory( - dirname(__DIR__).'/Context/Filesystem/', 'Zend_Tool_Project_Context_Filesystem_' - ); - - // determine if there are project specfic providers ONCE - $profilePath = $this->_findProfileDirectory(); - if ($this->_hasProjectProviderDirectory($profilePath.DIRECTORY_SEPARATOR.'.zfproject.xml')) { - $profile = $this->_loadProfile(); - // project providers directory resource - $ppd = $profile->search('ProjectProvidersDirectory'); - $ppd->loadProviders($this->_registry); - } - - self::$_isInitialized = true; - } - - // load up the extending providers required context classes - if ($contextClasses = $this->getContextClasses()) { - $this->_loadContextClassesIntoRegistry($contextClasses); - } - } - - public function getContextClasses() - { - return []; - } - - /** - * _getProject is designed to find if there is project file in the context of where - * the client has been called from.. The search order is as follows.. - * - traversing downwards from (PWD) - current working directory - * - if an enpoint variable has been registered in teh client registry - key=workingDirectory - * - if an ENV variable with the key ZFPROJECT_PATH is found. - * - * @param bool $loadProfileFlag Whether or not to throw an exception when no profile is found - * @param string $projectDirectory The project directory to use to search - * @param bool $searchParentDirectories Whether or not to search upper level direcotries - * - * @return Zend_Tool_Project_Profile - */ - protected function _loadProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION, $projectDirectory = null, $searchParentDirectories = true) - { - $foundPath = $this->_findProfileDirectory($projectDirectory, $searchParentDirectories); - - if (false == $foundPath) { - if (self::NO_PROFILE_THROW_EXCEPTION == $loadProfileFlag) { - throw new Zend_Tool_Project_Provider_Exception('A project profile was not found.'); - } else { - return false; - } - } - - $profile = new Zend_Tool_Project_Profile(); - $profile->setAttribute('projectDirectory', $foundPath); - $profile->loadFromFile(); - $this->_loadedProfile = $profile; - - return $profile; - } - - protected function _findProfileDirectory($projectDirectory = null, $searchParentDirectories = true) - { - // use the cwd if no directory was provided - if (null == $projectDirectory) { - $projectDirectory = getcwd(); - } elseif (false == realpath($projectDirectory)) { - throw new Zend_Tool_Project_Provider_Exception('The $projectDirectory supplied does not exist.'); - } - - $profile = new Zend_Tool_Project_Profile(); - - $parentDirectoriesArray = explode(DIRECTORY_SEPARATOR, ltrim((string) $projectDirectory, DIRECTORY_SEPARATOR)); - while ($parentDirectoriesArray) { - $projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray); - - if (DIRECTORY_SEPARATOR !== '\\') { - $projectDirectoryAssembled = DIRECTORY_SEPARATOR.$projectDirectoryAssembled; - } - - $profile->setAttribute('projectDirectory', $projectDirectoryAssembled); - if ($profile->isLoadableFromFile()) { - unset($profile); - - return $projectDirectoryAssembled; - } - - // break after first run if we are not to check upper directories - if (false == $searchParentDirectories) { - break; - } - - array_pop($parentDirectoriesArray); - } - - return false; - } - - /** - * Load the project profile from the current working directory, if not throw exception. - * - * @return Zend_Tool_Project_Profile - */ - protected function _loadProfileRequired() - { - $profile = $this->_loadProfile(); - if (false === $profile) { - // require_once 'Zend/Tool/Project/Provider/Exception.php'; - throw new Zend_Tool_Project_Provider_Exception('A project profile was not found in the current working directory.'); - } - - return $profile; - } - - /** - * Return the currently loaded profile. - * - * @return Zend_Tool_Project_Profile - */ - protected function _getProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION) - { - if (!$this->_loadedProfile) { - if ((false === $this->_loadProfile($loadProfileFlag)) && (self::NO_PROFILE_RETURN_FALSE === $loadProfileFlag)) { - return false; - } - } - - return $this->_loadedProfile; - } - - /** - * _storeProfile(). - * - * This method will store the profile into its proper location - */ - protected function _storeProfile() - { - $projectProfileFile = $this->_loadedProfile->search('ProjectProfileFile'); - - $name = $projectProfileFile->getContext()->getPath(); - - $this->_registry->getResponse()->appendContent('Updating project profile \''.$name.'\''); - - $projectProfileFile->getContext()->save(); - } - - protected function _getContentForContext(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters) - { - $storage = $this->_registry->getStorage(); - if (!$storage->isEnabled()) { - return false; - } - - if (!class_exists('Zend_Tool_Project_Context_Content_Engine')) { - // require_once 'Zend/Tool/Project/Context/Content/Engine.php'; - } - - $engine = new Zend_Tool_Project_Context_Content_Engine($storage); - - return $engine->getContent($context, $methodName, $parameters); - } - - protected function _hasProjectProviderDirectory($pathToProfileFile) - { - // do some static analysis of the file so that we can determin whether or not to incure - // the cost of loading the profile before the system is fully bootstrapped - if (!file_exists((string) $pathToProfileFile)) { - return false; - } - - $contents = file_get_contents($pathToProfileFile); - if (false === strstr((string) $contents, 'addContextClass($contextClass); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Action.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Action.php deleted file mode 100644 index 3ad7f137e..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Action.php +++ /dev/null @@ -1,233 +0,0 @@ -createResource('ActionMethod', ['actionName' => $actionName]); - - return $actionMethod; - } - - /** - * hasResource(). - * - * @param string $actionName - * @param string $controllerName - * @param string $moduleName - * - * @return bool - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $actionName, $controllerName, $moduleName = null) - { - if (!is_string($actionName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Action::createResource() expects \"actionName\" is the name of a action resource to create.'); - } - - if (!is_string($controllerName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Action::createResource() expects \"controllerName\" is the name of a controller resource to create.'); - } - - $controllerFile = self::_getControllerFileResource($profile, $controllerName, $moduleName); - - if (null == $controllerFile) { - throw new Zend_Tool_Project_Provider_Exception('Controller '.$controllerName.' was not found.'); - } - - return ($controllerFile->search(['actionMethod' => ['actionName' => $actionName]])) instanceof Zend_Tool_Project_Profile_Resource; - } - - /** - * _getControllerFileResource(). - * - * @param string $controllerName - * @param string $moduleName - * - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getControllerFileResource(Zend_Tool_Project_Profile $profile, $controllerName, $moduleName = null) - { - $profileSearchParams = []; - - if (null != $moduleName && is_string($moduleName)) { - $profileSearchParams = ['modulesDirectory', 'moduleDirectory' => ['moduleName' => $moduleName]]; - } - - $profileSearchParams[] = 'controllersDirectory'; - $profileSearchParams['controllerFile'] = ['controllerName' => $controllerName]; - - return $profile->search($profileSearchParams); - } - - /** - * create(). - * - * @param string $name action name for controller, in camelCase format - * @param string $controllerName controller name action should be applied to - * @param bool $viewIncluded whether the view should the view be included - * @param string $module module name action should be applied to - */ - public function create($name, $controllerName = 'Index', $viewIncluded = true, $module = null) - { - $this->_loadProfile(); - - // get request/response object - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // determine if testing is enabled in the project - // require_once 'Zend/Tool/Project/Provider/Test.php'; - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - if ($testingEnabled && !Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $testingEnabled = false; - $response->appendContent( - 'Note: PHPUnit is required in order to generate controller test stubs.', - ['color' => ['yellow']] - ); - } - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Action names should be camel cased.'); - } - - $originalName = $name; - $originalControllerName = $controllerName; - - // ensure it is camelCase (lower first letter) - $name = strtolower((string) substr((string) $name, 0, 1)).substr((string) $name, 1); - - // ensure controller is MixedCase - $controllerName = ucfirst($controllerName); - - if (self::hasResource($this->_loadedProfile, $name, $controllerName, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This controller ('.$controllerName.') already has an action named ('.$name.')'); - } - - $actionMethodResource = self::createResource($this->_loadedProfile, $name, $controllerName, $module); - - $testActionMethodResource = null; - if ($testingEnabled) { - $testActionMethodResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $controllerName, $name, $module); - } - - // alert the user about inline converted names - $tense = (($request->isPretend()) ? 'would be' : 'is'); - - if ($name !== $originalName) { - $response->appendContent( - 'Note: The canonical action name that '.$tense - .' used with other providers is "'.$name.'";' - .' not "'.$originalName.'" as supplied', - ['color' => ['yellow']] - ); - } - - if ($controllerName !== $originalControllerName) { - $response->appendContent( - 'Note: The canonical controller name that '.$tense - .' used with other providers is "'.$controllerName.'";' - .' not "'.$originalControllerName.'" as supplied', - ['color' => ['yellow']] - ); - } - - unset($tense); - - if ($request->isPretend()) { - $response->appendContent( - 'Would create an action named '.$name. - ' inside controller at '.$actionMethodResource->getParentResource()->getContext()->getPath() - ); - - if ($testActionMethodResource) { - $response->appendContent('Would create an action test in '.$testActionMethodResource->getParentResource()->getContext()->getPath()); - } - } else { - $response->appendContent( - 'Creating an action named '.$name. - ' inside controller at '.$actionMethodResource->getParentResource()->getContext()->getPath() - ); - $actionMethodResource->create(); - - if ($testActionMethodResource) { - $response->appendContent('Creating an action test in '.$testActionMethodResource->getParentResource()->getContext()->getPath()); - $testActionMethodResource->create(); - } - - $this->_storeProfile(); - } - - if ($viewIncluded) { - $viewResource = Zend_Tool_Project_Provider_View::createResource($this->_loadedProfile, $name, $controllerName, $module); - - if ($this->_registry->getRequest()->isPretend()) { - $response->appendContent( - 'Would create a view script for the '.$name.' action method at '.$viewResource->getContext()->getPath() - ); - } else { - $response->appendContent( - 'Creating a view script for the '.$name.' action method at '.$viewResource->getContext()->getPath() - ); - $viewResource->create(); - $this->_storeProfile(); - } - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Application.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Application.php deleted file mode 100644 index a5b7483b8..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Application.php +++ /dev/null @@ -1,81 +0,0 @@ -_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $originalClassNamePrefix = $classNamePrefix; - - if ('_' != substr((string) $classNamePrefix, -1)) { - $classNamePrefix .= '_'; - } - - $configFileResource = $profile->search('ApplicationConfigFile'); - $zc = $configFileResource->getAsZendConfig('production'); - if ($zc->appnamespace == $classNamePrefix) { - throw new Zend_Tool_Project_Exception('The requested name '.$classNamePrefix.' is already the prefix.'); - } - - // remove the old - $configFileResource->removeStringItem('appnamespace', 'production'); - $configFileResource->create(); - - // add the new - $configFileResource->addStringItem('appnamespace', $classNamePrefix, 'production', true); - $configFileResource->create(); - - // update the project profile - $applicationDirectory = $profile->search('ApplicationDirectory'); - $applicationDirectory->setClassNamePrefix($classNamePrefix); - - $response = $this->_registry->getResponse(); - - if ($originalClassNamePrefix !== $classNamePrefix) { - $response->appendContent( - 'Note: the name provided "'.$originalClassNamePrefix.'" was' - .' altered to "'.$classNamePrefix.'" for correctness.', - ['color' => 'yellow'] - ); - } - - // note to the user - $response->appendContent('Note: All existing models will need to be altered to this new namespace by hand', ['color' => 'yellow']); - $response->appendContent('application.ini updated with new appnamespace '.$classNamePrefix); - - // store profile - $this->_storeProfile(); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Controller.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Controller.php deleted file mode 100644 index 1eef886a6..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Controller.php +++ /dev/null @@ -1,200 +0,0 @@ -createResource( - 'controllerFile', - ['controllerName' => $controllerName, 'moduleName' => $moduleName] - ); - - return $newController; - } - - /** - * hasResource(). - * - * @param string $controllerName - * @param string $moduleName - * - * @return bool - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $controllerName, $moduleName = null) - { - if (!is_string($controllerName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Controller::createResource() expects \"controllerName\" is the name of a controller resource to create.'); - } - - $controllersDirectory = self::_getControllersDirectoryResource($profile, $moduleName); - - return $controllersDirectory && ($controllersDirectory->search(['controllerFile' => ['controllerName' => $controllerName]])) instanceof Zend_Tool_Project_Profile_Resource; - } - - /** - * _getControllersDirectoryResource(). - * - * @param string $moduleName - * - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getControllersDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null) - { - $profileSearchParams = []; - - if (null != $moduleName && is_string($moduleName)) { - $profileSearchParams = ['modulesDirectory', 'moduleDirectory' => ['moduleName' => $moduleName]]; - } - - $profileSearchParams[] = 'controllersDirectory'; - - return $profile->search($profileSearchParams); - } - - /** - * Create a new controller. - * - * @param string $name the name of the controller to create, in camelCase - * @param bool $indexActionIncluded whether or not to create the index action - */ - public function create($name, $indexActionIncluded = true, $module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // get request & response - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // determine if testing is enabled in the project - // require_once 'Zend/Tool/Project/Provider/Test.php'; - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - if ($testingEnabled && !Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $testingEnabled = false; - $response->appendContent( - 'Note: PHPUnit is required in order to generate controller test stubs.', - ['color' => ['yellow']] - ); - } - - $originalName = $name; - $name = ucfirst($name); - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a controller named '.$name); - } - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Controller names should be camel cased.'); - } - - try { - $controllerResource = self::createResource($this->_loadedProfile, $name, $module); - if ($indexActionIncluded) { - $indexActionResource = Zend_Tool_Project_Provider_Action::createResource($this->_loadedProfile, 'index', $name, $module); - $indexActionViewResource = Zend_Tool_Project_Provider_View::createResource($this->_loadedProfile, 'index', $name, $module); - } - if ($testingEnabled) { - $testActionResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module); - } - } catch (Throwable $e) { - $response->setException($e); - - return; - } - - // determime if we need to note to the user about the name - if ($name !== $originalName) { - $tense = (($request->isPretend()) ? 'would be' : 'is'); - $response->appendContent( - 'Note: The canonical controller name that '.$tense - .' used with other providers is "'.$name.'";' - .' not "'.$originalName.'" as supplied', - ['color' => ['yellow']] - ); - unset($tense); - } - - // do the creation - if ($request->isPretend()) { - $response->appendContent('Would create a controller at '.$controllerResource->getContext()->getPath()); - - if (isset($indexActionResource)) { - $response->appendContent('Would create an index action method in controller '.$name); - $response->appendContent('Would create a view script for the index action method at '.$indexActionViewResource->getContext()->getPath()); - } - - if ($testingEnabled) { - $response->appendContent('Would create a controller test file at '.$testActionResource->getParentResource()->getContext()->getPath()); - } - } else { - $response->appendContent('Creating a controller at '.$controllerResource->getContext()->getPath()); - $controllerResource->create(); - - if (isset($indexActionResource)) { - $response->appendContent('Creating an index action method in controller '.$name); - $indexActionResource->create(); - $response->appendContent('Creating a view script for the index action method at '.$indexActionViewResource->getContext()->getPath()); - $indexActionViewResource->create(); - } - - if ($testingEnabled) { - $response->appendContent('Creating a controller test file at '.$testActionResource->getParentResource()->getContext()->getPath()); - $testActionResource->getParentResource()->create(); - $testActionResource->create(); - } - - $this->_storeProfile(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/DbAdapter.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/DbAdapter.php deleted file mode 100644 index e2cd4aad4..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/DbAdapter.php +++ /dev/null @@ -1,131 +0,0 @@ -_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $appConfigFileResource = $profile->search('applicationConfigFile'); - - if (false == $appConfigFileResource) { - throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); - } - - $this->_appConfigFilePath = $appConfigFileResource->getPath(); - - $this->_config = new Zend_Config_Ini($this->_appConfigFilePath, null, ['skipExtends' => true, 'allowModifications' => true]); - - if ('production' != $sectionName) { - $this->_sectionName = $sectionName; - } - - if (!isset($this->_config->{$this->_sectionName})) { - throw new Zend_Tool_Project_Exception('The config does not have a '.$this->_sectionName.' section.'); - } - - if (isset($this->_config->{$this->_sectionName}->resources->db)) { - throw new Zend_Tool_Project_Exception('The config already has a db resource configured in section '.$this->_sectionName.'.'); - } - - if ($dsn) { - $this->_configureViaDSN($dsn); - // } elseif ($interactivelyPrompt) { - // $this->_promptForConfig(); - } else { - $this->_registry->getResponse()->appendContent('Nothing to do!'); - } - } - - protected function _configureViaDSN($dsn) - { - $dsnVars = []; - - if (false === strpos((string) $dsn, '=')) { - throw new Zend_Tool_Project_Provider_Exception('At least one name value pair is expected, typcially in the format of "adapter=Mysqli&username=uname&password=mypass&dbname=mydb"'); - } - - parse_str($dsn, $dsnVars); - - // parse_str suffers when magic_quotes is enabled - if (PHP_VERSION_ID < 50400 && get_magic_quotes_gpc()) { - array_walk_recursive($dsnVars, [$this, '_cleanMagicQuotesInValues']); - } - - $dbConfigValues = ['resources' => ['db' => null]]; - - if (isset($dsnVars['adapter'])) { - $dbConfigValues['resources']['db']['adapter'] = $dsnVars['adapter']; - unset($dsnVars['adapter']); - } - - $dbConfigValues['resources']['db']['params'] = $dsnVars; - - $isPretend = $this->_registry->getRequest()->isPretend(); - - // get the config resource - $applicationConfig = $this->_loadedProfile->search('ApplicationConfigFile'); - $applicationConfig->addItem($dbConfigValues, $this->_sectionName, null); - - $response = $this->_registry->getResponse(); - - if ($isPretend) { - $response->appendContent('A db configuration for the '.$this->_sectionName - .' section would be written to the application config file with the following contents: ' - ); - $response->appendContent($applicationConfig->getContents()); - } else { - $applicationConfig->create(); - $response->appendContent('A db configuration for the '.$this->_sectionName - .' section has been written to the application config file.' - ); - } - } - - protected function _cleanMagicQuotesInValues(&$value, $key) - { - $value = stripslashes($value); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/DbTable.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/DbTable.php deleted file mode 100644 index 482eda157..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/DbTable.php +++ /dev/null @@ -1,211 +0,0 @@ - ['moduleName' => $moduleName]]; - } - - $profileSearchParams[] = 'modelsDirectory'; - - $modelsDirectory = $profile->search($profileSearchParams); - - if (!($modelsDirectory instanceof Zend_Tool_Project_Profile_Resource)) { - throw new Zend_Tool_Project_Provider_Exception('A models directory was not found'.(($moduleName) ? ' for module '.$moduleName.'.' : '.')); - } - - if (!($dbTableDirectory = $modelsDirectory->search('DbTableDirectory'))) { - $dbTableDirectory = $modelsDirectory->createResource('DbTableDirectory'); - } - - $dbTableFile = $dbTableDirectory->createResource('DbTableFile', ['dbTableName' => $dbTableName, 'actualTableName' => $actualTableName]); - - return $dbTableFile; - } - - public static function hasResource(Zend_Tool_Project_Profile $profile, $dbTableName, $moduleName = null) - { - $profileSearchParams = []; - - if (null != $moduleName && is_string($moduleName)) { - $profileSearchParams = ['modulesDirectory', 'moduleDirectory' => ['moduleName' => $moduleName]]; - } - - $profileSearchParams[] = 'modelsDirectory'; - - $modelsDirectory = $profile->search($profileSearchParams); - - if (!($modelsDirectory instanceof Zend_Tool_Project_Profile_Resource) - || !($dbTableDirectory = $modelsDirectory->search('DbTableDirectory'))) { - return false; - } - - $dbTableFile = $dbTableDirectory->search(['DbTableFile' => ['dbTableName' => $dbTableName]]); - - return ($dbTableFile instanceof Zend_Tool_Project_Profile_Resource) ? true : false; - } - - public function create($name, $actualTableName, $module = null, $forceOverwrite = false) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('DbTable names should be camel cased.'); - } - - $originalName = $name; - $name = ucfirst($name); - - if ('' == $actualTableName) { - throw new Zend_Tool_Project_Provider_Exception('You must provide both the DbTable name as well as the actual db table\'s name.'); - } - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a DbTable named '.$name); - } - - // get request/response object - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // alert the user about inline converted names - $tense = (($request->isPretend()) ? 'would be' : 'is'); - - if ($name !== $originalName) { - $response->appendContent( - 'Note: The canonical model name that '.$tense - .' used with other providers is "'.$name.'";' - .' not "'.$originalName.'" as supplied', - ['color' => ['yellow']] - ); - } - - try { - $tableResource = self::createResource($this->_loadedProfile, $name, $actualTableName, $module); - } catch (Throwable $e) { - $response = $this->_registry->getResponse(); - $response->setException($e); - - return; - } - - // do the creation - if ($request->isPretend()) { - $response->appendContent('Would create a DbTable at '.$tableResource->getContext()->getPath()); - } else { - $response->appendContent('Creating a DbTable at '.$tableResource->getContext()->getPath()); - $tableResource->create(); - $this->_storeProfile(); - } - } - - /** - * @param string $module module name action should be applied to - * @param bool $forceOverwrite Whether should force overwriting previous classes generated - * - * @return void - */ - public function createFromDatabase($module = null, $forceOverwrite = false) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $bootstrapResource = $this->_loadedProfile->search('BootstrapFile'); - - /* @var $zendApp Zend_Application */ - $zendApp = $bootstrapResource->getApplicationInstance(); - - try { - $zendApp->bootstrap('db'); - } catch (Zend_Application_Exception $e) { - throw new Zend_Tool_Project_Provider_Exception('Db resource not available, you might need to configure a DbAdapter.'); - - return; - } - - /* @var $db Zend_Db_Adapter_Abstract */ - $db = $zendApp->getBootstrap()->getResource('db'); - - $tableResources = []; - foreach ($db->listTables() as $actualTableName) { - $dbTableName = $this->_convertTableNameToClassName($actualTableName); - - if (!$forceOverwrite && self::hasResource($this->_loadedProfile, $dbTableName, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This DbTable resource already exists, if you wish to overwrite it, pass the "forceOverwrite" flag to this provider.'); - } - - $tableResources[] = self::createResource( - $this->_loadedProfile, - $dbTableName, - $actualTableName, - $module - ); - } - - if (0 == count($tableResources)) { - $this->_registry->getResponse()->appendContent('There are no tables in the selected database to write.'); - } - - // do the creation - if ($this->_registry->getRequest()->isPretend()) { - foreach ($tableResources as $tableResource) { - $this->_registry->getResponse()->appendContent('Would create a DbTable at '.$tableResource->getContext()->getPath()); - } - } else { - foreach ($tableResources as $tableResource) { - $this->_registry->getResponse()->appendContent('Creating a DbTable at '.$tableResource->getContext()->getPath()); - $tableResource->create(); - } - - $this->_storeProfile(); - } - } - - protected function _convertTableNameToClassName($tableName) - { - if (null == $this->_nameFilter) { - $this->_nameFilter = new Zend_Filter(); - $this->_nameFilter - ->addFilter(new Zend_Filter_Word_UnderscoreToCamelCase()); - } - - return $this->_nameFilter->filter($tableName); - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Exception.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Exception.php deleted file mode 100644 index 1143ccf06..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -createResource( - 'formFile', - ['formName' => $formName, 'moduleName' => $moduleName] - ); - - return $newForm; - } - - /** - * hasResource(). - * - * @param string $formName - * @param string $moduleName - * - * @return bool - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $formName, $moduleName = null) - { - if (!is_string($formName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Form::createResource() expects \"formName\" is the name of a form resource to check for existence.'); - } - - $formsDirectory = self::_getFormsDirectoryResource($profile, $moduleName); - - return ($formsDirectory->search(['formFile' => ['formName' => $formName]])) instanceof Zend_Tool_Project_Profile_Resource; - } - - /** - * _getFormsDirectoryResource(). - * - * @param string $moduleName - * - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getFormsDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null) - { - $profileSearchParams = []; - - if (null != $moduleName && is_string($moduleName)) { - $profileSearchParams = ['modulesDirectory', 'moduleDirectory' => ['moduleName' => $moduleName]]; - } - - $profileSearchParams[] = 'formsDirectory'; - - return $profile->search($profileSearchParams); - } - - public function enable($module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // determine if testing is enabled in the project - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - $formDirectoryResource = self::_getFormsDirectoryResource($this->_loadedProfile, $module); - - if ($formDirectoryResource->isEnabled()) { - throw new Zend_Tool_Project_Provider_Exception('This project already has forms enabled.'); - } else { - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would enable forms directory at '.$formDirectoryResource->getContext()->getPath()); - } else { - $this->_registry->getResponse()->appendContent('Enabling forms directory at '.$formDirectoryResource->getContext()->getPath()); - $formDirectoryResource->setEnabled(true); - $formDirectoryResource->create(); - $this->_storeProfile(); - } - } - } - - /** - * Create a new form. - * - * @param string $name - * @param string $module - */ - public function create($name, $module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // determine if testing is enabled in the project - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a form named '.$name); - } - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Form names should be camel cased.'); - } - - $name = ucwords($name); - - try { - $formResource = self::createResource($this->_loadedProfile, $name, $module); - - if ($testingEnabled) { - $testFormResource = null; - // $testFormResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module); - } - } catch (Throwable $e) { - $response = $this->_registry->getResponse(); - $response->setException($e); - - return; - } - - // do the creation - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would create a form at '.$formResource->getContext()->getPath()); - - if ($testFormResource) { - $this->_registry->getResponse()->appendContent('Would create a form test file at '.$testFormResource->getContext()->getPath()); - } - } else { - $this->_registry->getResponse()->appendContent('Creating a form at '.$formResource->getContext()->getPath()); - $formResource->create(); - - if ($testFormResource) { - $this->_registry->getResponse()->appendContent('Creating a form test file at '.$testFormResource->getContext()->getPath()); - $testFormResource->create(); - } - - $this->_storeProfile(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Layout.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Layout.php deleted file mode 100644 index addd42ace..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Layout.php +++ /dev/null @@ -1,140 +0,0 @@ -search('applicationDirectory'); - $layoutDirectory = $applicationDirectory->search('layoutsDirectory'); - - if (false == $layoutDirectory) { - $layoutDirectory = $applicationDirectory->createResource('layoutsDirectory'); - } - - $layoutScriptsDirectory = $layoutDirectory->search('layoutScriptsDirectory'); - - if (false == $layoutScriptsDirectory) { - $layoutScriptsDirectory = $layoutDirectory->createResource('layoutScriptsDirectory'); - } - - $layoutScriptFile = $layoutScriptsDirectory->search('layoutScriptFile', ['layoutName' => 'layout']); - - if (false == $layoutScriptFile) { - $layoutScriptFile = $layoutScriptsDirectory->createResource('layoutScriptFile', ['layoutName' => 'layout']); - } - - return $layoutScriptFile; - } - - public function enable() - { - $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $applicationConfigResource = $profile->search('ApplicationConfigFile'); - - if (!$applicationConfigResource) { - throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); - } - - $zc = $applicationConfigResource->getAsZendConfig(); - - if (isset($zc->resources) && isset($zc->resources->layout)) { - $this->_registry->getResponse()->appendContent('A layout resource already exists in this project\'s application configuration file.'); - - return; - } - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would add "resources.layout.layoutPath" key to the application config file.'); - } else { - $applicationConfigResource->addStringItem('resources.layout.layoutPath', $this->_layoutPath, 'production', false); - $applicationConfigResource->create(); - - $this->_registry->getResponse()->appendContent('A layout entry has been added to the application config file.'); - - $layoutScriptFile = self::createResource($profile); - if (!$layoutScriptFile->exists()) { - $layoutScriptFile->create(); - $this->_registry->getResponse()->appendContent( - 'A default layout has been created at ' - .$layoutScriptFile->getPath() - ); - } - - $this->_storeProfile(); - } - } - - public function disable() - { - $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $applicationConfigResource = $this->_getApplicationConfigResource($profile); - $zc = $applicationConfigResource->getAsZendConfig(); - - if (isset($zc->resources) && !isset($zc->resources->layout)) { - $this->_registry->getResponse()->appendContent('No layout configuration exists in application config file.'); - - return; - } - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would remove "resources.layout.layoutPath" key from the application config file.'); - } else { - // Remove the resources.layout.layoutPath directive from application config - $applicationConfigResource->removeStringItem('resources.layout.layoutPath', $this->_layoutPath, 'production', false); - $applicationConfigResource->create(); - - // Tell the user about the good work we've done - $this->_registry->getResponse()->appendContent('Layout entry has been removed from the application config file.'); - - $this->_storeProfile(); - } - } - - protected function _getApplicationConfigResource(Zend_Tool_Project_Profile $profile) - { - $applicationConfigResource = $profile->search('ApplicationConfigFile'); - if (!$applicationConfigResource) { - throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); - } - - return $applicationConfigResource; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Manifest.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Manifest.php deleted file mode 100644 index 852338969..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Manifest.php +++ /dev/null @@ -1,72 +0,0 @@ -createResource( - 'modelFile', - ['modelName' => $modelName, 'moduleName' => $moduleName] - ); - - return $newModel; - } - - /** - * hasResource(). - * - * @param string $modelName - * @param string $moduleName - * - * @return bool - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $modelName, $moduleName = null) - { - if (!is_string($modelName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Model::createResource() expects \"modelName\" is the name of a model resource to check for existence.'); - } - - $modelsDirectory = self::_getModelsDirectoryResource($profile, $moduleName); - - if (!$modelsDirectory instanceof Zend_Tool_Project_Profile_Resource) { - return false; - } - - return ($modelsDirectory->search(['modelFile' => ['modelName' => $modelName]])) instanceof Zend_Tool_Project_Profile_Resource; - } - - /** - * _getModelsDirectoryResource(). - * - * @param string $moduleName - * - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getModelsDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null) - { - $profileSearchParams = []; - - if (null != $moduleName && is_string($moduleName)) { - $profileSearchParams = ['modulesDirectory', 'moduleDirectory' => ['moduleName' => $moduleName]]; - } - - $profileSearchParams[] = 'modelsDirectory'; - - return $profile->search($profileSearchParams); - } - - /** - * Create a new model. - * - * @param string $name - * @param string $module - */ - public function create($name, $module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $originalName = $name; - - $name = ucwords($name); - - // determine if testing is enabled in the project - $testingEnabled = false; // Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - $testModelResource = null; - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Model names should be camel cased.'); - } - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a model named '.$name); - } - - // get request/response object - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // alert the user about inline converted names - $tense = (($request->isPretend()) ? 'would be' : 'is'); - - if ($name !== $originalName) { - $response->appendContent( - 'Note: The canonical model name that '.$tense - .' used with other providers is "'.$name.'";' - .' not "'.$originalName.'" as supplied', - ['color' => ['yellow']] - ); - } - - try { - $modelResource = self::createResource($this->_loadedProfile, $name, $module); - - if ($testingEnabled) { - // $testModelResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module); - } - } catch (Throwable $e) { - $response->setException($e); - - return; - } - - // do the creation - if ($request->isPretend()) { - $response->appendContent('Would create a model at '.$modelResource->getContext()->getPath()); - - if ($testModelResource) { - $response->appendContent('Would create a model test file at '.$testModelResource->getContext()->getPath()); - } - } else { - $response->appendContent('Creating a model at '.$modelResource->getContext()->getPath()); - $modelResource->create(); - - if ($testModelResource) { - $response->appendContent('Creating a model test file at '.$testModelResource->getContext()->getPath()); - $testModelResource->create(); - } - - $this->_storeProfile(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php deleted file mode 100644 index 9d031b32b..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Module.php +++ /dev/null @@ -1,172 +0,0 @@ -search('applicationDirectory'); - $targetModuleEnabledResources = [ - 'ControllersDirectory', 'ModelsDirectory', 'ViewsDirectory', - 'ViewScriptsDirectory', 'ViewHelpersDirectory', 'ViewFiltersDirectory', - ]; - } - - // find the actual modules directory we will use to house our module - $modulesDirectory = $profile->search('modulesDirectory'); - - // if there is a module directory already, except - if ($modulesDirectory->search(['moduleDirectory' => ['moduleName' => $moduleName]])) { - throw new Zend_Tool_Project_Provider_Exception('A module named "'.$moduleName.'" already exists.'); - } - - // create the module directory - $moduleDirectory = $modulesDirectory->createResource('moduleDirectory', ['moduleName' => $moduleName]); - - // create a context filter so that we can pull out only what we need from the module skeleton - $moduleContextFilterIterator = new Zend_Tool_Project_Profile_Iterator_ContextFilter( - $targetModuleResource, - [ - 'denyNames' => ['ModulesDirectory', 'ViewControllerScriptsDirectory'], - 'denyType' => 'Zend_Tool_Project_Context_Filesystem_File', - ] - ); - - // the iterator for the module skeleton - $targetIterator = new RecursiveIteratorIterator($moduleContextFilterIterator, RecursiveIteratorIterator::SELF_FIRST); - - // initialize some loop state information - $currentDepth = 0; - $parentResources = []; - $currentResource = $moduleDirectory; - - // loop through the target module skeleton - foreach ($targetIterator as $targetSubResource) { - $depthDifference = $targetIterator->getDepth() - $currentDepth; - $currentDepth = $targetIterator->getDepth(); - - if (1 === $depthDifference) { - // if we went down into a child, make note - array_push($parentResources, $currentResource); - // this will have always been set previously by another loop - $currentResource = $currentChildResource; - } elseif ($depthDifference < 0) { - // if we went up to a parent, make note - $i = $depthDifference; - do { - // if we went out more than 1 parent, get to the correct parent - $currentResource = array_pop($parentResources); - } while ($i-- > 0); - } - - // get parameters for the newly created module resource - $params = $targetSubResource->getAttributes(); - $currentChildResource = $currentResource->createResource($targetSubResource->getName(), $params); - - // based of the provided list (Currently up top), enable specific resources - if (isset($targetModuleEnabledResources)) { - $currentChildResource->setEnabled(in_array($targetSubResource->getName(), $targetModuleEnabledResources)); - } else { - $currentChildResource->setEnabled($targetSubResource->isEnabled()); - } - } - - return $moduleDirectory; - } - - /** - * create(). - * - * @param string $name - */ - public function create($name) // , $moduleProfile = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // determine if testing is enabled in the project - // require_once 'Zend/Tool/Project/Provider/Test.php'; - // $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - $resources = self::createResources($this->_loadedProfile, $name); - - $response = $this->_registry->getResponse(); - - if ($this->_registry->getRequest()->isPretend()) { - $response->appendContent('I would create the following module and artifacts:'); - foreach (new RecursiveIteratorIterator($resources, RecursiveIteratorIterator::SELF_FIRST) as $resource) { - if (is_callable([$resource->getContext(), 'getPath'])) { - $response->appendContent($resource->getContext()->getPath()); - } - } - } else { - $response->appendContent('Creating the following module and artifacts:'); - $enabledFilter = new Zend_Tool_Project_Profile_Iterator_EnabledResourceFilter($resources); - foreach (new RecursiveIteratorIterator($enabledFilter, RecursiveIteratorIterator::SELF_FIRST) as $resource) { - $response->appendContent($resource->getContext()->getPath()); - $resource->create(); - } - - $response->appendContent('Added a key for path module directory to the application.ini file'); - $appConfigFile = $this->_loadedProfile->search('ApplicationConfigFile'); - $appConfigFile->removeStringItem('resources.frontController.moduleDirectory', 'production'); - $appConfigFile->addStringItem('resources.frontController.moduleDirectory', 'APPLICATION_PATH "/modules"', 'production', false); - - if ('default' == strtolower((string) $name)) { - $response->appendContent('Added a key for the default module to the application.ini file'); - $appConfigFile->addStringItem('resources.frontController.params.prefixDefaultModule', '1', 'production'); - } - - $appConfigFile->create(); - - // store changes to the profile - $this->_storeProfile(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Profile.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Profile.php deleted file mode 100644 index 140af6315..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Profile.php +++ /dev/null @@ -1,51 +0,0 @@ -_loadProfile(); - - $profileIterator = $this->_loadedProfile->getIterator(); - - foreach ($profileIterator as $profileItem) { - $this->_registry->getResponse()->appendContent( - str_repeat(' ', $profileIterator->getDepth()).$profileItem - ); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Project.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Project.php deleted file mode 100644 index c7343030e..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Project.php +++ /dev/null @@ -1,253 +0,0 @@ -_loadProfile(self::NO_PROFILE_RETURN_FALSE, $path); - - if (false !== $profile) { - // require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('A project already exists here'); - } - - $profileData = null; - - if (null != $fileOfProfile && file_exists((string) $fileOfProfile)) { - $profileData = file_get_contents($fileOfProfile); - } - - $storage = $this->_registry->getStorage(); - if ('' == $profileData && null != $nameOfProfile && $storage->isEnabled()) { - $profileData = $storage->get('project/profiles/'.$nameOfProfile.'.xml'); - } - - if ('' == $profileData) { - $profileData = $this->_getDefaultProfile(); - } - - $newProfile = new Zend_Tool_Project_Profile([ - 'projectDirectory' => $path, - 'profileData' => $profileData, - ]); - - $newProfile->loadFromData(); - - $response = $this->_registry->getResponse(); - - $response->appendContent('Creating project at '.$path); - $response->appendContent('Note: ', ['separator' => false, 'color' => 'yellow']); - $response->appendContent( - 'This command created a web project, ' - .'for more information setting up your VHOST, please see docs/README'); - - if (!Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $response->appendContent('Testing Note: ', ['separator' => false, 'color' => 'yellow']); - $response->appendContent('PHPUnit was not found in your include_path, therefore no testing actions will be created.'); - } - - foreach ($newProfile->getIterator() as $resource) { - $resource->create(); - } - } - - public function show() - { - $this->_registry->getResponse()->appendContent('You probably meant to run "show project.info".', ['color' => 'yellow']); - } - - public function showInfo() - { - $profile = $this->_loadProfile(self::NO_PROFILE_RETURN_FALSE); - if (!$profile) { - $this->_registry->getResponse()->appendContent('No project found.'); - } else { - $this->_registry->getResponse()->appendContent('Working with project located at: '.$profile->getAttribute('projectDirectory')); - } - } - - protected function _getDefaultProfile() - { - $testAction = ''; - if (Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $testAction = ' '; - } - - $version = Zend_Version::VERSION; - - $data = << - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -$testAction - - - - - - - -EOS; - - return $data; - } - - public static function getDefaultReadmeContents($caller = null) - { - $projectDirResource = $caller->getResource()->getProfile()->search('projectDirectory'); - if ($projectDirResource) { - $name = ltrim((string) strrchr($projectDirResource->getPath(), DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR); - $path = $projectDirResource->getPath().'/public'; - } else { - $path = '/path/to/public'; - } - - return <<< EOS -README -====== - -This directory should be used to place project specfic documentation including -but not limited to project notes, generated API/phpdoc documentation, or -manual files generated or hand written. Ideally, this directory would remain -in your development environment only and should not be deployed with your -application to it's final production location. - - -Setting Up Your VHOST -===================== - -The following is a sample VHOST you might want to consider for your project. - - - DocumentRoot "$path" - ServerName $name.local - - # This should be omitted in the production environment - SetEnv APPLICATION_ENV development - - - Options Indexes MultiViews FollowSymLinks - AllowOverride All - Order allow,deny - Allow from all - - - - -EOS; - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/ProjectProvider.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/ProjectProvider.php deleted file mode 100644 index 068c7d7fe..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/ProjectProvider.php +++ /dev/null @@ -1,96 +0,0 @@ -createResourceAt($profileSearchParams, 'projectProviderFile', ['projectProviderName' => $projectProviderName, 'actionNames' => $actionNames]); - - return $projectProvider; - } - - /** - * getName(). - * - * @return string - */ - public function getName() - { - return 'ProjectProvider'; - } - - /** - * Create stub for Zend_Tool Project Provider. - * - * @var string class name for new Zend_Tool Project Provider - * @var array|string list of provider methods - * - * @throws Zend_Tool_Project_Provider_Exception - */ - public function create($name, $actions = null) - { - $profile = $this->_loadProfileRequired(); - - $projectProvider = self::createResource($profile, $name, $actions); - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would create a project provider named '.$name - .' in location '.$projectProvider->getPath() - ); - } else { - $this->_registry->getResponse()->appendContent('Creating a project provider named '.$name - .' in location '.$projectProvider->getPath() - ); - $projectProvider->create(); - $this->_storeProfile(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/Test.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/Test.php deleted file mode 100644 index e360491f9..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/Test.php +++ /dev/null @@ -1,185 +0,0 @@ -search($profileSearchParams); - - return $testsDirectory->isEnabled(); - } - - public static function isPHPUnitAvailable() - { - if (class_exists('PHPUnit_Runner_Version', false)) { - return true; - } - - $included = @include 'PHPUnit/Runner/Version.php'; - - if (false === $included) { - return false; - } else { - return true; - } - } - - /** - * createApplicationResource(). - * - * @param string $controllerName - * @param string $actionName - * @param string $moduleName - * - * @return Zend_Tool_Project_Profile_Resource - */ - public static function createApplicationResource(Zend_Tool_Project_Profile $profile, $controllerName, $actionName, $moduleName = null) - { - if (!is_string($controllerName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createApplicationResource() expects \"controllerName\" is the name of a controller resource to create.'); - } - - if (!is_string($actionName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createApplicationResource() expects \"actionName\" is the name of a controller resource to create.'); - } - - $testsDirectoryResource = $profile->search('testsDirectory'); - - // parentOfController could either be application/ or a particular module folder, which is why we use this name - if (($testParentOfControllerDirectoryResource = $testsDirectoryResource->search('testApplicationDirectory')) === false) { - $testParentOfControllerDirectoryResource = $testsDirectoryResource->createResource('testApplicationDirectory'); - } - - if ($moduleName) { - if (($testAppModulesDirectoryResource = $testParentOfControllerDirectoryResource->search('testApplicationModulesDirectory')) === false) { - $testAppModulesDirectoryResource = $testParentOfControllerDirectoryResource->createResource('testApplicationModulesDirectory'); - } - - if (($testAppModuleDirectoryResource = $testAppModulesDirectoryResource->search(['testApplicationModuleDirectory' => ['forModuleName' => $moduleName]])) === false) { - $testAppModuleDirectoryResource = $testAppModulesDirectoryResource->createResource('testApplicationModuleDirectory', ['forModuleName' => $moduleName]); - } - - $testParentOfControllerDirectoryResource = $testAppModuleDirectoryResource; - } - - if (($testAppControllerDirectoryResource = $testParentOfControllerDirectoryResource->search('testApplicationControllerDirectory', 'testApplicationModuleDirectory')) === false) { - $testAppControllerDirectoryResource = $testParentOfControllerDirectoryResource->createResource('testApplicationControllerDirectory'); - } - - if (($testAppControllerFileResource = $testAppControllerDirectoryResource->search(['testApplicationControllerFile' => ['forControllerName' => $controllerName]])) === false) { - $testAppControllerFileResource = $testAppControllerDirectoryResource->createResource('testApplicationControllerFile', ['forControllerName' => $controllerName]); - } - - return $testAppControllerFileResource->createResource('testApplicationActionMethod', ['forActionName' => $actionName]); - } - - /** - * createLibraryResource(). - * - * @param string $libraryClassName - * - * @return Zend_Tool_Project_Profile_Resource - */ - public static function createLibraryResource(Zend_Tool_Project_Profile $profile, $libraryClassName) - { - $testLibraryDirectoryResource = $profile->search(['TestsDirectory', 'TestLibraryDirectory']); - - $fsParts = explode('_', $libraryClassName); - - $currentDirectoryResource = $testLibraryDirectoryResource; - - while ($nameOrNamespacePart = array_shift($fsParts)) { - if (count($fsParts) > 0) { - if (($libraryDirectoryResource = $currentDirectoryResource->search(['TestLibraryNamespaceDirectory' => ['namespaceName' => $nameOrNamespacePart]])) === false) { - $currentDirectoryResource = $currentDirectoryResource->createResource('TestLibraryNamespaceDirectory', ['namespaceName' => $nameOrNamespacePart]); - } else { - $currentDirectoryResource = $libraryDirectoryResource; - } - } else { - if (($libraryFileResource = $currentDirectoryResource->search(['TestLibraryFile' => ['forClassName' => $libraryClassName]])) === false) { - $libraryFileResource = $currentDirectoryResource->createResource('TestLibraryFile', ['forClassName' => $libraryClassName]); - } - } - } - - return $libraryFileResource; - } - - public function enable() - { - } - - public function disable() - { - } - - /** - * create(). - * - * @param string $libraryClassName - */ - public function create($libraryClassName) - { - $profile = $this->_loadProfile(); - - if (!self::isTestingEnabled($profile)) { - $this->_registry->getResponse()->appendContent('Testing is not enabled for this project.'); - } - - $testLibraryResource = self::createLibraryResource($profile, $libraryClassName); - - $response = $this->_registry->getResponse(); - - if ($this->_registry->getRequest()->isPretend()) { - $response->appendContent('Would create a library stub in location '.$testLibraryResource->getContext()->getPath()); - } else { - $response->appendContent('Creating a library stub in location '.$testLibraryResource->getContext()->getPath()); - $testLibraryResource->create(); - $this->_storeProfile(); - } - } -} diff --git a/packages/zend-tool/library/Zend/Tool/Project/Provider/View.php b/packages/zend-tool/library/Zend/Tool/Project/Provider/View.php deleted file mode 100644 index 8bef5011c..000000000 --- a/packages/zend-tool/library/Zend/Tool/Project/Provider/View.php +++ /dev/null @@ -1,115 +0,0 @@ - ['moduleName' => $moduleName]]; - $noModuleSearch = null; - } else { - $noModuleSearch = ['modulesDirectory']; - } - - $profileSearchParams[] = 'viewsDirectory'; - $profileSearchParams[] = 'viewScriptsDirectory'; - - if (($viewScriptsDirectory = $profile->search($profileSearchParams, $noModuleSearch)) === false) { - // require_once 'Zend/Tool/Project/Provider/Exception.php'; - throw new Zend_Tool_Project_Provider_Exception('This project does not have a viewScriptsDirectory resource.'); - } - - $profileSearchParams['viewControllerScriptsDirectory'] = ['forControllerName' => $controllerName]; - - // @todo check if below is failing b/c of above search params - if (($viewControllerScriptsDirectory = $viewScriptsDirectory->search($profileSearchParams)) === false) { - $viewControllerScriptsDirectory = $viewScriptsDirectory->createResource('viewControllerScriptsDirectory', ['forControllerName' => $controllerName]); - } - - $newViewScriptFile = $viewControllerScriptsDirectory->createResource('ViewScriptFile', ['forActionName' => $actionName]); - - return $newViewScriptFile; - } - - /** - * create(). - * - * @param string $controllerName - * @param string $actionNameOrSimpleName - */ - public function create($controllerName, $actionNameOrSimpleName, $module = null) - { - if ('' == $controllerName || '' == $actionNameOrSimpleName) { - // require_once 'Zend/Tool/Project/Provider/Exception.php'; - throw new Zend_Tool_Project_Provider_Exception('ControllerName and/or ActionName are empty.'); - } - - $profile = $this->_loadProfile(); - - $view = self::createResource($profile, $actionNameOrSimpleName, $controllerName, $module); - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse( - 'Would create a view script in location '.$view->getContext()->getPath() - ); - } else { - $this->_registry->getResponse( - 'Creating a view script in location '.$view->getContext()->getPath() - ); - $view->create(); - $this->_storeProfile(); - } - } -} diff --git a/tests/TestConfiguration.dist.php b/tests/TestConfiguration.dist.php index 31b4a43eb..fdc3bf127 100644 --- a/tests/TestConfiguration.dist.php +++ b/tests/TestConfiguration.dist.php @@ -200,94 +200,6 @@ */ defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || define('TESTS_ZEND_FEED_READER_ONLINE_ENABLED', false); -/** - * Zend_Gdata tests - * - * If the ONLINE_ENABLED property is false, only tests that can be executed with - * a mock HTTP client are run. No request is sent to the Google Gdata servers. - * If ONLINE_ENABLED is true, some tests may make requests to the remote - * servers. This does not work if you are running tests on a disconnected - * client host. Also, the tests may show as failures if the Google servers - * cannot be reached or if they do not respond for another reason. - * - * If the CLIENTLOGIN_ENABLED property below is false, the authenticated - * tests are reported Skipped in the test run. Set this property to true - * to enable tests that require ClientLogin authentication. Enter your - * Google login credentials in the EMAIL and PASSWORD properties below. - * - * Edit TestConfiguration.php, not TestConfiguration.dist.php. - * Never commit plaintext passwords to the source code repository. - * - * Note: the GData tests currently require that the TZID env variable - * be set or the timezone otherwise configured. You'll see errors from the - * tests if this is not the case. - */ -defined('TESTS_ZEND_GDATA_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED', false); - -/* - * The credentials provided here should be only for a TEST account. - * Data for various services in this account may be added to, updated, - * or deleted based upon the actions of these test accounts. - */ -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL', 'example@example.com'); -defined('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD') || define('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD', 'password'); - -/* - * This is the ID of a blank blog. There is no need to have - * any content in this blog. Also, blogs can only be used - * several times for the purpose of these test cases before - * they must be deleted and recreated. Otherwise, the tests - * will start failing, as posts to Blogger will return a 201 Created - * response even though the entry was not posted to the blog. - * This problem is being investigated. - */ -defined('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_BLOG_ID') || define('TESTS_ZEND_GDATA_BLOG_ID', '1111111111111111111'); - -/* - * This is the key for a spreadsheet with data only in the first row of - * the spreadsheet. The strings 'a1', 'b1', 'c1', 'd1' should be in the - * corresponding cell locations. - */ -defined('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY') || define('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY', 'o01111111111111111111.1111111111111111111'); -defined('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID') || define('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID', 'default'); - -/* - * This indicates that online tests for the Google Calendar API should - * be performed. The default calendar will be used. - */ -defined('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED', false); - -/* - * This is the fully-qualified domain name for a domiain hosted using - * Google Apps. This domain must be registered with Google Apps and - * have API access enabled. This should be a TEST domain only. - */ -defined('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED', false); -defined('TESTS_ZEND_GDATA_GAPPS_DOMAIN') || define('TESTS_ZEND_GDATA_GAPPS_DOMAIN', 'example.com.invalid'); -defined('TESTS_ZEND_GDATA_GAPPS_EMAIL') || define('TESTS_ZEND_GDATA_GAPPS_EMAIL', 'example@example.com'); -defined('TESTS_ZEND_GDATA_GAPPS_PASSWORD') || define('TESTS_ZEND_GDATA_GAPPS_PASSWORD', 'password'); - -/* - * This indicates that online tests for the Books Search data API - * should be performed. - */ -defined('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the Google Documents API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED', false); - -/* - * This indicates that online tests for the GData Photos API should - * be performed. - */ -defined('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED') || define('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED', false); - /** * Zend_Http_Client tests * diff --git a/tests/Zend/AllTests.php b/tests/Zend/AllTests.php index ae396d348..ffd74dcdb 100644 --- a/tests/Zend/AllTests.php +++ b/tests/Zend/AllTests.php @@ -53,7 +53,6 @@ require_once 'Zend/FilterTest.php'; require_once 'Zend/Filter/AllTests.php'; require_once 'Zend/Form/AllTests.php'; -require_once 'Zend/Gdata/AllTests.php'; require_once 'Zend/Http/AllTests.php'; require_once 'Zend/JsonTest.php'; require_once 'Zend/Json/AllTests.php'; @@ -95,7 +94,6 @@ require_once 'Zend/TimeSyncTest.php'; require_once 'Zend/TranslateTest.php'; require_once 'Zend/Translate/Adapter/AllTests.php'; -require_once 'Zend/Tool/AllTests.php'; require_once 'Zend/UriTest.php'; require_once 'Zend/Uri/AllTests.php'; require_once 'Zend/ValidateTest.php'; @@ -198,7 +196,6 @@ public static function suite() $suite->addTestSuite('Zend_FilterTest'); $suite->addTest(Zend_Filter_AllTests::suite()); $suite->addTest(Zend_Form_AllTests::suite()); - $suite->addTest(Zend_Gdata_AllTests::suite()); $suite->addTest(Zend_Http_AllTests::suite()); $suite->addTestSuite('Zend_JsonTest'); $suite->addTest(Zend_Json_AllTests::suite()); @@ -232,7 +229,6 @@ public static function suite() $suite->addTest(Zend_Tag_AllTests::suite()); $suite->addTest(Zend_Test_AllTests::suite()); $suite->addTest(Zend_Text_AllTests::suite()); - $suite->addTest(Zend_Tool_AllTests::suite()); $suite->addTestSuite('Zend_TimeSyncTest'); $suite->addTestSuite('Zend_TranslateTest'); $suite->addTest(Zend_Translate_Adapter_AllTests::suite()); diff --git a/tests/Zend/Gdata/AllTests.php b/tests/Zend/Gdata/AllTests.php deleted file mode 100644 index 2f4c78dca..000000000 --- a/tests/Zend/Gdata/AllTests.php +++ /dev/null @@ -1,387 +0,0 @@ -addTestSuite('Zend_Gdata_AuthSubTest'); - - /** - * Tests that do not require online access to servers - */ - $suite->addTestSuite('Zend_Gdata_AppTest'); - $suite->addTestSuite('Zend_Gdata_App_UtilTest'); - $suite->addTestSuite('Zend_Gdata_App_BaseTest'); - $suite->addTestSuite('Zend_Gdata_App_AuthorTest'); - $suite->addTestSuite('Zend_Gdata_App_CategoryTest'); - $suite->addTestSuite('Zend_Gdata_App_ContentTest'); - $suite->addTestSuite('Zend_Gdata_App_ControlTest'); - $suite->addTestSuite('Zend_Gdata_App_EntryTest'); - $suite->addTestSuite('Zend_Gdata_App_FeedTest'); - $suite->addTestSuite('Zend_Gdata_App_GeneratorTest'); - $suite->addTestSuite('Zend_Gdata_App_CaptchaRequiredExceptionTest'); - $suite->addTestSuite('Zend_Gdata_GdataTest'); - $suite->addTestSuite('Zend_Gdata_QueryTest'); - - $suite->addTestSuite('Zend_Gdata_AttendeeStatusTest'); - $suite->addTestSuite('Zend_Gdata_AttendeeTypeTest'); - $suite->addTestSuite('Zend_Gdata_CommentsTest'); - $suite->addTestSuite('Zend_Gdata_EntryTest'); - $suite->addTestSuite('Zend_Gdata_FeedTest'); - $suite->addTestSuite('Zend_Gdata_EntryLinkTest'); - $suite->addTestSuite('Zend_Gdata_EventStatusTest'); - $suite->addTestSuite('Zend_Gdata_ExtendedPropertyTest'); - $suite->addTestSuite('Zend_Gdata_FeedLinkTest'); - $suite->addTestSuite('Zend_Gdata_OpenSearchItemsPerPageTest'); - $suite->addTestSuite('Zend_Gdata_OpenSearchStartIndexTest'); - $suite->addTestSuite('Zend_Gdata_OpenSearchTotalResultsTest'); - $suite->addTestSuite('Zend_Gdata_OriginalEventTest'); - $suite->addTestSuite('Zend_Gdata_RecurrenceTest'); - $suite->addTestSuite('Zend_Gdata_RecurrenceExceptionTest'); - $suite->addTestSuite('Zend_Gdata_ReminderTest'); - $suite->addTestSuite('Zend_Gdata_TransparencyTest'); - $suite->addTestSuite('Zend_Gdata_VisibilityTest'); - $suite->addTestSuite('Zend_Gdata_WhenTest'); - $suite->addTestSuite('Zend_Gdata_WhereTest'); - $suite->addTestSuite('Zend_Gdata_WhoTest'); - - $suite->addTestSuite('Zend_Gdata_CalendarTest'); - $suite->addTestSuite('Zend_Gdata_CalendarFeedTest'); - $suite->addTestSuite('Zend_Gdata_CalendarEventTest'); - $suite->addTestSuite('Zend_Gdata_CalendarFeedCompositeTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_EventQueryTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_EventQueryExceptionTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_EventEntryTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_AccessLevelTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_ColorTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_HiddenTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_LinkTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_SelectedTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_SendEventNotificationsTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_TimezoneTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_WebContentTest'); - $suite->addTestSuite('Zend_Gdata_Calendar_QuickAddTest'); - - $suite->addTestSuite('Zend_Gdata_Spreadsheets_ColCountTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_RowCountTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_CellTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_CustomTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_WorksheetEntryTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_CellEntryTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_ListEntryTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_SpreadsheetFeedTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_WorksheetFeedTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_CellFeedTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_ListFeedTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_DocumentQueryTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_CellQueryTest'); - $suite->addTestSuite('Zend_Gdata_Spreadsheets_ListQueryTest'); - - $suite->addTestSuite('Zend_Gdata_Docs_DocumentListFeedTest'); - $suite->addTestSuite('Zend_Gdata_Docs_DocumentListEntryTest'); - $suite->addTestSuite('Zend_Gdata_Docs_QueryTest'); - - $suite->addTestSuite('Zend_Gdata_Photos_PhotosAlbumEntryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosAlbumFeedTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosAlbumQueryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosCommentEntryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosPhotoEntryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosPhotoFeedTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosPhotoQueryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosTagEntryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosUserEntryTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosUserFeedTest'); - $suite->addTestSuite('Zend_Gdata_Photos_PhotosUserQueryTest'); - - $suite->addTestSuite('Zend_Gdata_GappsTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListQueryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListRecipientEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListRecipientFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListRecipientQueryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_EmailListTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_ErrorTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_GroupEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_GroupFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_GroupQueryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_LoginTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_MemberEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_MemberFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_MemberQueryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_NameTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_NicknameEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_NicknameFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_NicknameQueryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_NicknameTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_OwnerEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_OwnerFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_OwnerQueryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_PropertyTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_QuotaTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_ServiceExceptionTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_UserEntryTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_UserFeedTest'); - $suite->addTestSuite('Zend_Gdata_Gapps_UserQueryTest'); - - $suite->addTestSuite('Zend_Gdata_Books_CollectionEntryTest'); - $suite->addTestSuite('Zend_Gdata_Books_CollectionFeedTest'); - $suite->addTestSuite('Zend_Gdata_Books_VolumeEntryTest'); - $suite->addTestSuite('Zend_Gdata_Books_VolumeFeedTest'); - - $skippingOnlineTests = true; - if (defined('TESTS_ZEND_GDATA_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_ONLINE_ENABLED') == true && - defined('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED') && - constant('TESTS_ZEND_GDATA_CLIENTLOGIN_ENABLED') == true) { - /** - * Tests that do require online access to servers - * and authentication credentials - */ - $skippingOnlineTests = false; - if (defined('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_BLOGGER_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_GdataOnlineTest'); - } - - if (defined('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_CALENDAR_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_CalendarOnlineTest'); - } - - if (defined('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_SPREADSHEETS_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_SpreadsheetsOnlineTest'); - } - - if (defined('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_DOCS_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_DocsOnlineTest'); - } - - if (defined('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_PHOTOS_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_PhotosOnlineTest'); - } - - if (defined('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_BOOKS_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_BooksOnlineTest'); - } - } - if (defined('TESTS_ZEND_GDATA_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_ONLINE_ENABLED') == true) { - /** - * Tests that do require online access to servers, but - * don't require the standard authentication credentials - */ - $skippingOnlineTests = false; - if (defined('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED') && - constant('TESTS_ZEND_GDATA_GAPPS_ONLINE_ENABLED') == true) { - $suite->addTestSuite('Zend_Gdata_GappsOnlineTest'); - } - } - if ($skippingOnlineTests) { - $suite->addTestSuite('Zend_Gdata_SkipOnlineTest'); - } - return $suite; - } - -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Gdata_AllTests::main') { - Zend_Gdata_AllTests::main(); -} diff --git a/tests/Zend/Gdata/Analytics/AccountFeedTest.php b/tests/Zend/Gdata/Analytics/AccountFeedTest.php deleted file mode 100644 index 5bdcf2f7f..000000000 --- a/tests/Zend/Gdata/Analytics/AccountFeedTest.php +++ /dev/null @@ -1,72 +0,0 @@ -accountFeed = new Zend_Gdata_Analytics_AccountFeed( - file_get_contents(__DIR__ . '/_files/TestAccountFeed.xml') - ); - } - - public function testAccountFeed() - { - $this->assertEquals(2, count($this->accountFeed->entries)); - - foreach ($this->accountFeed->entries as $entry) { - $this->assertInstanceOf('Zend_Gdata_Analytics_AccountEntry', $entry); - } - } - - public function testFirstAccountProperties() - { - $account = $this->accountFeed->entries[0]; - $this->assertEquals(876543, "{$account->accountId}"); - $this->assertEquals('foobarbaz', "{$account->accountName}"); - $this->assertInstanceOf('Zend_GData_App_Extension_Link', $account->link[0]); - } - - public function testSecondAccountProperties() - { - $account = $this->accountFeed->entries[1]; - $this->assertEquals(23456789, "{$account->accountId}"); - $this->assertEquals('brain dump', "{$account->accountName}"); - $this->assertInstanceOf('Zend_GData_App_Extension_Link', $account->link[0]); - } -} diff --git a/tests/Zend/Gdata/Analytics/AccountQueryTest.php b/tests/Zend/Gdata/Analytics/AccountQueryTest.php deleted file mode 100644 index 46caec0ea..000000000 --- a/tests/Zend/Gdata/Analytics/AccountQueryTest.php +++ /dev/null @@ -1,127 +0,0 @@ -accountQuery = new Zend_GData_Analytics_AccountQuery(); - $this->queryBase = Zend_GData_Analytics_AccountQuery::ANALYTICS_FEED_URI; - } - - public function testWebpropertiesAll() - { - $this->accountQuery->webproperties(); - $allQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/~all/webproperties', - $allQuery - ); - } - - public function testWebpropertiesSpecific() - { - $this->accountQuery->webproperties(12345678); - $specificQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/12345678/webproperties', - $specificQuery - ); - } - - public function testProfilesAll() - { - $this->accountQuery->profiles(); - $allQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/~all/webproperties/~all/profiles', - $allQuery - ); - } - - public function testProfilesSpecific() - { - $this->accountQuery->profiles('U-87654321-0', 87654321); - $specificQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/87654321/webproperties/U-87654321-0/profiles', - $specificQuery - ); - } - - public function testGoalsAll() - { - $this->accountQuery->goals(); - $allQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/~all/webproperties/~all/profiles/~all/goals', - $allQuery - ); - } - - public function testGoalsSpecific() - { - $this->accountQuery->goals(42, 'U-87654321-0', 87654321); - $specificQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/87654321/webproperties/U-87654321-0/profiles/42/goals', - $specificQuery - ); - } - - public function testChainedProperties() - { - $this->accountQuery - ->goals(42) - ->profiles('U-87654321-0') - ->webproperties(87654321); - $specificQuery = $this->accountQuery->getQueryUrl(); - - $this->assertEquals( - $this->queryBase . '/87654321/webproperties/U-87654321-0/profiles/42/goals', - $specificQuery - ); - } -} diff --git a/tests/Zend/Gdata/Analytics/DataFeedTest.php b/tests/Zend/Gdata/Analytics/DataFeedTest.php deleted file mode 100644 index bae589e44..000000000 --- a/tests/Zend/Gdata/Analytics/DataFeedTest.php +++ /dev/null @@ -1,81 +0,0 @@ - 12, - 'foobar.de' => 3, - 'foobarbaz.ch' => 1, - 'baz.ch' => 1, - ); - /** @var DataFeed */ - public $dataFeed; - - public function setUp() - { - $this->dataFeed = new Zend_Gdata_Analytics_DataFeed( - file_get_contents(__DIR__ . '/_files/TestDataFeed.xml') - ); - } - - public function testDataFeed() - { - $count = count($this->testData); - $this->assertEquals(count($this->dataFeed->entries), $count); - $this->assertEquals($this->dataFeed->entries->count(), $count); - foreach ($this->dataFeed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Analytics_DataEntry); - } - } - - public function testGetters() - { - $sources = array_keys($this->testData); - $values = array_values($this->testData); - - foreach ($this->dataFeed as $index => $row) { - $source = $row->getDimension(Zend_Gdata_Analytics_DataQuery::DIMENSION_SOURCE); - $medium = $row->getDimension('ga:medium'); - $visits = $row->getMetric('ga:visits'); - $visitsValue = $row->getValue('ga:visits'); - - $this->assertEquals("$medium", 'referral'); - $this->assertEquals("$source", $sources[$index]); - $this->assertEquals("$visits", $values[$index]); - $this->assertEquals("$visitsValue", $values[$index]); - } - } -} diff --git a/tests/Zend/Gdata/Analytics/DataQueryTest.php b/tests/Zend/Gdata/Analytics/DataQueryTest.php deleted file mode 100644 index 8cf91a25b..000000000 --- a/tests/Zend/Gdata/Analytics/DataQueryTest.php +++ /dev/null @@ -1,102 +0,0 @@ -dataQuery = new Zend_GData_Analytics_DataQuery(); - } - - public function testProfileId() - { - $this->assertTrue($this->dataQuery->getProfileId() == null); - $this->dataQuery->setProfileId(123456); - $this->assertTrue($this->dataQuery->getProfileId() == 123456); - } - - public function testAddMetric() - { - $this->assertTrue(count($this->dataQuery->getMetrics()) == 0); - $this->dataQuery->addMetric(Zend_GData_Analytics_DataQuery::METRIC_BOUNCES); - $this->assertTrue(count($this->dataQuery->getMetrics()) == 1); - } - - public function testAddAndRemoveMetric() - { - $this->dataQuery->addMetric(Zend_GData_Analytics_DataQuery::METRIC_BOUNCES); - $this->dataQuery->removeMetric(Zend_GData_Analytics_DataQuery::METRIC_BOUNCES); - $this->assertTrue(count($this->dataQuery->getMetrics()) == 0); - } - - public function testAddDimension() - { - $this->assertTrue(count($this->dataQuery->getDimensions()) == 0); - $this->dataQuery->addDimension(Zend_GData_Analytics_DataQuery::DIMENSION_AD_SLOT); - $this->assertTrue(count($this->dataQuery->getDimensions()) == 1); - } - - public function testAddAndRemoveDimension() - { - $this->dataQuery->addDimension(Zend_GData_Analytics_DataQuery::DIMENSION_AD_SLOT); - $this->dataQuery->removeDimension(Zend_GData_Analytics_DataQuery::DIMENSION_AD_SLOT); - $this->assertTrue(count($this->dataQuery->getDimensions()) == 0); - } - - public function testQueryString() - { - $this->dataQuery - ->setProfileId(123456789) - ->addFilter('foo=bar') - ->addFilter('bar>2') - ->addOrFilter('baz=42') - ->addDimension(Zend_GData_Analytics_DataQuery::DIMENSION_CITY) - ->addMetric(Zend_GData_Analytics_DataQuery::METRIC_PAGEVIEWS) - ->addMetric(Zend_GData_Analytics_DataQuery::METRIC_VISITS); - $url = parse_url($this->dataQuery->getQueryUrl()); - parse_str($url['query'], $parameter); - - $this->assertEquals(count($parameter), 4); - $this->assertEquals($parameter['ids'], "ga:123456789"); - $this->assertEquals($parameter['dimensions'], "ga:city"); - $this->assertEquals($parameter['metrics'], "ga:pageviews,ga:visits"); - $this->assertEquals($parameter['filters'], 'foo=bar;bar>2,baz=42'); - } -} diff --git a/tests/Zend/Gdata/Analytics/_files/TestAccountFeed.xml b/tests/Zend/Gdata/Analytics/_files/TestAccountFeed.xml deleted file mode 100644 index 9d2b83a2a..000000000 --- a/tests/Zend/Gdata/Analytics/_files/TestAccountFeed.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - https://www.googleapis.com/analytics/v2.4/management/accounts - 2012-07-13T16:53:15.150Z - Google Analytics Accounts for mail@storkki.de - - - Google Analytics - - Google Analytics - 2 - 1 - 1000 - - https://www.googleapis.com/analytics/v2.4/management/accounts/876543 - 2010-03-02T16:04:23.720Z - Google Analytics Account foobarbaz - - - - - - - https://www.googleapis.com/analytics/v2.4/management/accounts/23456789 - 2011-05-17T06:53:24.385Z - Google Analytics Account brain dump - - - - - - \ No newline at end of file diff --git a/tests/Zend/Gdata/Analytics/_files/TestDataFeed.xml b/tests/Zend/Gdata/Analytics/_files/TestDataFeed.xml deleted file mode 100644 index 3d9b6479b..000000000 --- a/tests/Zend/Gdata/Analytics/_files/TestDataFeed.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - https://www.googleapis.com/analytics/v2.4/data?ids=ga:45678912&dimensions=ga:medium,ga:source,ga:browserVersion,ga:month&metrics=ga:bounces,ga:visits&sort=-ga:visits,ga:bounces&filters=ga:browser%3D%3DFirefox&start-date=2011-05-01&end-date=2011-05-31&start-index=1&max-results=50 - 2012-07-13T17:05:16.454Z - Google Analytics Data for Profile 45678912 - - - Google Analytics - - Google Analytics - 4 - 1 - 50 - - - - - false - - - - - ga:45678912 - www.foobar.de - - 2011-05-31 - 2011-05-01 - - https://www.googleapis.com/analytics/v2.4/data?ids=ga:45678912&ga:browserVersion=4.0.1&ga:medium=referral&ga:month=05&ga:source=foobarbaz.de&filters=ga:browser%3D%3DFirefox&start-date=2011-05-01&end-date=2011-05-31 - 2012-07-13T17:05:16.454Z - ga:medium=referral | ga:source=foobarbaz.de | ga:browserVersion=4.0.1 | ga:month=05 - - - - - - - - - - https://www.googleapis.com/analytics/v2.4/data?ids=ga:45678912&ga:browserVersion=3.6.17&ga:medium=referral&ga:month=05&ga:source=foobarbaz.de&filters=ga:browser%3D%3DFirefox&start-date=2011-05-01&end-date=2011-05-31 - 2012-07-13T17:05:16.454Z - ga:medium=referral | ga:source=foobar.de | ga:browserVersion=3.6.17 | ga:month=05 - - - - - - - - - - https://www.googleapis.com/analytics/v2.4/data?ids=ga:45678912&ga:browserVersion=3.5.19&ga:medium=referral&ga:month=05&ga:source=foobarbaz.ch&filters=ga:browser%3D%3DFirefox&start-date=2011-05-01&end-date=2011-05-31 - 2012-07-13T17:05:16.454Z - ga:medium=referral | ga:source=foobarbaz.ch | ga:browserVersion=3.5.19 | ga:month=05 - - - - - - - - - - https://www.googleapis.com/analytics/v2.4/data?ids=ga:45678912&ga:browserVersion=3.6.17&ga:medium=referral&ga:month=05&ga:source=foobarbaz.ch&filters=ga:browser%3D%3DFirefox&start-date=2011-05-01&end-date=2011-05-31 - 2012-07-13T17:05:16.454Z - ga:medium=referral | ga:source=baz.ch | ga:browserVersion=3.6.17 | ga:month=05 - - - - - - - - - \ No newline at end of file diff --git a/tests/Zend/Gdata/App/AuthorTest.php b/tests/Zend/Gdata/App/AuthorTest.php deleted file mode 100644 index d594d87dc..000000000 --- a/tests/Zend/Gdata/App/AuthorTest.php +++ /dev/null @@ -1,119 +0,0 @@ -authorText = file_get_contents( - 'Zend/Gdata/App/_files/AuthorElementSample1.xml', - true); - $this->author = new Zend_Gdata_App_Extension_Author(); - } - - public function testEmptyAuthorShouldHaveEmptyExtensionsList() { - $this->assertTrue(is_array($this->author->extensionElements)); - $this->assertTrue(count($this->author->extensionElements) == 0); - } - - public function testNormalAuthorShouldHaveNoExtensionElements() { - $this->author->name = new Zend_Gdata_App_Extension_Name('Jeff Scudder'); - $this->assertEquals($this->author->name->text, 'Jeff Scudder'); - $this->assertEquals(count($this->author->extensionElements), 0); - $newAuthor = new Zend_Gdata_App_Extension_Author(); - $newAuthor->transferFromXML($this->author->saveXML()); - $this->assertEquals(count($newAuthor->extensionElements), 0); - $newAuthor->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newAuthor->extensionElements), 1); - $this->assertEquals($newAuthor->name->text, 'Jeff Scudder'); - - /* try constructing using magic factory */ - $app = new Zend_Gdata_App(); - $newAuthor2 = $app->newAuthor(); - $newAuthor2->transferFromXML($newAuthor->saveXML()); - $this->assertEquals(count($newAuthor2->extensionElements), 1); - $this->assertEquals($newAuthor2->name->text, 'Jeff Scudder'); - } - - public function testEmptyAuthorToAndFromStringShouldMatch() { - $authorXml = $this->author->saveXML(); - $newAuthor = new Zend_Gdata_App_Extension_Author(); - $newAuthor->transferFromXML($authorXml); - $newAuthorXml = $newAuthor->saveXML(); - $this->assertTrue($authorXml == $newAuthorXml); - } - - public function testAuthorWithNameEmailToAndFromStringShouldMatch() { - $this->author->name = new Zend_Gdata_App_Extension_Name('Jeff Scudder'); - $this->author->email = new Zend_Gdata_App_Extension_Email( - 'api.jscudder@gmail.com'); - $this->author->uri = new Zend_Gdata_App_Extension_Uri( - 'http://code.google.com/apis/gdata/'); - $authorXml = $this->author->saveXML(); - $newAuthor = new Zend_Gdata_App_Extension_Author(); - $newAuthor->transferFromXML($authorXml); - $newAuthorXml = $newAuthor->saveXML(); - $this->assertTrue($authorXml == $newAuthorXml); - $this->assertEquals('Jeff Scudder', $newAuthor->name->text); - $this->assertEquals('api.jscudder@gmail.com', $newAuthor->email->text); - $this->assertEquals('http://code.google.com/apis/gdata/', $newAuthor->uri->text); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->author->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->author->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->author->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->author->extensionAttributes['foo2']['value']); - $authorXml = $this->author->saveXML(); - $newAuthor = new Zend_Gdata_App_Extension_Author(); - $newAuthor->transferFromXML($authorXml); - //var_dump($this->author); - //print $authorXml; - $this->assertEquals('bar', $newAuthor->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newAuthor->extensionAttributes['foo2']['value']); - } - - public function testConvertFullAuthorToAndFromString() { - $this->author->transferFromXML($this->authorText); - $this->assertEquals($this->author->name->text, 'John Doe'); - $this->assertEquals($this->author->email->text, - 'johndoes@someemailadress.com'); - $this->assertEquals($this->author->uri->text, 'http://www.google.com'); - } - -} diff --git a/tests/Zend/Gdata/App/BaseTest.php b/tests/Zend/Gdata/App/BaseTest.php deleted file mode 100644 index a4c8060b3..000000000 --- a/tests/Zend/Gdata/App/BaseTest.php +++ /dev/null @@ -1,156 +0,0 @@ -fileName = 'Zend/Gdata/App/_files/FeedSample1.xml'; - $this->base = new Zend_Gdata_App_MockBase(); - } - - public function testUnknownNamespaceReturnsInput() { - $this->assertEquals('example', - $this->base->lookupNamespace('example')); - } - public function testAtomV1NamespaceReturnedByDefault() { - $this->assertEquals('http://www.w3.org/2005/Atom', - $this->base->lookupNamespace('atom')); - } - - public function testAtomPubV1NamespaceReturnedByDefault() { - $this->assertEquals('http://purl.org/atom/app#', - $this->base->lookupNamespace('app')); - } - - public function testAtomV1NamespaceReturnedWhenSpecifyingMajorVersion() { - $this->assertEquals('http://www.w3.org/2005/Atom', - $this->base->lookupNamespace('atom', - 1)); - } - - public function testAtomV1NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() { - $this->assertEquals('http://www.w3.org/2005/Atom', - $this->base->lookupNamespace('atom', - 1, 0)); - } - - public function testAtomPubV1NamespaceReturnedWhenSpecifyingMajorVersion() { - $this->assertEquals('http://purl.org/atom/app#', - $this->base->lookupNamespace('app', - 1)); - } - - public function testAtomPubV1NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() { - $this->assertEquals('http://purl.org/atom/app#', - $this->base->lookupNamespace('app', - 1, 0)); - } - - public function testAtomPubV2NamespaceReturnedWhenSpecifyingMajorVersion() { - $this->assertEquals('http://www.w3.org/2007/app', - $this->base->lookupNamespace('app', - 2)); - } - - public function testAtomPubV2NamespaceReturnedWhenSpecifyingMajorAndMinorVersion() { - $this->assertEquals('http://www.w3.org/2007/app', - $this->base->lookupNamespace('app', - 2, 0)); - } - - public function testNullReturnsLatestVersion() { - $this->assertEquals('http://www.w3.org/2007/app', - $this->base->lookupNamespace('app', - null, null)); - } - - public function testRegisterNamespaceWorksWithoutVersion() { - $ns = 'http://example.net/namespaces.foo'; - $prefix = 'foo'; - $this->base->registerNamespace($prefix, $ns); - $result = $this->base->lookupNamespace($prefix); - $this->assertEquals($ns, $result); - } - - public function testRegisterNamespaceAllowsSettingMajorVersion() { - $ns = 'http://example.net/namespaces.foo'; - $prefix = 'foo'; - $this->base->registerNamespace($prefix, 'wrong-1', 1); - $this->base->registerNamespace($prefix, $ns, 2); - $this->base->registerNamespace($prefix, 'wrong-3', 3); - $this->base->registerNamespace($prefix, 'wrong-4', 4); - $result = $this->base->lookupNamespace($prefix, 2); - $this->assertEquals($ns, $result); - } - - public function testRegisterNamespaceAllowsSettingMinorVersion() { - $ns = 'http://example.net/namespaces.foo'; - $prefix = 'foo'; - $this->base->registerNamespace($prefix, 'wrong-1', 1); - $this->base->registerNamespace($prefix, 'wrong-2-0', 2,0); - $this->base->registerNamespace($prefix, 'wrong-2-1', 2,1); - $this->base->registerNamespace($prefix, 'wrong-2-2', 2,2); - $this->base->registerNamespace($prefix, $ns, 2, 3); - $this->base->registerNamespace($prefix, 'wrong-2-4', 2,4); - $this->base->registerNamespace($prefix, 'wrong-3-0', 3-0); - $this->base->registerNamespace($prefix, 'wrong-3-1', 3-1); - $this->base->registerNamespace($prefix, 'wrong-4', 4); - $result = $this->base->lookupNamespace($prefix, 2, 3); - $this->assertEquals($ns, $result); - } - - public function testException() - { - try { - $this->base->transferFromXML('foo'); - } catch (\Throwable $e) { - self::assertInstanceOf('Zend_Gdata_App_Exception', $e); - self::assertContains('cannot parse', $e->getMessage()); - - return; - } - - self::fail('Test expects exception to be thrown and handled without reaching this part'); - } -} diff --git a/tests/Zend/Gdata/App/CaptchaRequiredExceptionTest.php b/tests/Zend/Gdata/App/CaptchaRequiredExceptionTest.php deleted file mode 100644 index 1e1809c8a..000000000 --- a/tests/Zend/Gdata/App/CaptchaRequiredExceptionTest.php +++ /dev/null @@ -1,59 +0,0 @@ -exampleException = new Zend_Gdata_App_CaptchaRequiredException('testtoken', 'Captcha?ctoken=testtoken'); - } - - public function testExceptionContainsValidInformation() { - $this->assertEquals('testtoken', $this->exampleException->getCaptchaToken()); - $this->assertEquals('https://www.google.com/accounts/Captcha?ctoken=testtoken', $this->exampleException->getCaptchaUrl()); - } - - public function testExceptionIsThrowable() { - $caught = false; - try { - throw $this->exampleException; - } - catch(Zend_Gdata_App_CaptchaRequiredException $e) { - $caught = true; - } - - $this->assertTrue($caught); - } - -} diff --git a/tests/Zend/Gdata/App/CategoryTest.php b/tests/Zend/Gdata/App/CategoryTest.php deleted file mode 100644 index 686efbd5f..000000000 --- a/tests/Zend/Gdata/App/CategoryTest.php +++ /dev/null @@ -1,115 +0,0 @@ -categoryText = file_get_contents( - 'Zend/Gdata/App/_files/CategoryElementSample1.xml', - true); - $this->category = new Zend_Gdata_App_Extension_Category(); - } - - public function testEmptyCategoryShouldHaveEmptyExtensionsList() { - $this->assertTrue(is_array($this->category->extensionElements)); - $this->assertTrue(count($this->category->extensionElements) == 0); - } - - public function testNormalCategoryShouldHaveNoExtensionElements() { - - $this->category->scheme = 'http://schemas.google.com/g/2005#kind'; - $this->assertEquals($this->category->scheme, 'http://schemas.google.com/g/2005#kind'); - $this->assertEquals(count($this->category->extensionElements), 0); - $newCategory = new Zend_Gdata_App_Extension_Category(); - $newCategory->transferFromXML($this->category->saveXML()); - $this->assertEquals(0, count($newCategory->extensionElements)); - $newCategory->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newCategory->extensionElements), 1); - $this->assertEquals($newCategory->scheme, 'http://schemas.google.com/g/2005#kind'); - - /* try constructing using magic factory */ - $app = new Zend_Gdata_App(); - $newCategory2 = $app->newCategory(); - $newCategory2->transferFromXML($newCategory->saveXML()); - $this->assertEquals(count($newCategory2->extensionElements), 1); - $this->assertEquals($newCategory2->scheme, 'http://schemas.google.com/g/2005#kind'); - } - - public function testEmptyCategoryToAndFromStringShouldMatch() { - $categoryXml = $this->category->saveXML(); - $newCategory = new Zend_Gdata_App_Extension_Category(); - $newCategory->transferFromXML($categoryXml); - $newCategoryXml = $newCategory->saveXML(); - $this->assertTrue($categoryXml == $newCategoryXml); - } - - public function testCategoryWithSchemeAndTermToAndFromStringShouldMatch() { - $this->category->scheme = 'http://schemas.google.com/g/2005#kind'; - $this->category->term = 'http://schemas.google.com/g/2005#event'; - $this->category->label = 'event kind'; - $categoryXml = $this->category->saveXML(); - $newCategory = new Zend_Gdata_App_Extension_Category(); - $newCategory->transferFromXML($categoryXml); - $newCategoryXml = $newCategory->saveXML(); - $this->assertTrue($categoryXml == $newCategoryXml); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $newCategory->scheme); - $this->assertEquals('http://schemas.google.com/g/2005#event', $newCategory->term); - $this->assertEquals('event kind', $newCategory->label); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->category->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->category->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->category->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->category->extensionAttributes['foo2']['value']); - $categoryXml = $this->category->saveXML(); - $newCategory = new Zend_Gdata_App_Extension_Category(); - $newCategory->transferFromXML($categoryXml); - $this->assertEquals('bar', $newCategory->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newCategory->extensionAttributes['foo2']['value']); - } - - public function testConvertFullCategoryToAndFromString() { - $this->category->transferFromXML($this->categoryText); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $this->category->scheme); - $this->assertEquals('http://schemas.google.com/g/2005#event', $this->category->term); - $this->assertEquals('event kind', $this->category->label); - } - -} diff --git a/tests/Zend/Gdata/App/ContentTest.php b/tests/Zend/Gdata/App/ContentTest.php deleted file mode 100644 index a80f12686..000000000 --- a/tests/Zend/Gdata/App/ContentTest.php +++ /dev/null @@ -1,98 +0,0 @@ -contentText = file_get_contents( - 'Zend/Gdata/App/_files/ContentElementSample1.xml', - true); - $this->contentText2 = file_get_contents( - 'Zend/Gdata/App/_files/ContentElementSample2.xml', - true); - $this->content = new Zend_Gdata_App_Extension_Content(); - } - - public function testEmptyContentShouldHaveEmptyExtensionsList() { - $this->assertTrue(is_array($this->content->extensionElements)); - $this->assertTrue(count($this->content->extensionElements) == 0); - } - - public function testEmptyContentToAndFromStringShouldMatch() { - $contentXml = $this->content->saveXML(); - $newContent = new Zend_Gdata_App_Extension_Content(); - $newContent->transferFromXML($contentXml); - $newContentXml = $newContent->saveXML(); - $this->assertTrue($contentXml == $newContentXml); - } - - public function testContentWithTextAndTypeToAndFromStringShouldMatch() { - $this->content->text = ''; - $this->content->type = 'xhtml'; - $contentXml = $this->content->saveXML(); - $newContent = new Zend_Gdata_App_Extension_Content(); - $newContent->transferFromXML($contentXml); - $newContentXml = $newContent->saveXML(); - $this->assertEquals($newContentXml, $contentXml); - $this->assertEquals('', $newContent->text); - $this->assertEquals('xhtml', $newContent->type); - } - - public function testContentWithSrcAndTypeToAndFromStringShouldMatch() { - $this->content->src = 'http://www.example.com/image.png'; - $this->content->type = 'image/png'; - $contentXml = $this->content->saveXML(); - $newContent = new Zend_Gdata_App_Extension_Content(); - $newContent->transferFromXML($contentXml); - $newContentXml = $newContent->saveXML(); - $this->assertEquals($newContentXml, $contentXml); - $this->assertEquals('http://www.example.com/image.png', $newContent->src); - $this->assertEquals('image/png', $newContent->type); - } - - public function testConvertContentWithSrcAndTypeToAndFromString() { - $this->content->transferFromXML($this->contentText); - $this->assertEquals('http://www.example.com/image.png', $this->content->src); - $this->assertEquals('image/png', $this->content->type); - } - - public function testConvertContentWithTextAndTypeToAndFromString() { - $this->content->transferFromXML($this->contentText2); - $this->assertEquals('xhtml', $this->content->type); - $this->assertEquals(1, count($this->content->extensionElements)); - } - -} diff --git a/tests/Zend/Gdata/App/ControlTest.php b/tests/Zend/Gdata/App/ControlTest.php deleted file mode 100644 index 4156ee607..000000000 --- a/tests/Zend/Gdata/App/ControlTest.php +++ /dev/null @@ -1,76 +0,0 @@ -controlText = file_get_contents( - 'Zend/Gdata/App/_files/ControlElementSample1.xml', - true); - $this->control = new Zend_Gdata_App_Extension_Control(); - } - - public function testEmptyControlShouldHaveEmptyExtensionsList() { - $this->assertTrue(is_array($this->control->extensionElements)); - $this->assertTrue(count($this->control->extensionElements) == 0); - } - - public function testEmptyControlToAndFromStringShouldMatch() { - $controlXml = $this->control->saveXML(); - $newControl = new Zend_Gdata_App_Extension_Control(); - $newControl->transferFromXML($controlXml); - $newControlXml = $newControl->saveXML(); - $this->assertTrue($controlXml == $newControlXml); - } - - public function testControlWithDraftToAndFromStringShouldMatch() { - $draft = new Zend_Gdata_App_Extension_Draft('yes'); - $this->control->draft = $draft; - $controlXml = $this->control->saveXML(); - $newControl = new Zend_Gdata_App_Extension_Control(); - $newControl->transferFromXML($controlXml); - $newControlXml = $newControl->saveXML(); - $this->assertEquals($newControlXml, $controlXml); - $this->assertEquals('yes', $newControl->draft->text); - } - - public function testConvertControlWithDraftToAndFromString() { - $this->control->transferFromXML($this->controlText); - $this->assertEquals('yes', $this->control->draft->text); - } - -} diff --git a/tests/Zend/Gdata/App/EntryTest.php b/tests/Zend/Gdata/App/EntryTest.php deleted file mode 100644 index 6d7bf9310..000000000 --- a/tests/Zend/Gdata/App/EntryTest.php +++ /dev/null @@ -1,626 +0,0 @@ -enryText = $this->loadResponse( - __DIR__ . '/../App/_files/EntrySample1.xml' - ); - $this->httpEntrySample = $this->loadResponse( - __DIR__ . '/../App/_files/EntrySampleHttp1.txt' - ); - $this->enry = new Zend_Gdata_App_Entry(); - - $this->adapter = new Test_Zend_Gdata_MockHttpClient(); - $this->client = new Zend_Gdata_HttpClient(); - $this->client->setAdapter($this->adapter); - $this->service = new Zend_Gdata_App($this->client); - } - - public function loadResponse($filename) - { - $response = file_get_contents($filename); - - // Line endings are sometimes an issue inside the canned responses; the - // following is a negative lookbehind assertion, and replaces any \n - // not preceded by \r with the sequence \r\n, ensuring that the message - // is well-formed. - return preg_replace("#(?assertTrue(is_array($this->enry->extensionElements)); - $this->assertTrue(count($this->enry->extensionElements) == 0); - } - - public function testEmptyEntryToAndFromStringShouldMatch() - { - $enryXml = $this->enry->saveXML(); - $newEntry = new Zend_Gdata_App_Entry(); - $newEntry->transferFromXML($enryXml); - $newEntryXml = $newEntry->saveXML(); - $this->assertTrue($enryXml == $newEntryXml); - } - - public function testConvertEntryToAndFromString() - { - $this->enry->transferFromXML($this->enryText); - $enryXml = $this->enry->saveXML(); - $newEntry = new Zend_Gdata_App_Entry(); - $newEntry->transferFromXML($enryXml); -/* - $this->assertEquals(1, count($newEntry->entry)); - $this->assertEquals('dive into mark', $newEntry->title->text); - $this->assertEquals('text', $newEntry->title->type); - $this->assertEquals('2005-07-31T12:29:29Z', $newEntry->updated->text); - $this->assertEquals('tag:example.org,2003:3', $newEntry->id->text); - $this->assertEquals(2, count($newEntry->link)); - $this->assertEquals('http://example.org/', - $newEntry->getAlternateLink()->href); - $this->assertEquals('en', - $newEntry->getAlternateLink()->hrefLang); - $this->assertEquals('text/html', - $newEntry->getAlternateLink()->type); - $this->assertEquals('http://example.org/enry.atom', - $newEntry->getSelfLink()->href); - $this->assertEquals('application/atom+xml', - $newEntry->getSelfLink()->type); - $this->assertEquals('Copyright (c) 2003, Mark Pilgrim', - $newEntry->rights->text); - $entry = $newEntry->entry[0]; - $this->assertEquals('Atom draft-07 snapshot', $entry->title->text); - $this->assertEquals('tag:example.org,2003:3.2397', - $entry->id->text); - $this->assertEquals('2005-07-31T12:29:29Z', $entry->updated->text); - $this->assertEquals('2003-12-13T08:29:29-04:00', - $entry->published->text); - $this->assertEquals('Mark Pilgrim', - $entry->author[0]->name->text); - $this->assertEquals('http://example.org/', - $entry->author[0]->uri->text); - $this->assertEquals(2, count($entry->contributor)); - $this->assertEquals('Sam Ruby', - $entry->contributor[0]->name->text); - $this->assertEquals('Joe Gregorio', - $entry->contributor[1]->name->text); - $this->assertEquals('xhtml', $entry->content->type); -*/ - } - - public function testCanSetAndGetEtag() - { - $data = "W/&FooBarBaz&"; - $this->enry->setEtag($data); - $this->assertEquals($this->enry->getEtag(), $data); - } - - public function testCanSetAndgetService() - { - $data = new Zend_Gdata_App(); - $this->enry->setService($data); - $this->assertEquals($this->enry->getService(), $data); - - $data = null; - $this->enry->setService($data); - $this->assertEquals($this->enry->getService(), $data); - } - - public function testsetServiceProvidesFluentInterface() - { - $result = $this->enry->setService(null); - $this->assertEquals($this->enry, $result); - } - - public function testGetHttpClientPullsFromServiceInstance() - { - $s = new Zend_Gdata_App(); - $this->enry->setService($s); - - $c = new Zend_Gdata_HttpClient(); - $s->setHttpClient($c); - $this->assertEquals($this->enry->getHttpClient(), - $s->getHttpClient()); - - $c = new Zend_Http_Client(); - $s->setHttpClient($c); - $this->assertEquals($this->enry->getHttpClient(), - $s->getHttpClient($c)); - } - - public function testSetHttpClientPushesIntoServiceInstance() - { - $s = new Zend_Gdata_App(); - $this->enry->setService($s); - - $c = new Zend_Gdata_HttpClient(); - $this->enry->setHttpClient($c); - $this->assertEquals(get_class($s->getHttpClient()), - 'Zend_Gdata_HttpClient'); - - $c = new Zend_Http_Client(); - $this->enry->setHttpClient($c); - $this->assertEquals(get_class($s->getHttpClient()), - 'Zend_Http_Client'); - } - - public function testSaveSupportsGdataV2() - { - // Prepare mock response - $this->adapter->setResponse("HTTP/1.1 201 Created"); - - // Make sure that we're using protocol v2 - $this->service->setMajorProtocolVersion(2); - $this->enry->setService($this->service); - - // Set a URL for posting, so that save() will work - $editLink = new Zend_Gdata_App_extension_Link('http://example.com', - 'edit'); - $this->enry->setLink(array($editLink)); - - // Perform a (mock) save - $this->enry->save(); - - // Check to make sure that a v2 header was sent - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'GData-Version: 2') - $found = true; - } - $this->assertTrue($found, - 'GData-Version header missing or incorrect.'); - } - - public function testDeleteSupportsGdataV2() - { - // Prepare mock response - $this->adapter->setResponse("HTTP/1.1 200 OK"); - - // Make sure that we're using protocol v2 - $this->service->setMajorProtocolVersion(2); - $this->enry->setService($this->service); - - // Set a URL for posting, so that save() will work - $editLink = new Zend_Gdata_App_extension_Link('http://example.com', - 'edit'); - $this->enry->setLink(array($editLink)); - - // Perform a (mock) save - $this->enry->delete(); - - // Check to make sure that a v2 header was sent - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'GData-Version: 2') - $found = true; - } - $this->assertTrue($found, - 'GData-Version header missing or incorrect.'); - } - - public function testIfMatchHeaderCanBeSetOnSave() - { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->save(null, null, - array('If-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, - 'If-Match header not found or incorrect'); - } - - public function testIfNoneMatchHeaderCanBeSetOnSave() - { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->save(null, null, - array('If-None-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-None-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, - 'If-None-Match header not found or incorrect'); - } - - public function testCanSetUriOnSave() - { - $uri = 'http://example.net/foo/bar'; - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $newEntry = $entry->save($uri); - $request = $this->adapter->popRequest(); - $uriObject = Zend_Uri_Http::fromString($uri); - $uriObject->setPort('80'); - $this->assertEquals($uriObject, $request->uri); - } - - public function testCanSetClassnameOnSave() - { - $className = 'Zend_Gdata_Entry'; - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $newEntry = $entry->save(null, $className); - $this->assertEquals($className, get_class($newEntry)); - } - - public function testIfNoneMatchSetOnReload() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-None-Match: ' . $etag) - $found = true; - } - $this->assertTrue($found, - 'If-None-Match header not found or incorrect'); - } - - public function testIfNoneMatchCanBeSetOnReload() - { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(null, null, - array('If-None-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-None-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, - 'If-None-Match header not found or incorrect'); - } - - public function testReloadReturnsEntryObject() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(); - $this->assertEquals('Zend_Gdata_App_Entry', get_class($newEntry)); - } - - public function testReloadPopulatesEntryObject() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(); - $this->assertEquals('Hello world', $newEntry->title->text); - } - - public function testReloadDoesntThrowExceptionIfNoEtag() - { - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $newEntry = $entry->reload(); - $this->assertEquals('Zend_Gdata_App_Entry', get_class($newEntry)); - } - - public function testReloadExtractsURIFromEditLink() - { - $expectedUri = 'http://www.example.com'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - $expectedUri, - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(); - $requestUri = $this->adapter->popRequest()->uri; - $expectedUriObject = Zend_Uri_Http::fromString($expectedUri); - $expectedUriObject->setPort('80'); - $this->assertEquals($expectedUriObject, $requestUri); - } - - public function testReloadAllowsCustomURI() - { - $uriOverride = 'http://www.example.org'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload($uriOverride); - $requestUri = $this->adapter->popRequest()->uri; - $uriOverrideObject = Zend_Uri_Http::fromString($uriOverride); - $uriOverrideObject->setPort('80'); - $this->assertEquals($uriOverrideObject, $requestUri); - } - - public function testReloadReturnsNullIfEntryNotModified() - { - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse('HTTP/1.1 304 Not Modified'); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(); - $this->assertEquals(null, $newEntry); - } - - public function testCanSetReloadReturnClassname() - { - $className = 'Zend_Gdata_Entry'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(null, $className); - $this->assertEquals($className, get_class($newEntry)); - } - - public function testReloadInheritsClassname() - { - $className = 'Zend_Gdata_Entry'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = new $className; - $entry->setService($this->service); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $newEntry = $entry->reload(); - $this->assertEquals($className, get_class($newEntry)); - } - - public function testCanSetMajorProtocolVersion() - { - $expectedVersion = 42; - $entry = $this->service->newEntry(); - $entry->setMajorProtocolVersion($expectedVersion); - $receivedVersion = $entry->getMajorProtocolVersion(); - $this->assertEquals($expectedVersion, $receivedVersion); - } - - public function testCanSetMinorProtocolVersion() - { - $expectedVersion = 42; - $entry = $this->service->newEntry(); - $entry->setMinorProtocolVersion($expectedVersion); - $receivedVersion = $entry->getMinorProtocolVersion(); - $this->assertEquals($expectedVersion, $receivedVersion); - } - - public function testMajorProtocolVersionCannotBeZero() - { - $expectedVersion = 0; - $entry = $this->service->newEntry(); - $this->setExpectedException('Zend_Gdata_App_InvalidArgumentException'); - $entry->setMajorProtocolVersion($expectedVersion); - } - - public function testMajorProtocolVersionCannotBeNegative() - { - $expectedVersion = -1; - $entry = $this->service->newEntry(); - $this->setExpectedException('Zend_Gdata_App_InvalidArgumentException'); - $entry->setMajorProtocolVersion($expectedVersion); - } - - public function testMajorProtocolVersionMayBeNull() - { - $expectedVersion = null; - $entry = $this->service->newEntry(); - $entry->setMajorProtocolVersion($expectedVersion); - $receivedVersion = $entry->getMajorProtocolVersion(); - $this->assertNull($receivedVersion); - } - - public function testMinorProtocolVersionMayBeZero() - { - $expectedVersion = 0; - $entry = $this->service->newEntry(); - $entry->setMinorProtocolVersion($expectedVersion); - $receivedVersion = $entry->getMinorProtocolVersion(); - $this->assertEquals($expectedVersion, $receivedVersion); - } - - public function testMinorProtocolVersionCannotBeNegative() - { - $expectedVersion = -1; - $entry = $this->service->newEntry(); - $this->setExpectedException('Zend_Gdata_App_InvalidArgumentException'); - $entry->setMinorProtocolVersion($expectedVersion); - } - - public function testMinorProtocolVersionMayBeNull() - { - $expectedVersion = null; - $entry = $this->service->newEntry(); - $entry->setMinorProtocolVersion($expectedVersion); - $receivedVersion = $entry->getMinorProtocolVersion(); - $this->assertNull($receivedVersion); - } - - public function testDefaultMajorProtocolVersionIs1() - { - $entry = $this->service->newEntry(); - $this->assertEquals(1, $entry->getMajorProtocolVersion()); - } - - public function testDefaultMinorProtocolVersionIsNull() - { - $entry = $this->service->newEntry(); - $this->assertNull($entry->getMinorProtocolVersion()); - } - - public function testLookupNamespaceUsesCurrentVersion() - { - $prefix = 'test'; - $v1TestString = 'TEST-v1'; - $v2TestString = 'TEST-v2'; - - Zend_Gdata_App_Base::flushNamespaceLookupCache(); - $entry = $this->service->newEntry(); - $entry->registerNamespace($prefix, $v1TestString, 1, 0); - $entry->registerNamespace($prefix, $v2TestString, 2, 0); - $entry->setMajorProtocolVersion(1); - $result = $entry->lookupNamespace($prefix); - $this->assertEquals($v1TestString, $result); - $entry->setMajorProtocolVersion(2); - $result = $entry->lookupNamespace($prefix); - $this->assertEquals($v2TestString, $result); - $entry->setMajorProtocolVersion(null); // Should default to latest - $result = $entry->lookupNamespace($prefix); - $this->assertEquals($v2TestString, $result); - } - - public function testLookupNamespaceObeysParentBehavior() - { - $prefix = 'test'; - $testString10 = 'TEST-v1-0'; - $testString20 = 'TEST-v2-0'; - $testString11 = 'TEST-v1-1'; - $testString21 = 'TEST-v2-1'; - $testString12 = 'TEST-v1-2'; - $testString22 = 'TEST-v2-2'; - - Zend_Gdata_App_Base::flushNamespaceLookupCache(); - $entry = $this->service->newEntry(); - $entry->registerNamespace($prefix, $testString10, 1, 0); - $entry->registerNamespace($prefix, $testString20, 2, 0); - $entry->registerNamespace($prefix, $testString11, 1, 1); - $entry->registerNamespace($prefix, $testString21, 2, 1); - $entry->registerNamespace($prefix, $testString12, 1, 2); - $entry->registerNamespace($prefix, $testString22, 2, 2); - - // Assumes default version (1) - $result = $entry->lookupNamespace($prefix, 1, null); - $this->assertEquals($testString12, $result); - $result = $entry->lookupNamespace($prefix, 2, null); - $this->assertEquals($testString22, $result); - $result = $entry->lookupNamespace($prefix, 1, 1); - $this->assertEquals($testString11, $result); - $result = $entry->lookupNamespace($prefix, 2, 1); - $this->assertEquals($testString21, $result); - $result = $entry->lookupNamespace($prefix, null, null); - $this->assertEquals($testString12, $result); - $result = $entry->lookupNamespace($prefix, null, 1); - $this->assertEquals($testString11, $result); - - // Override to retrieve latest version - $entry->setMajorProtocolVersion(null); - $result = $entry->lookupNamespace($prefix, null, null); - $this->assertEquals($testString22, $result); - $result = $entry->lookupNamespace($prefix, null, 1); - $this->assertEquals($testString21, $result); - } - -} diff --git a/tests/Zend/Gdata/App/FeedTest.php b/tests/Zend/Gdata/App/FeedTest.php deleted file mode 100644 index 997abd3fd..000000000 --- a/tests/Zend/Gdata/App/FeedTest.php +++ /dev/null @@ -1,283 +0,0 @@ -feedText = file_get_contents( - 'Zend/Gdata/App/_files/FeedSample1.xml', - true); - $this->feed = new Zend_Gdata_App_Feed(); - } - - public function testEmptyFeedShouldHaveEmptyExtensionsList() { - $this->assertTrue(is_array($this->feed->extensionElements)); - $this->assertTrue(count($this->feed->extensionElements) == 0); - } - - public function testEmptyFeedToAndFromStringShouldMatch() { - $feedXml = $this->feed->saveXML(); - $newFeed = new Zend_Gdata_App_Feed(); - $newFeed->transferFromXML($feedXml); - $newFeedXml = $newFeed->saveXML(); - $this->assertTrue($feedXml == $newFeedXml); - } - - public function testConvertFeedToAndFromString() { - $this->feed->transferFromXML($this->feedText); - $feedXml = $this->feed->saveXML(); - $newFeed = new Zend_Gdata_App_Feed(); - $newFeed->transferFromXML($feedXml); - $this->assertEquals(1, count($newFeed->entry)); - $this->assertEquals('dive into mark', $newFeed->title->text); - $this->assertEquals('text', $newFeed->title->type); - $this->assertEquals('2005-07-31T12:29:29Z', $newFeed->updated->text); - $this->assertEquals('tag:example.org,2003:3', $newFeed->id->text); - $this->assertEquals(2, count($newFeed->link)); - $this->assertEquals('http://example.org/', - $newFeed->getAlternateLink()->href); - $this->assertEquals('en', - $newFeed->getAlternateLink()->hrefLang); - $this->assertEquals('text/html', - $newFeed->getAlternateLink()->type); - $this->assertEquals('http://example.org/feed.atom', - $newFeed->getSelfLink()->href); - $this->assertEquals('application/atom+xml', - $newFeed->getSelfLink()->type); - $this->assertEquals('Copyright (c) 2003, Mark Pilgrim', - $newFeed->rights->text); - $entry = $newFeed->entry[0]; - $this->assertEquals('Atom draft-07 snapshot', $entry->title->text); - $this->assertEquals('tag:example.org,2003:3.2397', - $entry->id->text); - $this->assertEquals('2005-07-31T12:29:29Z', $entry->updated->text); - $this->assertEquals('2003-12-13T08:29:29-04:00', - $entry->published->text); - $this->assertEquals('Mark Pilgrim', - $entry->author[0]->name->text); - $this->assertEquals('http://example.org/', - $entry->author[0]->uri->text); - $this->assertEquals(2, count($entry->contributor)); - $this->assertEquals('Sam Ruby', - $entry->contributor[0]->name->text); - $this->assertEquals('Joe Gregorio', - $entry->contributor[1]->name->text); - $this->assertEquals('xhtml', $entry->content->type); - } - - public function testCanAddIndividualEntries() { - $this->feed->transferFromXML($this->feedText); - $this->assertEquals(1, count($this->feed->entry)); - $oldTitle = $this->feed->entry[0]->title->text; - $newEntry = new Zend_Gdata_App_Entry(); - $newEntry->setTitle(new Zend_Gdata_App_Extension_Title("Foo")); - $this->feed->addEntry($newEntry); - $this->assertEquals(2, count($this->feed->entry)); - $this->assertEquals($oldTitle, $this->feed->entry[0]->title->text); - $this->assertEquals("Foo", $this->feed->entry[1]->title->text); - } - - public function testCanSetAndGetEtag() { - $data = "W/&FooBarBaz&"; - $this->feed->setEtag($data); - $this->assertEquals($this->feed->getEtag(), $data); - } - - public function testSetServicePropagatesToChildren() { - // Setup - $entries = array(new Zend_Gdata_App_Entry(), - new Zend_Gdata_App_Entry()); - foreach ($entries as $entry) { - $this->feed->addEntry($entry); - } - - // Set new service instance and test for propagation - $s = new Zend_Gdata_App(); - $this->feed->setService($s); - - $service = $this->feed->getService(); - if (!is_object($service)) { - $this->fail('No feed service received'); - } - $this->assertEquals('Zend_Gdata_App', - get_class($service)); - - foreach ($entries as $entry) { - $service = $entry->getService(); - if (!is_object($service)) { - $this->fail('No entry service received'); - } - $this->assertEquals('Zend_Gdata_App', - get_class($service)); - } - - // Set null service instance and test for propagation - $s = null; - $this->feed->setService($s); - $this->assertFalse(is_object($this->feed->getService())); - foreach ($entries as $entry) { - $service = $entry->getService(); - $this->assertFalse(is_object($service)); - } - } - - public function testCanSetMajorProtocolVersion() - { - $expectedVersion = 42; - $this->feed->setMajorProtocolVersion($expectedVersion); - $receivedVersion = $this->feed->getMajorProtocolVersion(); - $this->assertEquals($expectedVersion, $receivedVersion); - } - - public function testCanSetMinorProtocolVersion() - { - $expectedVersion = 42; - $this->feed->setMinorProtocolVersion($expectedVersion); - $receivedVersion = $this->feed->getMinorProtocolVersion(); - $this->assertEquals($expectedVersion, $receivedVersion); - } - - public function testEntriesInheritFeedVersionOnCreate() - { - $major = 98; - $minor = 12; - $this->feed->setMajorProtocolVersion($major); - $this->feed->setMinorProtocolVersion($minor); - $this->feed->transferFromXML($this->feedText); - foreach ($this->feed->entries as $entry) { - $this->assertEquals($major, $entry->getMajorProtocolVersion()); - $this->assertEquals($minor, $entry->getMinorProtocolVersion()); - } - } - - public function testEntriesInheritFeedVersionOnUpdate() - { - $major = 98; - $minor = 12; - $this->feed->transferFromXML($this->feedText); - $this->feed->setMajorProtocolVersion($major); - $this->feed->setMinorProtocolVersion($minor); - foreach ($this->feed->entries as $entry) { - $this->assertEquals($major, $entry->getMajorProtocolVersion()); - $this->assertEquals($minor, $entry->getMinorProtocolVersion()); - } - } - - public function testDefaultMajorProtocolVersionIs1() - { - $this->assertEquals(1, $this->feed->getMajorProtocolVersion()); - } - - public function testDefaultMinorProtocolVersionIsNull() - { - $this->assertNull($this->feed->getMinorProtocolVersion()); - } - - public function testLookupNamespaceUsesCurrentVersion() - { - $prefix = 'test'; - $v1TestString = 'TEST-v1'; - $v2TestString = 'TEST-v2'; - - Zend_Gdata_App_Base::flushNamespaceLookupCache(); - $feed = $this->feed; - $feed->registerNamespace($prefix, $v1TestString, 1, 0); - $feed->registerNamespace($prefix, $v2TestString, 2, 0); - $feed->setMajorProtocolVersion(1); - $result = $feed->lookupNamespace($prefix); - $this->assertEquals($v1TestString, $result); - $feed->setMajorProtocolVersion(2); - $result = $feed->lookupNamespace($prefix); - $this->assertEquals($v2TestString, $result); - $feed->setMajorProtocolVersion(null); // Should default to latest - $result = $feed->lookupNamespace($prefix); - } - - public function testLookupNamespaceObeysParentBehavior() - { - $prefix = 'test'; - $testString10 = 'TEST-v1-0'; - $testString20 = 'TEST-v2-0'; - $testString11 = 'TEST-v1-1'; - $testString21 = 'TEST-v2-1'; - $testString12 = 'TEST-v1-2'; - $testString22 = 'TEST-v2-2'; - - Zend_Gdata_App_Base::flushNamespaceLookupCache(); - $feed = $this->feed; - $feed->registerNamespace($prefix, $testString10, 1, 0); - $feed->registerNamespace($prefix, $testString20, 2, 0); - $feed->registerNamespace($prefix, $testString11, 1, 1); - $feed->registerNamespace($prefix, $testString21, 2, 1); - $feed->registerNamespace($prefix, $testString12, 1, 2); - $feed->registerNamespace($prefix, $testString22, 2, 2); - - // Assumes default version (1) - $result = $feed->lookupNamespace($prefix, 1, null); - $this->assertEquals($testString12, $result); - $result = $feed->lookupNamespace($prefix, 2, null); - $this->assertEquals($testString22, $result); - $result = $feed->lookupNamespace($prefix, 1, 1); - $this->assertEquals($testString11, $result); - $result = $feed->lookupNamespace($prefix, 2, 1); - $this->assertEquals($testString21, $result); - $result = $feed->lookupNamespace($prefix, null, null); - $this->assertEquals($testString12, $result); - $result = $feed->lookupNamespace($prefix, null, 1); - $this->assertEquals($testString11, $result); - - // Override to retrieve latest version - $feed->setMajorProtocolVersion(null); - $result = $feed->lookupNamespace($prefix, null, null); - $this->assertEquals($testString22, $result); - $result = $feed->lookupNamespace($prefix, null, 1); - $this->assertEquals($testString21, $result); - } - - /** - * @group ZF-10242 - */ - public function testCount() - { - $feed = new Zend_Gdata_App_Feed(); - $feed->addEntry('foo') - ->addEntry('bar'); - - $this->assertEquals(2, $feed->count()); - $this->assertEquals(2, count($feed)); - } -} diff --git a/tests/Zend/Gdata/App/GeneratorTest.php b/tests/Zend/Gdata/App/GeneratorTest.php deleted file mode 100644 index eb6cf9019..000000000 --- a/tests/Zend/Gdata/App/GeneratorTest.php +++ /dev/null @@ -1,83 +0,0 @@ -generatorText = file_get_contents( - 'Zend/Gdata/App/_files/GeneratorElementSample1.xml', - true); - $this->generator = new Zend_Gdata_App_Extension_Generator(); - } - - public function testEmptyGeneratorShouldHaveEmptyExtensionsList() { - $this->assertTrue(is_array($this->generator->extensionElements)); - $this->assertTrue(count($this->generator->extensionElements) == 0); - } - - public function testEmptyGeneratorToAndFromStringShouldMatch() { - $generatorXml = $this->generator->saveXML(); - $newGenerator = new Zend_Gdata_App_Extension_Generator(); - $newGenerator->transferFromXML($generatorXml); - $newGeneratorXml = $newGenerator->saveXML(); - $this->assertTrue($generatorXml == $newGeneratorXml); - } - - public function testGeneratorToAndFromStringShouldMatch() { - $this->generator->uri = 'http://code.google.com/apis/gdata/'; - $this->generator->version = '1.0'; - $this->generator->text = 'Google data APIs'; - $generatorXml = $this->generator->saveXML(); - $newGenerator = new Zend_Gdata_App_Extension_Generator(); - $newGenerator->transferFromXML($generatorXml); - $newGeneratorXml = $newGenerator->saveXML(); - $this->assertEquals($newGeneratorXml, $generatorXml); - $this->assertEquals('http://code.google.com/apis/gdata/', - $newGenerator->uri); - $this->assertEquals('1.0', $newGenerator->version); - $this->assertEquals('Google data APIs', $newGenerator->text); - } - - public function testConvertGeneratorWithDraftToAndFromString() { - $this->generator->transferFromXML($this->generatorText); - $this->assertEquals('http://code.google.com/apis/gdata/', - $this->generator->uri); - $this->assertEquals('1.0', $this->generator->version); - $this->assertEquals('Google data APIs', $this->generator->text); - } - -} diff --git a/tests/Zend/Gdata/App/HttpExceptionTest.php b/tests/Zend/Gdata/App/HttpExceptionTest.php deleted file mode 100644 index a724d850a..000000000 --- a/tests/Zend/Gdata/App/HttpExceptionTest.php +++ /dev/null @@ -1,72 +0,0 @@ -sprKey = constant('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY'); - $this->wksId = constant('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID'); - $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $this->gdata = new Zend_Gdata_Spreadsheets($client); - } - - public function testGetRawResponseBody() - { - try { - $rowData = array(); - $entry = $this->gdata->insertRow($rowData, $this->sprKey); - $this->fail('Expecting Zend_Gdata_App_HttpException'); - } catch (Zend_Gdata_App_HttpException $hExc) { - $this->assertThat($hExc, - $this->isInstanceOf('Zend_Gdata_App_HttpException'), - 'Expecting Zend_Gdata_App_HttpException, got ' - . get_class($hExc)); - - $message = $hExc->getMessage(); - $this->assertEquals($message, 'Expected response code 200, got 400'); - $body = $hExc->getRawResponseBody(); - $this->assertNotNull($body); - $this->assertNotEquals(stripos($body, - 'Blank rows cannot be written; use delete instead.'), false); - } - } -} diff --git a/tests/Zend/Gdata/App/MockBase.php b/tests/Zend/Gdata/App/MockBase.php deleted file mode 100644 index b6188ec90..000000000 --- a/tests/Zend/Gdata/App/MockBase.php +++ /dev/null @@ -1,39 +0,0 @@ -assertEquals('2006-12-01', $date); - } - - public function testFormatTimestampFromStringWithTimezone() - { - // assert that a correctly formatted timestamp is not modified - $date = Zend_Gdata_App_Util::formatTimestamp('2007-01-10T13:31:12-04:00'); - $this->assertEquals('2007-01-10T13:31:12-04:00', $date); - } - - public function testFormatTimestampWithMilliseconds() - { - // assert that a correctly formatted timestamp is not modified - $date = Zend_Gdata_App_Util::formatTimestamp('1956-12-14T43:09:54.52376Z'); - $this->assertEquals('1956-12-14T43:09:54.52376Z', $date); - } - - public function testFormatTimestampUsingZuluAsOffset() - { - // assert that a correctly formatted timestamp is not modified - $date = Zend_Gdata_App_Util::formatTimestamp('2024-03-19T01:38:12Z'); - $this->assertEquals('2024-03-19T01:38:12Z', $date); - } - - public function testFormatTimestampUsingLowercaseTAndZ() - { - // assert that a correctly formatted timestamp is not modified - $date = Zend_Gdata_App_Util::formatTimestamp('1945-07-19t12:19:08z'); - $this->assertEquals('1945-07-19t12:19:08z', $date); - } - - public function testFormatTimestampFromStringWithNonCompliantDate() - { - // assert that a non-compliant date is converted to RFC 3339 - $date = Zend_Gdata_App_Util::formatTimestamp('2007/07/13'); - $this->assertEquals('2007-07-13T00:00:00', $date); - } - - public function testFormatTimestampFromInteger() - { - $ts = 1164960000; // Fri Dec 1 00:00:00 PST 2006 - $date = Zend_Gdata_App_Util::formatTimestamp($ts); - $this->assertEquals('2006-12-01T08:00:00+00:00', $date); - } - - public function testExceptionFormatTimestampNonsense() - { - $util = new Zend_Gdata_App_Util(); - try { - $ts = Zend_Gdata_App_Util::formatTimestamp('nonsense string'); - } catch (Zend_Gdata_App_Exception $e) { - $this->assertEquals('Invalid timestamp: nonsense string.', $e->getMessage()); - return; - } - // Excetion not thrown, this is bad. - $this->fail("Exception not thrown."); - } - - public function testExceptionFormatTimestampSemiInvalid() - { - $util = new Zend_Gdata_App_Util(); - try { - $ts = Zend_Gdata_App_Util::formatTimestamp('2007-06-05adslfkja'); - } catch (Zend_Gdata_App_Exception $e) { - $this->assertEquals('Invalid timestamp: 2007-06-05adslfkja.', $e->getMessage()); - return; - } - // Excetion not thrown, this is bad. - $this->fail("Exception not thrown."); - } - - public function testExceptionFormatTimestampInvalidTime() - { - $util = new Zend_Gdata_App_Util(); - try { - $ts = Zend_Gdata_App_Util::formatTimestamp('2007-06-05Tadslfkja'); - } catch (Zend_Gdata_App_Exception $e) { - $this->assertEquals('Invalid timestamp: 2007-06-05Tadslfkja.', $e->getMessage()); - return; - } - // Excetion not thrown, this is bad. - $this->fail("Exception not thrown."); - } - - public function testExceptionFormatTimestampInvalidOffset() - { - $util = new Zend_Gdata_App_Util(); - try { - $ts = Zend_Gdata_App_Util::formatTimestamp('2007-06-05T02:51:12+egg'); - } catch (Zend_Gdata_App_Exception $e) { - $this->assertEquals('Invalid timestamp: 2007-06-05T02:51:12+egg.', $e->getMessage()); - return; - } - // Excetion not thrown, this is bad. - $this->fail("Exception not thrown."); - } - - public function testExceptionFormatTimestampInvalidOffsetHours() - { - $util = new Zend_Gdata_App_Util(); - try { - $ts = Zend_Gdata_App_Util::formatTimestamp('2007-06-05T02:51:12-ab:00'); - } catch (Zend_Gdata_App_Exception $e) { - $this->assertEquals('Invalid timestamp: 2007-06-05T02:51:12-ab:00.', $e->getMessage()); - return; - } - // Excetion not thrown, this is bad. - $this->fail("Exception not thrown."); - } - - /** - * @group ZF-11610 - */ - public function testFormatTimestepHandlesSmallUnixTimestampProperly() - { - $this->assertEquals( - '1970-01-01T00:02:03+00:00', - Zend_Gdata_App_Util::formatTimestamp(123) - ); - } - - public function testFindGreatestBoundedValueReturnsMax() { - $data = array(-1 => null, - 0 => null, - 1 => null, - 2 => null, - 3 => null, - 5 => null, - -2 => null); - $result = Zend_Gdata_App_Util::findGreatestBoundedValue(99, $data); - $this->assertEquals(5, $result); - } - - public function testFindGreatestBoundedValueReturnsMaxWhenBounded() { - $data = array(-1 => null, - 0 => null, - 1 => null, - 2 => null, - 3 => null, - 5 => null, - -2 => null); - $result = Zend_Gdata_App_Util::findGreatestBoundedValue(4, $data); - $this->assertEquals(3, $result); - } - - public function testFindGreatestBoundedValueReturnsMaxWhenUnbounded() { - $data = array(-1 => null, - 0 => null, - 1 => null, - 2 => null, - 3 => null, - 5 => null, - -2 => null); - $result = Zend_Gdata_App_Util::findGreatestBoundedValue(null, $data); - $this->assertEquals(5, $result); - } - - public function testFindGreatestBoundedValueReturnsZeroWhenZeroBounded() { - $data = array(-1 => null, - 0 => null, - 1 => null, - 2 => null, - 3 => null, - 5 => null, - -2 => null); - $result = Zend_Gdata_App_Util::findGreatestBoundedValue(0, $data); - $this->assertEquals(0, $result); - } - - public function testFindGreatestBoundedValueFailsWhenNegativelyBounded() { - $data = array(-1 => null, - 0 => null, - 1 => null, - 2 => null, - 3 => null, - 5 => null, - -2 => null); - try { - $result = Zend_Gdata_App_Util::findGreatestBoundedValue(-1, $data); - $failed = true; - } catch (Zend_Gdata_App_Exception $e) { - $failed = false; - } - $this->assertFalse($failed, 'Exception not raised.'); - } - -} diff --git a/tests/Zend/Gdata/App/_files/AuthorElementSample1.xml b/tests/Zend/Gdata/App/_files/AuthorElementSample1.xml deleted file mode 100644 index 772b6f5d6..000000000 --- a/tests/Zend/Gdata/App/_files/AuthorElementSample1.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - John Doe - johndoes@someemailadress.com - http://www.google.com - diff --git a/tests/Zend/Gdata/App/_files/CategoryElementSample1.xml b/tests/Zend/Gdata/App/_files/CategoryElementSample1.xml deleted file mode 100644 index 2a8b60981..000000000 --- a/tests/Zend/Gdata/App/_files/CategoryElementSample1.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/tests/Zend/Gdata/App/_files/ContentElementSample1.xml b/tests/Zend/Gdata/App/_files/ContentElementSample1.xml deleted file mode 100644 index 91acb5bc9..000000000 --- a/tests/Zend/Gdata/App/_files/ContentElementSample1.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/tests/Zend/Gdata/App/_files/ContentElementSample2.xml b/tests/Zend/Gdata/App/_files/ContentElementSample2.xml deleted file mode 100644 index 18cdfc1c6..000000000 --- a/tests/Zend/Gdata/App/_files/ContentElementSample2.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/App/_files/ControlElementSample1.xml b/tests/Zend/Gdata/App/_files/ControlElementSample1.xml deleted file mode 100644 index 5fbd7ef42..000000000 --- a/tests/Zend/Gdata/App/_files/ControlElementSample1.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - yes - diff --git a/tests/Zend/Gdata/App/_files/EntrySample1.xml b/tests/Zend/Gdata/App/_files/EntrySample1.xml deleted file mode 100644 index 27de40252..000000000 --- a/tests/Zend/Gdata/App/_files/EntrySample1.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - Atom draft-07 snapshot - - - tag:example.org,2003:3.2397 - 2005-07-31T12:29:29Z - 2003-12-13T08:29:29-04:00 - - Mark Pilgrim - http://example.org/ - f8dy@example.com - - - Sam Ruby - - - Joe Gregorio - - -
-

[Update: The Atom draft is finished.]

-
-
-
diff --git a/tests/Zend/Gdata/App/_files/EntrySampleHttp1.txt b/tests/Zend/Gdata/App/_files/EntrySampleHttp1.txt deleted file mode 100644 index 33bdd0bca..000000000 --- a/tests/Zend/Gdata/App/_files/EntrySampleHttp1.txt +++ /dev/null @@ -1,29 +0,0 @@ -HTTP/1.1 200 OK -Content-Type: application/atom+xml; charset=UTF-8 -Last-Modified: Sun, 07 Sep 2008 17:53:51 GMT -Cache-Control: max-age=0 private -ETag: W/"CkcHQH8_fCp7ImA9WxRTGEw." -Date: Sun, 07 Sep 2008 21:23:39 GMT -Content-Length: 1450 -Server: GFE/1.3 - - - - - tag:blogger.com,1999:blog-8273578352962669317.post-6938730899689776686 - 2008-09-07T10:53:00.001-07:00 - 2008-09-07T10:53:51.144-07:00 - 2008-09-07T10:53:51.144-07:00 - Hello world - <p>Hello world!</p> - - - - - - - John Doe - http://www.blogger.com/profile/12345678901234567890 - jdoe@example.com - - diff --git a/tests/Zend/Gdata/App/_files/FeedSample1.xml b/tests/Zend/Gdata/App/_files/FeedSample1.xml deleted file mode 100644 index b1a4b3684..000000000 --- a/tests/Zend/Gdata/App/_files/FeedSample1.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - dive into mark - - A <em>lot</em> of effort - went into making this effortless - - 2005-07-31T12:29:29Z - tag:example.org,2003:3 - - - Copyright (c) 2003, Mark Pilgrim - - Example Toolkit - - - Atom draft-07 snapshot - - - tag:example.org,2003:3.2397 - 2005-07-31T12:29:29Z - 2003-12-13T08:29:29-04:00 - - Mark Pilgrim - http://example.org/ - f8dy@example.com - - - Sam Ruby - - - Joe Gregorio - - -
-

[Update: The Atom draft is finished.]

-
-
-
-
diff --git a/tests/Zend/Gdata/App/_files/GeneratorElementSample1.xml b/tests/Zend/Gdata/App/_files/GeneratorElementSample1.xml deleted file mode 100644 index 00ae02181..000000000 --- a/tests/Zend/Gdata/App/_files/GeneratorElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - -Google data APIs diff --git a/tests/Zend/Gdata/AppTest.php b/tests/Zend/Gdata/AppTest.php deleted file mode 100644 index cc36362c4..000000000 --- a/tests/Zend/Gdata/AppTest.php +++ /dev/null @@ -1,673 +0,0 @@ -fileName = 'Zend/Gdata/App/_files/FeedSample1.xml'; - $this->expectedEtag = 'W/"CkcHQH8_fCp7ImA9WxRTGEw."'; - $this->expectedMajorProtocolVersion = 1; - $this->expectedMinorProtocolVersion = 2; - $this->httpEntrySample = $this->loadResponse( - __DIR__ . '/_files/AppSample1.txt' - ); - $this->httpEntrySampleWithoutVersion = $this->loadResponse( - __DIR__ . '/_files/AppSample2.txt' - ); - $this->httpFeedSample = $this->loadResponse( - __DIR__ . '/_files/AppSample3.txt' - ); - $this->httpFeedSampleWithoutVersion = $this->loadResponse( - __DIR__ . '/_files/AppSample4.txt' - ); - - $this->adapter = new Test_Zend_Gdata_MockHttpClient(); - $this->client = new Zend_Gdata_HttpClient(); - $this->client->setAdapter($this->adapter); - $this->service = new Zend_Gdata_App($this->client); - } - - public function loadResponse($filename) - { - $response = file_get_contents($filename); - - // Line endings are sometimes an issue inside the canned responses; the - // following is a negative lookbehind assertion, and replaces any \n - // not preceded by \r with the sequence \r\n, ensuring that the message - // is well-formed. - return preg_replace("#(?fileName, - 'Zend_Gdata_App_Feed', true); - $this->assertEquals('dive into mark', $feed->title->text); - } - - public function testSetAndGetHttpMethodOverride() - { - Zend_Gdata_App::setHttpMethodOverride(true); - $this->assertEquals(true, Zend_Gdata_App::getHttpMethodOverride()); - } - - public function testSetAndGetProtocolVersion() - { - $this->service->setMajorProtocolVersion(2); - $this->service->setMinorProtocolVersion(1); - $this->assertEquals(2, $this->service->getMajorProtocolVersion()); - $this->assertEquals(1, $this->service->getMinorProtocolVersion()); - } - - public function testDefaultProtocolVersionIs1X() - { - $this->assertEquals(1, $this->service->getMajorProtocolVersion()); - $this->assertEquals(null, $this->service->getMinorProtocolVersion()); - } - - public function testMajorProtocolVersionCannotBeLessThanOne() - { - $exceptionCaught = false; - try { - $this->service->setMajorProtocolVersion(0); - } catch (Zend_Gdata_App_InvalidArgumentException $e) { - $exceptionCaught = true; - } - $this->assertTrue($exceptionCaught, 'Expected exception not caught: ' - . 'Zend_Gdata_App_InvalidArgumentException'); - } - - public function testMajorProtocolVersionCannotBeNull() - { - $exceptionCaught = false; - try { - $this->service->setMajorProtocolVersion(null); - } catch (Zend_Gdata_App_InvalidArgumentException $e) { - $exceptionCaught = true; - } - $this->assertTrue($exceptionCaught, 'Expected exception not caught: ' - . 'Zend_Gdata_App_InvalidArgumentException'); - } - - public function testMinorProtocolVersionCannotBeLessThanZero() - { - $exceptionCaught = false; - try { - $this->service->setMinorProtocolVersion(-1); - } catch (Zend_Gdata_App_InvalidArgumentException $e) { - $exceptionCaught = true; - } - $this->assertTrue($exceptionCaught, 'Expected exception not caught: ' - . 'Zend_Gdata_App_InvalidArgumentException'); - } - - public function testNoGdataVersionHeaderSentWhenUsingV1() - { - $this->adapter->setResponse(array('HTTP/1.1 200 OK\r\n\r\n')); - - $this->service->setMajorProtocolVersion(1); - $this->service->setMinorProtocolVersion(null); - $this->service->get('http://www.example.com'); - - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if (strstr((string) $header, 'GData-Version:')) - $found = true; - } - $this->assertFalse($found, 'Version header found in V1 feed'); - } - - public function testNoGdataVersionHeaderSentWhenUsingV1X() - { - $this->adapter->setResponse(array('HTTP/1.1 200 OK\r\n\r\n')); - - $this->service->setMajorProtocolVersion(1); - $this->service->setMinorProtocolVersion(1); - $this->service->get('http://www.example.com'); - - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if (strstr((string) $header, 'GData-Version:')) - $found = true; - } - $this->assertTrue(!$found, 'Version header found in V1 feed'); - } - - public function testGdataVersionHeaderSentWhenUsingV2() - { - $this->adapter->setResponse(array('HTTP/1.1 200 OK\r\n\r\n')); - - $this->service->setMajorProtocolVersion(2); - $this->service->setMinorProtocolVersion(null); - $this->service->get('http://www.example.com'); - - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'GData-Version: 2') - $found = true; - } - $this->assertTrue($found, 'Version header not found or incorrect'); - } - - public function testGdataVersionHeaderSentWhenUsingV2X() - { - $this->adapter->setResponse(array('HTTP/1.1 200 OK\r\n\r\n')); - - $this->service->setMajorProtocolVersion(2); - $this->service->setMinorProtocolVersion(1); - $this->service->get('http://www.example.com'); - - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'GData-Version: 2.1') - $found = true; - } - $this->assertTrue($found, 'Version header not found or incorrect'); - } - - public function testHTTPETagsPropagateToEntriesOnGet() - { - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->getEntry('http://www.example.com'); - $this->assertEquals($this->expectedEtag, $entry->getEtag()); - } - - public function testHTTPETagsPropagateToEntriesOnUpdate() - { - $this->adapter->setResponse($this->httpEntrySample); - $entry = new Zend_Gdata_App_Entry(); - $newEntry = $this->service->updateEntry($entry, 'http://www.example.com'); - $this->assertEquals($this->expectedEtag, $newEntry->getEtag()); - } - - public function testHTTPEtagsPropagateToEntriesOnInsert() - { - $this->adapter->setResponse($this->httpEntrySample); - $entry = new Zend_Gdata_App_Entry(); - $newEntry = $this->service->insertEntry($entry, 'http://www.example.com'); - $this->assertEquals($this->expectedEtag, $newEntry->getEtag()); - } - - public function testIfMatchHTTPHeaderSetOnUpdate() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $this->service->updateEntry($entry); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertTrue($found, 'If-Match header not found or incorrect'); - } - - public function testIfMatchHTTPHeaderSetOnUpdateIfWeak() - { - $etag = 'W/ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $this->service->updateEntry($entry); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertFalse($found, 'If-Match header found'); - } - - public function testIfMatchHTTPHeaderSetOnSave() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $entry->setService($this->service); - $entry->save(); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertTrue($found, 'If-Match header not found or incorrect'); - } - - public function testIfMatchHTTPHeaderNotSetOnDelete() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $entry->setService($this->service); - $entry->delete(); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertFalse($found, 'If-Match header found on delete'); - } - - public function testIfMatchHTTPHeaderSetOnManualPost() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = $this->service->newEntry(); - $entry->setEtag($etag); - $entry->setService($this->service); - $this->service->post($entry, 'http://www.example.com'); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertTrue($found, 'If-Match header not found or incorrect'); - } - - public function testIfMatchHTTPHeaderSetOnManualPut() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $entry->setService($this->service); - $this->service->put($entry); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertTrue($found, 'If-Match header not found or incorrect'); - } - - public function testIfMatchHTTPHeaderSetOnManualDelete() - { - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = $this->service->newEntry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $entry->setService($this->service); - $this->service->delete($entry); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertFalse($found, 'If-Match header found on delete'); - } - - public function testIfMatchHeaderCanBeSetOnInsert() { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $newEntry = $this->service->insertEntry($entry, - 'http://www.example.com', - 'Zend_Gdata_App_Entry', - array('If-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, 'If-Match header not found or incorrect'); - } - - public function testIfNoneMatchHeaderCanBeSetOnInsert() { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $newEntry = $this->service->insertEntry($entry, - 'http://www.example.com', - 'Zend_Gdata_App_Entry', - array('If-None-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-None-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, 'If-None-Match header not found or incorrect '); - } - - public function testIfMatchHeaderCanBeSetOnUpdate() { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $newEntry = $this->service->updateEntry($entry, - 'http://www.example.com', - 'Zend_Gdata_App_Entry', - array('If-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, 'If-Match header not found or incorrect or incorrect'); - } - - public function testIfNoneMatchHeaderCanBeSetOnUpdate() { - $etagOverride = 'foo'; - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $this->adapter->setResponse($this->httpEntrySample); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $newEntry = $this->service->updateEntry($entry, - 'http://www.example.com', - 'Zend_Gdata_App_Entry', - array('If-None-Match' => $etagOverride)); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-None-Match: ' . $etagOverride) - $found = true; - } - $this->assertTrue($found, 'If-None-Match header not found or incorrect'); - } - - /** - * @group ZF-8397 - */ - public function testIfMatchHTTPHeaderIsResetEachRequest() - { - // Update an entry - $etag = 'ABCD1234'; - $this->adapter->setResponse("HTTP/1.1 201 Created"); - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->link = array(new Zend_Gdata_App_Extension_Link( - 'http://www.example.com', - 'edit', - 'application/atom+xml')); - $entry->setEtag($etag); - $this->service->updateEntry($entry); - - // Get another entry without ETag set, - // Previous value of If-Match HTTP header should not be sent - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->getEntry('http://www.example.com'); - $headers = $this->adapter->popRequest()->headers; - $found = false; - foreach ($headers as $header) { - if ($header == 'If-Match: ' . $etag) - $found = true; - } - $this->assertFalse($found, 'If-Match header found'); - } - - public function testGenerateIfMatchHeaderDataReturnsEtagIfV2() { - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $result = $this->service->generateIfMatchHeaderData($entry, false); - $this->assertEquals($etag, $result); - } - - public function testGenerateIfMatchHeaderDataReturnsNullIfV1() { - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(1); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $result = $this->service->generateIfMatchHeaderData($entry, false); - $this->assertEquals(null, $result); - } - - public function testGenerateIfMatchHeaderDataReturnsNullIfNotEntry() { - $this->service->setMajorProtocolVersion(2); - $result = $this->service->generateIfMatchHeaderData("Hello world", false); - $this->assertEquals(null, $result); - } - - public function testGenerateIfMatchHeaderDataReturnsNullIfWeak() { - $etag = 'W/ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $result = $this->service->generateIfMatchHeaderData($entry, false); - $this->assertEquals(null, $result); - } - - public function testGenerateIfMatchHeaderDataReturnsEtagIfWeakAndFlagSet() { - $etag = 'W/ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $result = $this->service->generateIfMatchHeaderData($entry, true); - $this->assertEquals($etag, $result); - } - - public function testGenerateIfMatchHeaderDataReturnsEtagIfNotWeakAndFlagSet() { - $etag = 'ABCD1234'; - $this->service->setMajorProtocolVersion(2); - $entry = new Zend_Gdata_App_Entry(); - $entry->setEtag($etag); - $result = $this->service->generateIfMatchHeaderData($entry, true); - $this->assertEquals($etag, $result); - } - - public function testImportUrlSetsMajorProtocolVersionOnEntry() { - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->getEntry('http://www.example.com'); - $this->assertEquals($this->expectedMajorProtocolVersion, $entry->getMajorProtocolVersion()); - } - - public function testImportUrlSetsMinorProtocolVersionOnEntry() { - $this->adapter->setResponse($this->httpEntrySample); - $entry = $this->service->getEntry('http://www.example.com'); - $this->assertEquals($this->expectedMinorProtocolVersion, $entry->getMinorProtocolVersion()); - } - - public function testImportUrlSetsNullVersionIfNoVersionHeaderOnEntry() { - $this->adapter->setResponse($this->httpEntrySampleWithoutVersion); - $entry = $this->service->getEntry('http://www.example.com'); - $this->assertEquals(null, $entry->getMinorProtocolVersion()); - $this->assertEquals(null, $entry->getMinorProtocolVersion()); - } - - public function testImportUrlSetsMajorProtocolVersionOnFeed() { - $this->adapter->setResponse($this->httpFeedSample); - $feed = $this->service->getFeed('http://www.example.com'); - $this->assertEquals($this->expectedMajorProtocolVersion, $feed->getMajorProtocolVersion()); - foreach ($feed as $entry) { - $this->assertEquals($this->expectedMajorProtocolVersion, $entry->getMajorProtocolVersion()); - } - } - - public function testImportUrlSetsMinorProtocolVersionOnFeed() { - $this->adapter->setResponse($this->httpFeedSample); - $feed = $this->service->getFeed('http://www.example.com'); - $this->assertEquals($this->expectedMinorProtocolVersion, $feed->getMinorProtocolVersion()); - foreach ($feed as $entry) { - $this->assertEquals($this->expectedMinorProtocolVersion, $entry->getMinorProtocolVersion()); - } - } - - public function testImportUrlSetsNullVersionIfNoVersionHeaderOnFeed() { - $this->adapter->setResponse($this->httpFeedSampleWithoutVersion); - $feed = $this->service->getFeed('http://www.example.com'); - $this->assertEquals(null, $feed->getMajorProtocolVersion()); - $this->assertEquals(null, $feed->getMinorProtocolVersion()); - foreach ($feed as $entry) { - $this->assertEquals(null, $entry->getMajorProtocolVersion()); - $this->assertEquals(null, $entry->getMinorProtocolVersion()); - } - } - - public function testMagicConstructorsPropogateMajorVersion() { - $v = 42; - $this->service->setMajorProtocolVersion($v); - $feed = $this->service->newFeed(); - $this->assertEquals($v, $feed->getMajorProtocolVersion()); - } - - public function testMagicConstructorsPropogateMinorVersion() { - $v = 84; - $this->service->setMinorProtocolVersion($v); - $feed = $this->service->newFeed(); - $this->assertEquals($v, $feed->getMinorProtocolVersion()); - } - - /** - * When error handler is overridden to throw an ErrorException, the extension loader - * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the - * first extension directory even if it exists in subsequent ones. This test - * enforces a fix that keeps this from happening - * - * @group ZF-12268 - * @group ZF-7013 - */ - public function testLoadExtensionCausesFatalErrorWhenErrorHandlerIsOverridden() - { - // Override the error handler to throw an ErrorException - set_error_handler(function($a, $b, $c, $d) { throw new ErrorException($b, 0, $a, $c, $d); }, E_ALL); - try { - $eq = $this->service->newEventQuery(); - restore_error_handler(); - $this->assertTrue($eq instanceof Zend_Gdata_Calendar_EventQuery); - } catch ( Zend_Gdata_App_Exception $ex ) { - // If we catch this exception, it means the ErrorException resulting - // from the include_once E_NOTICE was caught in the right place, - // but the extension was not found in any directory - // (Expected since we didn't load the Calendar extension dir) - restore_error_handler(); - $this->assertContains('EventQuery', $ex->getMessage()); - } catch ( ErrorException $ex ) { - restore_error_handler(); - $this->fail('Did not expect ErrorException'); - } - } - - /** - * @group ZF-10243 - */ - public function testStaticImportWithoutUsingObjectMapping() - { - $this->adapter->setResponse($this->httpEntrySample); - $feed = Zend_Gdata_App::import( - 'http://www.example.com', - $this->client, - 'Zend_Gdata_App_Feed', - false - ); - - $this->assertContains('12345678901234567890', $feed); - } - - public function testImportStringException() - { - try { - Zend_Gdata_App::importString('foo'); - } catch (\Throwable $e) { - self::assertInstanceOf('Zend_Gdata_App_Exception', $e); - self::assertContains('DOMDocument', $e->getMessage()); - - return; - } - - self::fail('This test should throw an exception and return early'); - } - - public function testImportFileException() - { - try { - Zend_Gdata_App::importFile('foo'); - } catch (\Throwable $e) { - self::assertInstanceOf('Zend_Gdata_App_Exception', $e); - self::assertContains('could not be loaded', $e->getMessage()); - - return; - } - - self::fail('This test should throw an exception and return early'); - } -} diff --git a/tests/Zend/Gdata/AttendeeStatusTest.php b/tests/Zend/Gdata/AttendeeStatusTest.php deleted file mode 100644 index 1e14b6ede..000000000 --- a/tests/Zend/Gdata/AttendeeStatusTest.php +++ /dev/null @@ -1,126 +0,0 @@ -attendeeStatusText = file_get_contents( - 'Zend/Gdata/_files/AttendeeStatusElementSample1.xml', - true); - $this->attendeeStatus = new Zend_Gdata_Extension_AttendeeStatus(); - } - - public function testEmptyAttendeeStatusShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->attendeeStatus->extensionElements)); - $this->assertTrue(count($this->attendeeStatus->extensionElements) == 0); - } - - public function testEmptyAttendeeStatusShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->attendeeStatus->extensionAttributes)); - $this->assertTrue(count($this->attendeeStatus->extensionAttributes) == 0); - } - - public function testSampleAttendeeStatusShouldHaveNoExtensionElements() { - $this->attendeeStatus->transferFromXML($this->attendeeStatusText); - $this->assertTrue(is_array($this->attendeeStatus->extensionElements)); - $this->assertTrue(count($this->attendeeStatus->extensionElements) == 0); - } - - public function testSampleAttendeeStatusShouldHaveNoExtensionAttributes() { - $this->attendeeStatus->transferFromXML($this->attendeeStatusText); - $this->assertTrue(is_array($this->attendeeStatus->extensionAttributes)); - $this->assertTrue(count($this->attendeeStatus->extensionAttributes) == 0); - } - - public function testNormalAttendeeStatusShouldHaveNoExtensionElements() { - $this->attendeeStatus->value = "http://schemas.google.com/g/2005#event.accepted"; - - $this->assertEquals("http://schemas.google.com/g/2005#event.accepted", $this->attendeeStatus->value); - - $this->assertEquals(0, count($this->attendeeStatus->extensionElements)); - $newAttendeeStatus = new Zend_Gdata_Extension_AttendeeStatus(); - $newAttendeeStatus->transferFromXML($this->attendeeStatus->saveXML()); - $this->assertEquals(0, count($newAttendeeStatus->extensionElements)); - $newAttendeeStatus->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newAttendeeStatus->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.accepted", $newAttendeeStatus->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newAttendeeStatus2 = $gdata->newAttendeeStatus(); - $newAttendeeStatus2->transferFromXML($newAttendeeStatus->saveXML()); - $this->assertEquals(1, count($newAttendeeStatus2->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.accepted", $newAttendeeStatus2->value); - } - - public function testEmptyAttendeeStatusToAndFromStringShouldMatch() { - $attendeeStatusXml = $this->attendeeStatus->saveXML(); - $newAttendeeStatus = new Zend_Gdata_Extension_AttendeeStatus(); - $newAttendeeStatus->transferFromXML($attendeeStatusXml); - $newAttendeeStatusXml = $newAttendeeStatus->saveXML(); - $this->assertTrue($attendeeStatusXml == $newAttendeeStatusXml); - } - - public function testAttendeeStatusWithValueToAndFromStringShouldMatch() { - $this->attendeeStatus->value = "http://schemas.google.com/g/2005#event.accepted"; - $attendeeStatusXml = $this->attendeeStatus->saveXML(); - $newAttendeeStatus = new Zend_Gdata_Extension_AttendeeStatus(); - $newAttendeeStatus->transferFromXML($attendeeStatusXml); - $newAttendeeStatusXml = $newAttendeeStatus->saveXML(); - $this->assertTrue($attendeeStatusXml == $newAttendeeStatusXml); - $this->assertEquals("http://schemas.google.com/g/2005#event.accepted", $this->attendeeStatus->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->attendeeStatus->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->attendeeStatus->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->attendeeStatus->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->attendeeStatus->extensionAttributes['foo2']['value']); - $attendeeStatusXml = $this->attendeeStatus->saveXML(); - $newAttendeeStatus = new Zend_Gdata_Extension_AttendeeStatus(); - $newAttendeeStatus->transferFromXML($attendeeStatusXml); - $this->assertEquals('bar', $newAttendeeStatus->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newAttendeeStatus->extensionAttributes['foo2']['value']); - } - - public function testConvertFullAttendeeStatusToAndFromString() { - $this->attendeeStatus->transferFromXML($this->attendeeStatusText); - $this->assertEquals("http://schemas.google.com/g/2005#event.invited", $this->attendeeStatus->value); - } - -} diff --git a/tests/Zend/Gdata/AttendeeTypeTest.php b/tests/Zend/Gdata/AttendeeTypeTest.php deleted file mode 100644 index 5bf999930..000000000 --- a/tests/Zend/Gdata/AttendeeTypeTest.php +++ /dev/null @@ -1,126 +0,0 @@ -attendeeTypeText = file_get_contents( - 'Zend/Gdata/_files/AttendeeTypeElementSample1.xml', - true); - $this->attendeeType = new Zend_Gdata_Extension_AttendeeType(); - } - - public function testEmptyAttendeeTypeShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->attendeeType->extensionElements)); - $this->assertTrue(count($this->attendeeType->extensionElements) == 0); - } - - public function testEmptyAttendeeTypeShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->attendeeType->extensionAttributes)); - $this->assertTrue(count($this->attendeeType->extensionAttributes) == 0); - } - - public function testSampleAttendeeTypeShouldHaveNoExtensionElements() { - $this->attendeeType->transferFromXML($this->attendeeTypeText); - $this->assertTrue(is_array($this->attendeeType->extensionElements)); - $this->assertTrue(count($this->attendeeType->extensionElements) == 0); - } - - public function testSampleAttendeeTypeShouldHaveNoExtensionAttributes() { - $this->attendeeType->transferFromXML($this->attendeeTypeText); - $this->assertTrue(is_array($this->attendeeType->extensionAttributes)); - $this->assertTrue(count($this->attendeeType->extensionAttributes) == 0); - } - - public function testNormalAttendeeTypeShouldHaveNoExtensionElements() { - $this->attendeeType->value = "http://schemas.google.com/g/2005#event.optional"; - - $this->assertEquals("http://schemas.google.com/g/2005#event.optional", $this->attendeeType->value); - - $this->assertEquals(0, count($this->attendeeType->extensionElements)); - $newAttendeeType = new Zend_Gdata_Extension_AttendeeType(); - $newAttendeeType->transferFromXML($this->attendeeType->saveXML()); - $this->assertEquals(0, count($newAttendeeType->extensionElements)); - $newAttendeeType->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newAttendeeType->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.optional", $newAttendeeType->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newAttendeeType2 = $gdata->newAttendeeType(); - $newAttendeeType2->transferFromXML($newAttendeeType->saveXML()); - $this->assertEquals(1, count($newAttendeeType2->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.optional", $newAttendeeType2->value); - } - - public function testEmptyAttendeeTypeToAndFromStringShouldMatch() { - $attendeeTypeXml = $this->attendeeType->saveXML(); - $newAttendeeType = new Zend_Gdata_Extension_AttendeeType(); - $newAttendeeType->transferFromXML($attendeeTypeXml); - $newAttendeeTypeXml = $newAttendeeType->saveXML(); - $this->assertTrue($attendeeTypeXml == $newAttendeeTypeXml); - } - - public function testAttendeeTypeWithValueToAndFromStringShouldMatch() { - $this->attendeeType->value = "http://schemas.google.com/g/2005#event.optional"; - $attendeeTypeXml = $this->attendeeType->saveXML(); - $newAttendeeType = new Zend_Gdata_Extension_AttendeeType(); - $newAttendeeType->transferFromXML($attendeeTypeXml); - $newAttendeeTypeXml = $newAttendeeType->saveXML(); - $this->assertTrue($attendeeTypeXml == $newAttendeeTypeXml); - $this->assertEquals("http://schemas.google.com/g/2005#event.optional", $this->attendeeType->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->attendeeType->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->attendeeType->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->attendeeType->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->attendeeType->extensionAttributes['foo2']['value']); - $attendeeTypeXml = $this->attendeeType->saveXML(); - $newAttendeeType = new Zend_Gdata_Extension_AttendeeType(); - $newAttendeeType->transferFromXML($attendeeTypeXml); - $this->assertEquals('bar', $newAttendeeType->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newAttendeeType->extensionAttributes['foo2']['value']); - } - - public function testConvertFullAttendeeTypeToAndFromString() { - $this->attendeeType->transferFromXML($this->attendeeTypeText); - $this->assertEquals("http://schemas.google.com/g/2005#event.required", $this->attendeeType->value); - } - -} diff --git a/tests/Zend/Gdata/AuthSubTest.php b/tests/Zend/Gdata/AuthSubTest.php deleted file mode 100644 index 9f78411ad..000000000 --- a/tests/Zend/Gdata/AuthSubTest.php +++ /dev/null @@ -1,273 +0,0 @@ -assertEquals('https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Fwww.example.com%2Ffoo.php&scope=http://www.google.com/calendar/feeds&secure=0&session=1', $uri); - } - - public function testGetAuthSubTokenUriModifiedBase() - { - $uri = Zend_Gdata_AuthSub::getAuthSubTokenUri( - 'http://www.example.com/foo.php', //next - 'http://www.google.com/calendar/feeds', //scope - 0, //secure - 1, //session - 'http://www.otherauthservice.com/accounts/AuthSubRequest'); - - // Note: the scope here is not encoded. It should be encoded, - // but the method getAuthSubTokenUri calls urldecode($scope). - // This currently works (no reported bugs) as web browsers will - // handle the encoding in most cases. - $this->assertEquals('http://www.otherauthservice.com/accounts/AuthSubRequest?next=http%3A%2F%2Fwww.example.com%2Ffoo.php&scope=http://www.google.com/calendar/feeds&secure=0&session=1', $uri); - } - - public function testSecureAuthSubSigning() - { - if (!extension_loaded('openssl')) { - $this->markTestSkipped('The openssl extension is not available'); - } else { - $c = new Zend_Gdata_HttpClient(); - $c->setAuthSubPrivateKeyFile("Zend/Gdata/_files/RsaKey.pem", - null, true); - $c->setAuthSubToken('abcdefg'); - $requestData = $c->filterHttpRequest('POST', - 'http://www.example.com/feed', - array(), - 'foo bar', - 'text/plain'); - - $authHeaderCheckPassed = false; - $headers = $requestData['headers']; - foreach ($headers as $headerName => $headerValue) { - if (strtolower((string) $headerName) == 'authorization') { - preg_match('/data="([^"]*)"/', $headerValue, $matches); - $dataToSign = $matches[1]; - preg_match('/sig="([^"]*)"/', $headerValue, $matches); - $sig = $matches[1]; - if (function_exists('openssl_verify')) { - $fp = fopen('Zend/Gdata/_files/RsaCert.pem', 'r', true); - $cert = ''; - while (!feof($fp)) { - $cert .= fread($fp, 8192); - } - fclose($fp); - $pubkeyid = openssl_get_publickey($cert); - $verified = openssl_verify($dataToSign, - base64_decode($sig), $pubkeyid); - $this->assertEquals( - 1, $verified, - 'The generated signature was unable ' . - 'to be verified.'); - $authHeaderCheckPassed = true; - } - } - } - $this->assertEquals(true, $authHeaderCheckPassed, - 'Auth header not found for sig verification.'); - } - } - - public function testPrivateKeyNotFound() - { - $this->setExpectedException('Zend_Gdata_App_InvalidArgumentException'); - - if (!extension_loaded('openssl')) { - $this->markTestSkipped('The openssl extension is not available'); - } else { - $c = new Zend_Gdata_HttpClient(); - $c->setAuthSubPrivateKeyFile("zendauthsubfilenotfound", null, true); - } - } - - public function testAuthSubSessionTokenReceivesSuccessfulResult() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setResponse("HTTP/1.1 200 OK\r\n\r\nToken={$this->token}\r\nExpiration=20201004T123456Z"); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $respToken = Zend_Gdata_AuthSub::getAuthSubSessionToken($this->token, $client); - $this->assertEquals($this->token, $respToken); - } - - /** - * @expectedException Zend_Gdata_App_AuthException - */ - public function testAuthSubSessionTokenCatchesFailedResult() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setResponse("HTTP/1.1 500 Internal Server Error\r\n\r\nInternal Server Error"); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $newtok = Zend_Gdata_AuthSub::getAuthSubSessionToken($this->token, $client); - } - - /** - * @expectedException Zend_Gdata_App_HttpException - */ - public function testAuthSubSessionTokenCatchesHttpClientException() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setNextRequestWillFail(true); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $newtok = Zend_Gdata_AuthSub::getAuthSubSessionToken($this->token, $client); - } - - public function testAuthSubRevokeTokenReceivesSuccessfulResult() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setResponse("HTTP/1.1 200 OK"); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $revoked = Zend_Gdata_AuthSub::AuthSubRevokeToken($this->token, $client); - $this->assertTrue($revoked); - } - - public function testAuthSubRevokeTokenCatchesFailedResult() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setResponse("HTTP/1.1 500 Not Successful"); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $revoked = Zend_Gdata_AuthSub::AuthSubRevokeToken($this->token, $client); - $this->assertFalse($revoked); - } - - /** - * @expectedException Zend_Gdata_App_HttpException - */ - public function testAuthSubRevokeTokenCatchesHttpClientException() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setNextRequestWillFail(true); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $revoked = Zend_Gdata_AuthSub::AuthSubRevokeToken($this->token, $client); - } - - public function testGetAuthSubTokenInfoReceivesSuccessfulResult() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $response = "HTTP/1.1 200 OK\r\n\r\nTarget=http://example.com\nScope=http://example.com\nSecure=false"; - $adapter->setResponse($response); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $respBody = Zend_Gdata_AuthSub::getAuthSubTokenInfo($this->token, $client); - - $this->assertContains("Target=http://example.com", $respBody); - $this->assertContains("Scope=http://example.com", $respBody); - $this->assertContains("Secure=false", $respBody); - } - - /** - * @expectedException Zend_Gdata_App_HttpException - */ - public function testGetAuthSubTokenInfoCatchesHttpClientException() - { - $adapter = new Zend_Http_Client_Adapter_Test(); - $adapter->setNextRequestWillFail(true); - - $client = new Zend_Gdata_HttpClient(); - $client->setUri('http://example.com/AuthSub'); - $client->setAdapter($adapter); - - $revoked = Zend_Gdata_AuthSub::getAuthSubTokenInfo($this->token, $client); - } - - public function testGetHttpClientProvidesNewClientWhenNullPassed() - { - $client = Zend_Gdata_AuthSub::getHttpClient($this->token); - $this->assertTrue($client instanceof Zend_Gdata_HttpClient ); - $this->assertEquals($this->token, $client->getAuthSubToken()); - } - - /** - * @group ZF-11351 - * @expectedException Zend_Gdata_App_HttpException - */ - public function testAuthSubGetHttpClientShouldThrowExceptionOnVanillaHttpClient() - { - $client = new Zend_Http_Client(); - $client->setUri('http://example.com/AuthSub'); - $gdclient = Zend_Gdata_AuthSub::getHttpClient('FakeToken', $client); - $this->fail('Expected exception Zend_Gdata_App_HttpException not raised!'); - } - -} diff --git a/tests/Zend/Gdata/Books/CollectionEntryTest.php b/tests/Zend/Gdata/Books/CollectionEntryTest.php deleted file mode 100644 index 6a18786f0..000000000 --- a/tests/Zend/Gdata/Books/CollectionEntryTest.php +++ /dev/null @@ -1,49 +0,0 @@ -gdata = new Zend_Gdata_Books_CollectionEntry(); - } - - public function testCollectionEntry() - { - $this->assertTrue(true); - } - -} diff --git a/tests/Zend/Gdata/Books/CollectionFeedTest.php b/tests/Zend/Gdata/Books/CollectionFeedTest.php deleted file mode 100644 index 3533fa062..000000000 --- a/tests/Zend/Gdata/Books/CollectionFeedTest.php +++ /dev/null @@ -1,49 +0,0 @@ -gdata = new Zend_Gdata_Books_CollectionFeed(); - } - - public function testCollectionFeed() - { - $this->assertTrue(true); - } - -} diff --git a/tests/Zend/Gdata/Books/VolumeEntryTest.php b/tests/Zend/Gdata/Books/VolumeEntryTest.php deleted file mode 100644 index a4d6548ec..000000000 --- a/tests/Zend/Gdata/Books/VolumeEntryTest.php +++ /dev/null @@ -1,126 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Books/_files/VolumeEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Books_VolumeEntry(); - } - - private function verifySamplePropertiesAreCorrect ($volumeEntry) { - $this->assertEquals('http://www.google.com/books/feeds/volumes/Mfer_MFwQrkC', - $volumeEntry->id->text); - $this->assertEquals('2008-10-07T15:28:15.000Z', $volumeEntry->updated->text); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $volumeEntry->category[0]->scheme); - $this->assertEquals('http://schemas.google.com/books/2008#volume', $volumeEntry->category[0]->term); - $this->assertEquals('http://bks1.books.google.com/books?id=Mfer_MFwQrkC&printsec=frontcover&img=1&zoom=5&sig=ACfU3U1o90VpMryPI7WKSyIhmAWdC1uDtw&source=gbs_gdata', $volumeEntry->getThumbnailLink()->href); - $this->assertEquals('http://books.google.com/books?id=Mfer_MFwQrkC&ie=ISO-8859-1&source=gbs_gdata', $volumeEntry->getInfoLink()->href); - $this->assertEquals(null, $volumeEntry->getPreviewLink()); - $creators = $volumeEntry->getCreators(); - $this->assertEquals('William Shakespeare', $creators[0]->text); - $titles = $volumeEntry->getTitles(); - $this->assertEquals('Hamlet', $titles[0]->text); - $dates = $volumeEntry->getDates(); - $this->assertEquals('2002-02', $dates[0]->text); - $identifiers = $volumeEntry->getIdentifiers(); - $this->assertEquals('Mfer_MFwQrkC', $identifiers[0]->text); - $this->assertEquals('ISBN:0198320493', $identifiers[1]->text); - $languages = $volumeEntry->getLanguages(); - $this->assertEquals('en', $languages[0]->text); - $formats = $volumeEntry->getFormats(); - $this->assertEquals('178 pages', $formats[0]->text); - $publishers = $volumeEntry->getPublishers(); - $this->assertEquals('Oxford University Press', $publishers[0]->text); - $subjects = $volumeEntry->getSubjects(); - $this->assertEquals('Denmark', $subjects[0]->text); - $this->assertEquals(null, $volumeEntry->getPreviewLink()); - $this->assertEquals('http://www.google.com/books/feeds/users/me/volumes', $volumeEntry->getAnnotationLink()->href); - $this->assertEquals('http://books.google.com/books?id=Mfer_MFwQrkC&ie=ISO-8859-1&source=gbs_gdata', $volumeEntry->getInfoLink()->href); - $this->assertEquals('http://bks1.books.google.com/books?id=Mfer_MFwQrkC&printsec=frontcover&img=1&zoom=5&sig=ACfU3U1o90VpMryPI7WKSyIhmAWdC1uDtw&source=gbs_gdata', $volumeEntry->getThumbnailLink()->href); - $this->assertEquals('Denmark', $subjects[0]->text); - $this->assertEquals('http://schemas.google.com/books/2008#view_partial', $volumeEntry->getViewability()->value); - $this->assertEquals('Mfer_MFwQrkC', $volumeEntry->getVolumeId()); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertEquals(0, count($this->entry->extensionElements)); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertEquals(0, count($this->entry->extensionAttributes)); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertEquals(0, count($this->entry->extensionElements)); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertEquals(0, count($this->entry->extensionAttributes)); - } - - public function testEmptyVolumeEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newVolumeEntry = new Zend_Gdata_Books_VolumeEntry(); - $newVolumeEntry->transferFromXML($entryXml); - $newVolumeEntryXml = $newVolumeEntry->saveXML(); - $this->assertEquals($entryXml, $newVolumeEntryXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifySamplePropertiesAreCorrect($this->entry); - } - - public function testConvertVolumeEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newVolumeEntry = new Zend_Gdata_Books_VolumeEntry(); - $newVolumeEntry->transferFromXML($entryXml); - $this->verifySamplePropertiesAreCorrect($newVolumeEntry); - $newVolumeEntryXml = $newVolumeEntry->saveXML(); - $this->assertEquals($entryXml, $newVolumeEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Books/VolumeFeedTest.php b/tests/Zend/Gdata/Books/VolumeFeedTest.php deleted file mode 100644 index 2dbfd7312..000000000 --- a/tests/Zend/Gdata/Books/VolumeFeedTest.php +++ /dev/null @@ -1,109 +0,0 @@ -feedText = file_get_contents( - 'Zend/Gdata/Books/_files/VolumeFeedDataSample1.xml', - true); - $this->feed = new Zend_Gdata_Books_VolumeFeed(); - } - - private function verifyAllSamplePropertiesAreCorrect ($volumeFeed) { - $this->assertEquals('http://www.google.com/books/feeds/volumes', - $volumeFeed->id->text); - $this->assertEquals('2008-10-07T16:41:52.000Z', $volumeFeed->updated->text); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $volumeFeed->category[0]->scheme); - $this->assertEquals('http://schemas.google.com/books/2008#volume', $volumeFeed->category[0]->term); - $this->assertEquals('text', $volumeFeed->title->type); - $this->assertEquals('Search results for Hamlet', $volumeFeed->title->text);; - $this->assertEquals('self', $volumeFeed->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $volumeFeed->getLink('self')->type); - $this->assertEquals('http://www.google.com/books/feeds/volumes?q=Hamlet&start-index=3&max-results=5', $volumeFeed->getLink('self')->href); - $this->assertEquals('Google Books Search', $volumeFeed->author[0]->name->text); - $this->assertEquals('http://www.google.com', $volumeFeed->author[0]->uri->text); - $this->assertEquals(512, $volumeFeed->totalResults->text); - $this->assertEquals(3, $volumeFeed->startIndex->text); - $this->assertEquals(5, $volumeFeed->itemsPerPage->text); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->feed->extensionElements)); - $this->assertEquals(0, count($this->feed->extensionElements)); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->feed->extensionAttributes)); - $this->assertEquals(0, count($this->feed->extensionAttributes)); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->feed->transferFromXML($this->feedText); - $this->assertTrue(is_array($this->feed->extensionElements)); - $this->assertEquals(0, count($this->feed->extensionElements)); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->feed->transferFromXML($this->feedText); - $this->assertTrue(is_array($this->feed->extensionAttributes)); - $this->assertEquals(0, count($this->feed->extensionAttributes)); - } - - public function testEmptyVolumeFeedToAndFromStringShouldMatch() { - $entryXml = $this->feed->saveXML(); - $newVolumeFeed = new Zend_Gdata_Books_VolumeFeed(); - $newVolumeFeed->transferFromXML($entryXml); - $newVolumeFeedXml = $newVolumeFeed->saveXML(); - $this->assertEquals($entryXml, $newVolumeFeedXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->feed->transferFromXML($this->feedText); - $this->verifyAllSamplePropertiesAreCorrect($this->feed); - } - - public function testConvertVolumeFeedToAndFromString() { - $this->feed->transferFromXML($this->feedText); - $entryXml = $this->feed->saveXML(); - $newVolumeFeed = new Zend_Gdata_Books_VolumeFeed(); - $newVolumeFeed->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newVolumeFeed); - $newVolumeFeedXml = $newVolumeFeed->saveXML(); - $this->assertEquals($entryXml, $newVolumeFeedXml); - } - -} diff --git a/tests/Zend/Gdata/Books/_files/VolumeEntryDataSample1.xml b/tests/Zend/Gdata/Books/_files/VolumeEntryDataSample1.xml deleted file mode 100644 index 0b6cd9516..000000000 --- a/tests/Zend/Gdata/Books/_files/VolumeEntryDataSample1.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - http://www.google.com/books/feeds/volumes/Mfer_MFwQrkC - 2008-10-07T15:28:15.000Z - - Hamlet - - - - - - - - - Bad review... - William Shakespeare - Roma Gill - 2002-02 - Featuring the images of some of the world's most famous stage and film actors, these additions to the all-new Oxford School Shakespeare introduce--and enthrall--young people to one of the greatest writers of all time. This season brings revised editions of five of the Bard's most famous plays--As You Like It, Othello, Hamlet, Love's Labour Lost and The Taming of the Shrew. Designed specifically for students unfamiliar with Shakespeare's rich literary legacy, these new editions present Shakespeare's sometimes-intimidating Middle English in a way that is easy-to-read and engaging for ages twelve and up. The notes and introductions have been completely revised, allowing unprecedented clarity and accessibility. Featuring new covers and new illustrations--including photos from recent productions of Shakespeare's plays from around the world--Oxford School Shakespeare brings all the pleasure of these literary treasures to life. - 178 pages - Mfer_MFwQrkC - ISBN:0198320493 - en - Oxford University Press - Denmark - Hamlet (Legendary character)/ Drama - Murder victims' families/ Drama - Juvenile Nonfiction / Drama - Drama / English, Irish, Scottish, Welsh - Drama / Shakespeare - Hamlet - diff --git a/tests/Zend/Gdata/Books/_files/VolumeFeedDataSample1.xml b/tests/Zend/Gdata/Books/_files/VolumeFeedDataSample1.xml deleted file mode 100644 index 5f17aaa08..000000000 --- a/tests/Zend/Gdata/Books/_files/VolumeFeedDataSample1.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - http://www.google.com/books/feeds/volumes - 2008-10-07T16:41:52.000Z - - Search results for Hamlet - - - - - - - Google Books Search - http://www.google.com - - Google Book Search data API - 512 - 3 - 5 - - http://www.google.com/books/feeds/volumes/aCI_v2-QH04C - 2008-10-07T16:41:52.000Z - - Hamlet - - - - - - - - - William Shakespeare - Barbara Mowat - Paul Werstine - 2003-07-01 - Each edition includes:• Freshly edited text based on the best early printed version of the play• Full explanatory notes conveniently placed on pages facing... - 400 pages - aCI_v2-QH04C - ISBN:074347712X - Washington Square Press - Fiction - Hamlet - Prince of Denmark - - - http://www.google.com/books/feeds/volumes/VBoVAAAAYAAJ - 2008-10-07T16:41:52.000Z - - Hamlet - - - - - - - - - William Shakespeare - George Pierce Baker - 1913 - 219 pages - VBoVAAAAYAAJ - HARVARD:32044100887074 - Hamlet (Legendary character) - Hamlet - Prince of Denmark - - - http://www.google.com/books/feeds/volumes/S5YvAgAACAAJ - 2008-10-07T16:41:52.000Z - - Hamlet - - - - - - - - William Shakespeare - 1995-05-01 - Among Shakespeare&#39;s plays, &quot;Hamlet&quot; is considered by many hismasterpiece. - S5YvAgAACAAJ - ISBN:0811468259 - Heinemann/Raintree - Juvenile Fiction - Hamlet - - - http://www.google.com/books/feeds/volumes/Hxk3SFdOJr4C - 2008-10-07T16:41:52.000Z - - Hamlet - - - - - - - - - William Shakespeare - Alan Durband - 1987-05-01 - The significance of the plays is reinforced by sections discussing Shakespeare&#39;s life, works and theatre. - 336 pages - Hxk3SFdOJr4C - ISBN:0748703462 - Nelson Thornes Ltd - Drama - Hamlet - Shakespeare Made Easy - - - http://www.google.com/books/feeds/volumes/lZE0AAAAMAAJ - 2008-10-07T16:41:52.000Z - - Julius Caesar - - - - - - - - - William Shakespeare - Samuel Thurber - Arthur Wilson Verity - 1895 - Tan leather binding, gold-embossed, with gilt pattern insert and coat of arms on cover. - 123 pages - lZE0AAAAMAAJ - UOM:39015063516275 - Conspiracies - Julius Caesar - - diff --git a/tests/Zend/Gdata/BooksOnlineTest.php b/tests/Zend/Gdata/BooksOnlineTest.php deleted file mode 100644 index dcbc2aecc..000000000 --- a/tests/Zend/Gdata/BooksOnlineTest.php +++ /dev/null @@ -1,109 +0,0 @@ -gdata = new Zend_Gdata_Books($client); - } - - public function testGetVolumeFeed() - { - $query = $this->gdata->newVolumeQuery(); - $query->setQuery('Hamlet'); - $query->setStartIndex(5); - $query->setMaxResults(8); - $query->setMinViewability('partial_view'); - $feed = $this->gdata->getVolumeFeed($query); - - $this->assertTrue($feed instanceof Zend_Gdata_Books_VolumeFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Books_VolumeEntry); - $this->assertEquals($feed->getHttpClient(), $entry->getHttpClient()); - } - - $this->assertEquals(5, $feed->startIndex->text); - $this->assertEquals(8, $feed->itemsPerPage->text); - } - - public function testGetVolumetEntry() - { - $entry = $this->gdata->getVolumeEntry('Mfer_MFwQrkC'); - $this->assertTrue($entry instanceof Zend_Gdata_Books_VolumeEntry); - } - - public function testUserLibraryFeed() - { - $feed = $this->gdata->getUserLibraryFeed(); - $this->assertTrue($feed instanceof Zend_Gdata_Books_VolumeFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Books_VolumeEntry); - $this->assertEquals( - $feed->getHttpClient(), $entry->getHttpClient()); - } - - $entry = new Zend_Gdata_Books_VolumeEntry(); - $entry->setId(new Zend_Gdata_App_Extension_Id('Mfer_MFwQrkC')); - $newEntry = $this->gdata->insertVolume($entry); - $this->assertTrue($newEntry instanceof Zend_Gdata_Books_VolumeEntry); - $this->gdata->deleteVolume($newEntry); - } - - public function testUserAnnotationFeed() - { - $feed = $this->gdata->getUserAnnotationFeed(); - $this->assertTrue($feed instanceof Zend_Gdata_Books_VolumeFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Books_VolumeEntry); - $this->assertEquals( - $feed->getHttpClient(), $entry->getHttpClient()); - } - - $entry = new Zend_Gdata_Books_VolumeEntry(); - $entry->setId(new Zend_Gdata_App_Extension_Id('Mfer_MFwQrkC')); - $entry->setRating(new Zend_Gdata_Extension_Rating(3, 1, 5, 1)); - $newEntry = $this->gdata->insertVolume($entry, - Zend_Gdata_Books::MY_ANNOTATION_FEED_URI); - $this->assertTrue($newEntry instanceof Zend_Gdata_Books_VolumeEntry); - $this->gdata->deleteVolume($newEntry); - } -} diff --git a/tests/Zend/Gdata/BooksTest.php b/tests/Zend/Gdata/BooksTest.php deleted file mode 100644 index bf1226830..000000000 --- a/tests/Zend/Gdata/BooksTest.php +++ /dev/null @@ -1,49 +0,0 @@ -gdata = new Zend_Gdata_Books(new Zend_Http_Client()); - } - - public function testBooks() - { - $this->assertTrue(true); - } - -} diff --git a/tests/Zend/Gdata/Calendar/AccessLevelTest.php b/tests/Zend/Gdata/Calendar/AccessLevelTest.php deleted file mode 100644 index bff5f2a37..000000000 --- a/tests/Zend/Gdata/Calendar/AccessLevelTest.php +++ /dev/null @@ -1,125 +0,0 @@ -accessLevelText = file_get_contents( - 'Zend/Gdata/Calendar/_files/AccessLevelElementSample1.xml', - true); - $this->accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); - } - - public function testEmptyAccessLevelShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->accessLevel->extensionElements)); - $this->assertTrue(count($this->accessLevel->extensionElements) == 0); - } - - public function testEmptyAccessLevelShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->accessLevel->extensionAttributes)); - $this->assertTrue(count($this->accessLevel->extensionAttributes) == 0); - } - - public function testSampleAccessLevelShouldHaveNoExtensionElements() { - $this->accessLevel->transferFromXML($this->accessLevelText); - $this->assertTrue(is_array($this->accessLevel->extensionElements)); - $this->assertTrue(count($this->accessLevel->extensionElements) == 0); - } - - public function testSampleAccessLevelShouldHaveNoExtensionAttributes() { - $this->accessLevel->transferFromXML($this->accessLevelText); - $this->assertTrue(is_array($this->accessLevel->extensionAttributes)); - $this->assertTrue(count($this->accessLevel->extensionAttributes) == 0); - } - - public function testNormalAccessLevelShouldHaveNoExtensionElements() { - $this->accessLevel->value = 'freebusy'; - $this->assertEquals($this->accessLevel->value, 'freebusy'); - $this->assertEquals(count($this->accessLevel->extensionElements), 0); - $newAccessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); - $newAccessLevel->transferFromXML($this->accessLevel->saveXML()); - $this->assertEquals(count($newAccessLevel->extensionElements), 0); - $newAccessLevel->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newAccessLevel->extensionElements), 1); - $this->assertEquals($newAccessLevel->value, 'freebusy'); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newAccessLevel2 = $cal->newAccessLevel(); - $newAccessLevel2->transferFromXML($newAccessLevel->saveXML()); - $this->assertEquals(count($newAccessLevel2->extensionElements), 1); - $this->assertEquals($newAccessLevel2->value, 'freebusy'); - } - - public function testEmptyAccessLevelToAndFromStringShouldMatch() { - $accessLevelXml = $this->accessLevel->saveXML(); - $newAccessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); - $newAccessLevel->transferFromXML($accessLevelXml); - $newAccessLevelXml = $newAccessLevel->saveXML(); - $this->assertTrue($accessLevelXml == $newAccessLevelXml); - } - - public function testAccessLevelWithValueToAndFromStringShouldMatch() { - $this->accessLevel->value = 'freebusy'; - $accessLevelXml = $this->accessLevel->saveXML(); - $newAccessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); - $newAccessLevel->transferFromXML($accessLevelXml); - $newAccessLevelXml = $newAccessLevel->saveXML(); - $this->assertTrue($accessLevelXml == $newAccessLevelXml); - $this->assertEquals('freebusy', $newAccessLevel->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->accessLevel->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->accessLevel->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->accessLevel->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->accessLevel->extensionAttributes['foo2']['value']); - $accessLevelXml = $this->accessLevel->saveXML(); - $newAccessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); - $newAccessLevel->transferFromXML($accessLevelXml); - $this->assertEquals('bar', $newAccessLevel->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newAccessLevel->extensionAttributes['foo2']['value']); - } - - public function testConvertFullAccessLevelToAndFromString() { - $this->accessLevel->transferFromXML($this->accessLevelText); - $this->assertEquals($this->accessLevel->value, 'owner'); - } - -} diff --git a/tests/Zend/Gdata/Calendar/ColorTest.php b/tests/Zend/Gdata/Calendar/ColorTest.php deleted file mode 100644 index f369fb8db..000000000 --- a/tests/Zend/Gdata/Calendar/ColorTest.php +++ /dev/null @@ -1,125 +0,0 @@ -colorText = file_get_contents( - 'Zend/Gdata/Calendar/_files/ColorElementSample1.xml', - true); - $this->color = new Zend_Gdata_Calendar_Extension_Color(); - } - - public function testEmptyColorShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->color->extensionElements)); - $this->assertTrue(count($this->color->extensionElements) == 0); - } - - public function testEmptyColorShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->color->extensionAttributes)); - $this->assertTrue(count($this->color->extensionAttributes) == 0); - } - - public function testSampleColorShouldHaveNoExtensionElements() { - $this->color->transferFromXML($this->colorText); - $this->assertTrue(is_array($this->color->extensionElements)); - $this->assertTrue(count($this->color->extensionElements) == 0); - } - - public function testSampleColorShouldHaveNoExtensionAttributes() { - $this->color->transferFromXML($this->colorText); - $this->assertTrue(is_array($this->color->extensionAttributes)); - $this->assertTrue(count($this->color->extensionAttributes) == 0); - } - - public function testNormalColorShouldHaveNoExtensionElements() { - $this->color->value = '#abcdef'; - $this->assertEquals($this->color->value, '#abcdef'); - $this->assertEquals(count($this->color->extensionElements), 0); - $newColor = new Zend_Gdata_Calendar_Extension_Color(); - $newColor->transferFromXML($this->color->saveXML()); - $this->assertEquals(count($newColor->extensionElements), 0); - $newColor->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newColor->extensionElements), 1); - $this->assertEquals($newColor->value, '#abcdef'); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newColor2 = $cal->newColor(); - $newColor2->transferFromXML($newColor->saveXML()); - $this->assertEquals(count($newColor2->extensionElements), 1); - $this->assertEquals($newColor2->value, '#abcdef'); - } - - public function testEmptyColorToAndFromStringShouldMatch() { - $colorXml = $this->color->saveXML(); - $newColor = new Zend_Gdata_Calendar_Extension_Color(); - $newColor->transferFromXML($colorXml); - $newColorXml = $newColor->saveXML(); - $this->assertTrue($colorXml == $newColorXml); - } - - public function testColorWithValueToAndFromStringShouldMatch() { - $this->color->value = '#abcdef'; - $colorXml = $this->color->saveXML(); - $newColor = new Zend_Gdata_Calendar_Extension_Color(); - $newColor->transferFromXML($colorXml); - $newColorXml = $newColor->saveXML(); - $this->assertTrue($colorXml == $newColorXml); - $this->assertEquals('#abcdef', $newColor->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->color->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->color->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->color->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->color->extensionAttributes['foo2']['value']); - $colorXml = $this->color->saveXML(); - $newColor = new Zend_Gdata_Calendar_Extension_Color(); - $newColor->transferFromXML($colorXml); - $this->assertEquals('bar', $newColor->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newColor->extensionAttributes['foo2']['value']); - } - - public function testConvertFullColorToAndFromString() { - $this->color->transferFromXML($this->colorText); - $this->assertEquals($this->color->value, '#5A6986'); - } - -} diff --git a/tests/Zend/Gdata/Calendar/EventEntryTest.php b/tests/Zend/Gdata/Calendar/EventEntryTest.php deleted file mode 100644 index 56fdb0f9e..000000000 --- a/tests/Zend/Gdata/Calendar/EventEntryTest.php +++ /dev/null @@ -1,139 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Calendar/_files/EventEntrySample1.xml', - true); - $this->entry = new Zend_Gdata_Calendar_EventEntry(); - } - - public function testSetters() { - $entry = new Zend_Gdata_Calendar_EventEntry(); - $who = new Zend_Gdata_Extension_Who(); - $who->setValueString("John Doe"); - $who->setEmail("john@doe.com"); - $entry->setWho($who); - $whoRetrieved = $entry->getWho(); - $this->assertEquals("john@doe.com", $whoRetrieved->getEmail()); - $this->assertEquals("John Doe", $whoRetrieved->getValueString()); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyEventEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newEventEntry = new Zend_Gdata_Calendar_EventEntry(); - $newEventEntry->transferFromXML($entryXml); - $newEventEntryXml = $newEventEntry->saveXML(); - $this->assertTrue($entryXml == $newEventEntryXml); - } - - public function testConvertEventEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newEventEntry = new Zend_Gdata_Calendar_EventEntry(); - $newEventEntry->transferFromXML($entryXml); - $newEventEntryXml = $newEventEntry->saveXML(); - $this->assertEquals($entryXml, $newEventEntryXml); - $this->assertEquals('http://www.google.com/calendar/feeds/default/private/full/s0dtsvq4pe15ku09jideg67fv4_20070509T193000Z', - $newEventEntry->id->text); - $this->assertEquals('Mantek', - $newEventEntry->extendedProperty[0]->value); - $this->assertEquals('s0dtsvq4pe15ku09jideg67fv4', - $newEventEntry->originalEvent->id); - $this->assertEquals('s0dtsvq4pe15ku09jideg67fv4', - $newEventEntry->originalEvent->id); - $this->assertEquals('http://www.google.com/calendar/feeds/default/private/full/s0dtsvq4pe15ku09jideg67fv4_20070509T193000Z/comments', - $newEventEntry->comments->feedLink->href); - } - -/* - public function testEventEntryWithTextAndTypeToAndFromStringShouldMatch() { - $this->feed->text = ''; - $this->feed->type = 'xhtml'; - $feedXml = $this->feed->saveXML(); - $newEventEntry = new Zend_Gdata_App_EventEntry(); - $newEventEntry->transferFromXML($feedXml); - $newEventEntryXml = $newEventEntry->saveXML(); - $this->assertEquals($newEventEntryXml, $feedXml); - $this->assertEquals('', $newEventEntry->text); - $this->assertEquals('xhtml', $newEventEntry->type); - } - - public function testEventEntryWithSrcAndTypeToAndFromStringShouldMatch() { - $this->feed->src = 'http://www.example.com/image.png'; - $this->feed->type = 'image/png'; - $feedXml = $this->feed->saveXML(); - $newEventEntry = new Zend_Gdata_App_EventEntry(); - $newEventEntry->transferFromXML($feedXml); - $newEventEntryXml = $newEventEntry->saveXML(); - $this->assertEquals($newEventEntryXml, $feedXml); - $this->assertEquals('http://www.example.com/image.png', $newEventEntry->src); - $this->assertEquals('image/png', $newEventEntry->type); - } - - public function testConvertEventEntryWithSrcAndTypeToAndFromString() { - $this->feed->transferFromXML($this->feedText); - $this->assertEquals('http://www.example.com/image.png', $this->feed->src); - $this->assertEquals('image/png', $this->feed->type); - } -*/ - -} diff --git a/tests/Zend/Gdata/Calendar/EventQueryExceptionTest.php b/tests/Zend/Gdata/Calendar/EventQueryExceptionTest.php deleted file mode 100644 index 9d1cebadf..000000000 --- a/tests/Zend/Gdata/Calendar/EventQueryExceptionTest.php +++ /dev/null @@ -1,69 +0,0 @@ -query = new Zend_Gdata_Calendar_EventQuery(); - } - - /** - * @expectedException Zend_Gdata_App_Exception - */ - public function testSingleEventsThrowsExceptionOnSetInvalidValue() - { - $this->query->resetParameters(); - $singleEvents = 'puppy'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setSingleEvents($singleEvents); - } - - /** - * @expectedException Zend_Gdata_App_Exception - */ - public function testFutureEventsThrowsExceptionOnSetInvalidValue() - { - $this->query->resetParameters(); - $futureEvents = 'puppy'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setFutureEvents($futureEvents); - } - -} diff --git a/tests/Zend/Gdata/Calendar/EventQueryTest.php b/tests/Zend/Gdata/Calendar/EventQueryTest.php deleted file mode 100644 index 09a9bb1f1..000000000 --- a/tests/Zend/Gdata/Calendar/EventQueryTest.php +++ /dev/null @@ -1,271 +0,0 @@ -query = new Zend_Gdata_Calendar_EventQuery(); - } - - public function testDefaultBaseUrlForQuery() - { - $queryUrl = $this->query->getQueryUrl(); - $this->assertEquals('https://www.google.com/calendar/feeds/default/public/full', - $queryUrl); - } - - public function testAlternateBaseUrlForQuery() - { - $this->query = new Zend_Gdata_Calendar_EventQuery('http://www.foo.com'); - $queryUrl = $this->query->getQueryUrl(); - // the URL passed in the constructor has the user, visibility - // projection appended for the return value of $query->getQueryUrl() - $this->assertEquals('http://www.foo.com/default/public/full', $queryUrl); - } - - public function testUpdatedMinMaxParam() - { - $updatedMin = '2006-09-20'; - $updatedMax = '2006-11-05'; - $this->query->resetParameters(); - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setUpdatedMin($updatedMin); - $this->query->setUpdatedMax($updatedMax); - $this->assertTrue($this->query->updatedMin != null); - $this->assertTrue($this->query->updatedMax != null); - $this->assertTrue($this->query->user != null); - $this->assertEquals(Zend_Gdata_App_Util::formatTimestamp($updatedMin), $this->query->getUpdatedMin()); - $this->assertEquals(Zend_Gdata_App_Util::formatTimestamp($updatedMax), $this->query->getUpdatedMax()); - $this->assertEquals(self::GOOGLE_DEVELOPER_CALENDAR, $this->query->getUser()); - - $this->query->updatedMin = null; - $this->assertFalse($this->query->updatedMin != null); - $this->query->updatedMax = null; - $this->assertFalse($this->query->updatedMax != null); - $this->query->user = null; - $this->assertFalse($this->query->user != null); - } - - public function testStartMinMaxParam() - { - $this->query->resetParameters(); - $startMin = '2006-10-30'; - $startMax = '2006-11-01'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setStartMin($startMin); - $this->query->setStartMax($startMax); - $this->assertTrue($this->query->startMin != null); - $this->assertTrue($this->query->startMax != null); - $this->assertEquals(Zend_Gdata_App_Util::formatTimestamp($startMin), $this->query->getStartMin()); - $this->assertEquals(Zend_Gdata_App_Util::formatTimestamp($startMax), $this->query->getStartMax()); - - $this->query->startMin = null; - $this->assertFalse($this->query->startMin != null); - $this->query->startMax = null; - $this->assertFalse($this->query->startMax != null); - $this->query->user = null; - $this->assertFalse($this->query->user != null); - } - - public function testVisibilityParam() - { - $this->query->resetParameters(); - $visibility = 'private'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setVisibility($visibility); - $this->assertTrue($this->query->visibility != null); - $this->assertEquals($visibility, $this->query->getVisibility()); - $this->query->visibility = null; - $this->assertFalse($this->query->visibility != null); - } - - public function testProjectionParam() - { - $this->query->resetParameters(); - $projection = 'composite'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setProjection($projection); - $this->assertTrue($this->query->projection != null); - $this->assertEquals($projection, $this->query->getProjection()); - $this->query->projection = null; - $this->assertFalse($this->query->projection != null); - } - - public function testOrderbyParam() - { - $this->query->resetParameters(); - $orderby = 'starttime'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setOrderby($orderby); - $this->assertTrue($this->query->orderby != null); - $this->assertEquals($orderby, $this->query->getOrderby()); - $this->query->orderby = null; - $this->assertFalse($this->query->orderby != null); - } - - public function testEventParam() - { - $this->query->resetParameters(); - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setEvent(self::ZEND_CONFERENCE_EVENT); - $this->assertTrue($this->query->event != null); - $this->assertEquals(self::ZEND_CONFERENCE_EVENT, $this->query->getEvent()); - $this->query->event = null; - $this->assertFalse($this->query->event != null); - } - - public function testCommentsParam() - { - $this->query->resetParameters(); - $comment = 'we need to reschedule'; - $this->query->setComments($comment); - $this->assertTrue($this->query->comments != null); - $this->assertEquals($comment, $this->query->getComments()); - $this->query->comments = null; - $this->assertFalse(isset($this->query->comments)); - } - - public function testSortOrder() - { - $this->query->resetParameters(); - $sortOrder = 'ascending'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setSortOrder($sortOrder); - $this->assertTrue($this->query->sortOrder != null); - $this->assertEquals($sortOrder, $this->query->getSortOrder()); - $this->query->sortOrder = null; - $this->assertFalse($this->query->sortOrder != null); - } - - public function testRecurrenceExpansionStart() - { - $this->query->resetParameters(); - $res = self::SAMPLE_RFC3339; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setRecurrenceExpansionStart($res); - $this->assertTrue($this->query->recurrenceExpansionStart != null); - $this->assertEquals($res, $this->query->getRecurrenceExpansionStart()); - $this->query->recurrenceExpansionStart = null; - $this->assertFalse($this->query->recurrenceExpansionStart != null); - } - - public function testRecurrenceExpansionEnd() - { - $this->query->resetParameters(); - $ree = self::SAMPLE_RFC3339; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setRecurrenceExpansionEnd($ree); - $this->assertTrue($this->query->recurrenceExpansionEnd != null); - $this->assertEquals($ree, $this->query->getRecurrenceExpansionEnd()); - $this->query->recurrenceExpansionEnd = null; - $this->assertFalse($this->query->recurrenceExpansionEnd != null); - } - - public function testSingleEvents() - { - $this->query->resetParameters(); - // Test string handling - $singleEvents = 'true'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setSingleEvents($singleEvents); - $this->assertTrue($this->query->singleEvents === true); - // Test bool handling - $singleEvents = false; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setSingleEvents($singleEvents); - $this->assertTrue($this->query->singleEvents === false); - // Test unsetting - $this->assertEquals($singleEvents, $this->query->getSingleEvents()); - $this->query->setSingleEvents(null); - $this->assertFalse($this->query->singleEvents != null); - } - - public function testFutureEvents() - { - $this->query->resetParameters(); - // Test string handling - $singleEvents = 'true'; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setFutureEvents($singleEvents); - $this->assertTrue($this->query->futureEvents === true); - // Test bool handling - $singleEvents = false; - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setFutureEvents($singleEvents); - $this->assertTrue($this->query->futureEvents === false); - // Test unsetting - $this->query->futureEvents = null; - $this->assertFalse($this->query->futureEvents != null); - - } - - public function testCustomQueryURIGeneration() - { - $this->query->resetParameters(); - $this->query->setUser(self::GOOGLE_DEVELOPER_CALENDAR); - $this->query->setVisibility("private"); - $this->query->setProjection("composite"); - $this->query->setEvent(self::ZEND_CONFERENCE_EVENT); - $this->query->setComments(self::ZEND_CONFERENCE_EVENT_COMMENT); - $this->assertEquals("https://www.google.com/calendar/feeds/developer-calendar@google.com/private/composite/" . - self::ZEND_CONFERENCE_EVENT . "/comments/" . self::ZEND_CONFERENCE_EVENT_COMMENT, - $this->query->getQueryUrl()); - } - - public function testDefaultQueryURIGeneration() - { - $this->query->resetParameters(); - $this->assertEquals("https://www.google.com/calendar/feeds/default/public/full", - $this->query->getQueryUrl()); - } - - public function testCanNullifyParameters() - { - $testURI = "http://www.google.com/calendar/feeds/foo%40group.calendar.google.com/private/full"; - $this->query = new Zend_Gdata_Calendar_EventQuery($testURI); - $this->query->setUser(null); - $this->query->setVisibility(null); - $this->query->setProjection(null); - $result = $this->query->getQueryUrl(); - $this->assertEquals($testURI, $result); - } -} diff --git a/tests/Zend/Gdata/Calendar/HiddenTest.php b/tests/Zend/Gdata/Calendar/HiddenTest.php deleted file mode 100644 index e7397bf0f..000000000 --- a/tests/Zend/Gdata/Calendar/HiddenTest.php +++ /dev/null @@ -1,125 +0,0 @@ -hiddenText = file_get_contents( - 'Zend/Gdata/Calendar/_files/HiddenElementSample1.xml', - true); - $this->hidden = new Zend_Gdata_Calendar_Extension_Hidden(); - } - - public function testEmptyHiddenShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->hidden->extensionElements)); - $this->assertTrue(count($this->hidden->extensionElements) == 0); - } - - public function testEmptyHiddenShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->hidden->extensionAttributes)); - $this->assertTrue(count($this->hidden->extensionAttributes) == 0); - } - - public function testSampleHiddenShouldHaveNoExtensionElements() { - $this->hidden->transferFromXML($this->hiddenText); - $this->assertTrue(is_array($this->hidden->extensionElements)); - $this->assertTrue(count($this->hidden->extensionElements) == 0); - } - - public function testSampleHiddenShouldHaveNoExtensionAttributes() { - $this->hidden->transferFromXML($this->hiddenText); - $this->assertTrue(is_array($this->hidden->extensionAttributes)); - $this->assertTrue(count($this->hidden->extensionAttributes) == 0); - } - - public function testNormalHiddenShouldHaveNoExtensionElements() { - $this->hidden->value = true; - $this->assertEquals($this->hidden->value, true); - $this->assertEquals(count($this->hidden->extensionElements), 0); - $newHidden = new Zend_Gdata_Calendar_Extension_Hidden(); - $newHidden->transferFromXML($this->hidden->saveXML()); - $this->assertEquals(count($newHidden->extensionElements), 0); - $newHidden->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newHidden->extensionElements), 1); - $this->assertEquals($newHidden->value, true); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newHidden2 = $cal->newHidden(); - $newHidden2->transferFromXML($newHidden->saveXML()); - $this->assertEquals(count($newHidden2->extensionElements), 1); - $this->assertEquals($newHidden2->value, true); - } - - public function testEmptyHiddenToAndFromStringShouldMatch() { - $hiddenXml = $this->hidden->saveXML(); - $newHidden = new Zend_Gdata_Calendar_Extension_Hidden(); - $newHidden->transferFromXML($hiddenXml); - $newHiddenXml = $newHidden->saveXML(); - $this->assertTrue($hiddenXml == $newHiddenXml); - } - - public function testHiddenWithValueToAndFromStringShouldMatch() { - $this->hidden->value = true; - $hiddenXml = $this->hidden->saveXML(); - $newHidden = new Zend_Gdata_Calendar_Extension_Hidden(); - $newHidden->transferFromXML($hiddenXml); - $newHiddenXml = $newHidden->saveXML(); - $this->assertTrue($hiddenXml == $newHiddenXml); - $this->assertEquals(true, $newHidden->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->hidden->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->hidden->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->hidden->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->hidden->extensionAttributes['foo2']['value']); - $hiddenXml = $this->hidden->saveXML(); - $newHidden = new Zend_Gdata_Calendar_Extension_Hidden(); - $newHidden->transferFromXML($hiddenXml); - $this->assertEquals('bar', $newHidden->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newHidden->extensionAttributes['foo2']['value']); - } - - public function testConvertFullHiddenToAndFromString() { - $this->hidden->transferFromXML($this->hiddenText); - $this->assertEquals($this->hidden->value, false); - } - -} diff --git a/tests/Zend/Gdata/Calendar/LinkTest.php b/tests/Zend/Gdata/Calendar/LinkTest.php deleted file mode 100644 index d530ce6e0..000000000 --- a/tests/Zend/Gdata/Calendar/LinkTest.php +++ /dev/null @@ -1,166 +0,0 @@ -linkText = file_get_contents( - 'Zend/Gdata/Calendar/_files/LinkElementSample1.xml', - true); - $this->link = new Zend_Gdata_Calendar_Extension_Link(); - } - - public function testEmptyLinkShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->link->extensionElements)); - $this->assertTrue(count($this->link->extensionElements) == 0); - } - - public function testEmptyLinkShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->link->extensionAttributes)); - $this->assertTrue(count($this->link->extensionAttributes) == 0); - } - - public function testSampleLinkShouldHaveNoExtensionElements() { - $this->link->transferFromXML($this->linkText); - $this->assertTrue(is_array($this->link->extensionElements)); - $this->assertTrue(count($this->link->extensionElements) == 0); - } - - public function testSampleLinkShouldHaveNoExtensionAttributes() { - $this->link->transferFromXML($this->linkText); - $this->assertTrue(is_array($this->link->extensionAttributes)); - $this->assertTrue(count($this->link->extensionAttributes) == 0); - } - - public function testNormalLinkShouldHaveNoExtensionElements() { - $this->link->rel = "http://nowhere.invalid/"; - $this->link->title = "Somewhere"; - $this->link->href = "http://somewhere.invalid/"; - $this->link->type = "text/plain"; - $this->link->webContent = new Zend_Gdata_Calendar_Extension_WebContent("a", "1", "2"); - - $this->assertEquals($this->link->rel, "http://nowhere.invalid/"); - $this->assertEquals($this->link->title, "Somewhere"); - $this->assertEquals($this->link->href, "http://somewhere.invalid/"); - $this->assertEquals($this->link->type, "text/plain"); - $this->assertEquals($this->link->webcontent->url, "a"); - $this->assertEquals($this->link->webcontent->height, "1"); - $this->assertEquals($this->link->webcontent->width, "2"); - - $this->assertEquals(count($this->link->extensionElements), 0); - $newLink = new Zend_Gdata_Calendar_Extension_Link(); - $newLink->transferFromXML($this->link->saveXML()); - $this->assertEquals(count($newLink->extensionElements), 0); - $newLink->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newLink->extensionElements), 1); - $this->assertEquals($newLink->rel, "http://nowhere.invalid/"); - $this->assertEquals($newLink->title, "Somewhere"); - $this->assertEquals($newLink->href, "http://somewhere.invalid/"); - $this->assertEquals($newLink->type, "text/plain"); - $this->assertEquals($newLink->webcontent->url, "a"); - $this->assertEquals($newLink->webcontent->height, "1"); - $this->assertEquals($newLink->webcontent->width, "2"); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newLink2 = $cal->newLink(); - $newLink2->transferFromXML($newLink->saveXML()); - $this->assertEquals(count($newLink2->extensionElements), 1); - $this->assertEquals($newLink2->rel, "http://nowhere.invalid/"); - $this->assertEquals($newLink2->title, "Somewhere"); - $this->assertEquals($newLink2->href, "http://somewhere.invalid/"); - $this->assertEquals($newLink2->type, "text/plain"); - $this->assertEquals($newLink2->webcontent->url, "a"); - $this->assertEquals($newLink2->webcontent->height, "1"); - $this->assertEquals($newLink2->webcontent->width, "2"); - } - - public function testEmptyLinkToAndFromStringShouldMatch() { - $linkXml = $this->link->saveXML(); - $newLink = new Zend_Gdata_Calendar_Extension_Link(); - $newLink->transferFromXML($linkXml); - $newLinkXml = $newLink->saveXML(); - $this->assertTrue($linkXml == $newLinkXml); - } - - public function testLinkWithValueToAndFromStringShouldMatch() { - $this->link->rel = "http://nowhere.invalid/"; - $this->link->title = "Somewhere"; - $this->link->href = "http://somewhere.invalid/"; - $this->link->type = "text/plain"; - $this->link->webContent = new Zend_Gdata_Calendar_Extension_WebContent("a", "1", "2"); - $linkXml = $this->link->saveXML(); - $newLink = new Zend_Gdata_Calendar_Extension_Link(); - $newLink->transferFromXML($linkXml); - $newLinkXml = $newLink->saveXML(); - $this->assertTrue($linkXml == $newLinkXml); - $this->assertEquals($this->link->rel, "http://nowhere.invalid/"); - $this->assertEquals($this->link->title, "Somewhere"); - $this->assertEquals($this->link->href, "http://somewhere.invalid/"); - $this->assertEquals($this->link->type, "text/plain"); - $this->assertEquals($this->link->webcontent->url, "a"); - $this->assertEquals($this->link->webcontent->height, "1"); - $this->assertEquals($this->link->webcontent->width, "2"); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->link->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->link->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->link->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->link->extensionAttributes['foo2']['value']); - $linkXml = $this->link->saveXML(); - $newLink = new Zend_Gdata_Calendar_Extension_Link(); - $newLink->transferFromXML($linkXml); - $this->assertEquals('bar', $newLink->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newLink->extensionAttributes['foo2']['value']); - } - - public function testConvertFullLinkToAndFromString() { - $this->link->transferFromXML($this->linkText); - $this->assertEquals($this->link->rel, "http://schemas.google.com/gCal/2005/webContent"); - $this->assertEquals($this->link->title, "Independence Day"); - $this->assertEquals($this->link->href, "http://www.google.com/calendar/images/google-holiday.gif"); - $this->assertEquals($this->link->type, "image/gif"); - $this->assertEquals($this->link->webcontent->url, "http://www.google.com/logos/july4th06.gif"); - $this->assertEquals($this->link->webcontent->height, "120"); - $this->assertEquals($this->link->webcontent->width, "276"); - } - -} diff --git a/tests/Zend/Gdata/Calendar/QuickAddTest.php b/tests/Zend/Gdata/Calendar/QuickAddTest.php deleted file mode 100644 index e5f048b5b..000000000 --- a/tests/Zend/Gdata/Calendar/QuickAddTest.php +++ /dev/null @@ -1,125 +0,0 @@ -quickAddText = file_get_contents( - 'Zend/Gdata/Calendar/_files/QuickAddElementSample1.xml', - true); - $this->quickAdd = new Zend_Gdata_Calendar_Extension_QuickAdd(); - } - - public function testEmptyQuickAddShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->quickAdd->extensionElements)); - $this->assertTrue(count($this->quickAdd->extensionElements) == 0); - } - - public function testEmptyQuickAddShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->quickAdd->extensionAttributes)); - $this->assertTrue(count($this->quickAdd->extensionAttributes) == 0); - } - - public function testSampleQuickAddShouldHaveNoExtensionElements() { - $this->quickAdd->transferFromXML($this->quickAddText); - $this->assertTrue(is_array($this->quickAdd->extensionElements)); - $this->assertTrue(count($this->quickAdd->extensionElements) == 0); - } - - public function testSampleQuickAddShouldHaveNoExtensionAttributes() { - $this->quickAdd->transferFromXML($this->quickAddText); - $this->assertTrue(is_array($this->quickAdd->extensionAttributes)); - $this->assertTrue(count($this->quickAdd->extensionAttributes) == 0); - } - - public function testNormalQuickAddShouldHaveNoExtensionElements() { - $this->quickAdd->value = false; - $this->assertEquals($this->quickAdd->value, false); - $this->assertEquals(count($this->quickAdd->extensionElements), 0); - $newQuickAdd = new Zend_Gdata_Calendar_Extension_QuickAdd(); - $newQuickAdd->transferFromXML($this->quickAdd->saveXML()); - $this->assertEquals(count($newQuickAdd->extensionElements), 0); - $newQuickAdd->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newQuickAdd->extensionElements), 1); - $this->assertEquals($newQuickAdd->value, false); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newQuickAdd2 = $cal->newQuickAdd(); - $newQuickAdd2->transferFromXML($newQuickAdd->saveXML()); - $this->assertEquals(count($newQuickAdd2->extensionElements), 1); - $this->assertEquals($newQuickAdd2->value, false); - } - - public function testEmptyQuickAddToAndFromStringShouldMatch() { - $quickAddXml = $this->quickAdd->saveXML(); - $newQuickAdd = new Zend_Gdata_Calendar_Extension_QuickAdd(); - $newQuickAdd->transferFromXML($quickAddXml); - $newQuickAddXml = $newQuickAdd->saveXML(); - $this->assertTrue($quickAddXml == $newQuickAddXml); - } - - public function testQuickAddWithValueToAndFromStringShouldMatch() { - $this->quickAdd->value = false; - $quickAddXml = $this->quickAdd->saveXML(); - $newQuickAdd = new Zend_Gdata_Calendar_Extension_QuickAdd(); - $newQuickAdd->transferFromXML($quickAddXml); - $newQuickAddXml = $newQuickAdd->saveXML(); - $this->assertTrue($quickAddXml == $newQuickAddXml); - $this->assertEquals(false, $newQuickAdd->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->quickAdd->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->quickAdd->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->quickAdd->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->quickAdd->extensionAttributes['foo2']['value']); - $quickAddXml = $this->quickAdd->saveXML(); - $newQuickAdd = new Zend_Gdata_Calendar_Extension_QuickAdd(); - $newQuickAdd->transferFromXML($quickAddXml); - $this->assertEquals('bar', $newQuickAdd->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newQuickAdd->extensionAttributes['foo2']['value']); - } - - public function testConvertFullQuickAddToAndFromString() { - $this->quickAdd->transferFromXML($this->quickAddText); - $this->assertEquals($this->quickAdd->value, true); - } - -} diff --git a/tests/Zend/Gdata/Calendar/SelectedTest.php b/tests/Zend/Gdata/Calendar/SelectedTest.php deleted file mode 100644 index 2b9b5b76c..000000000 --- a/tests/Zend/Gdata/Calendar/SelectedTest.php +++ /dev/null @@ -1,125 +0,0 @@ -selectedText = file_get_contents( - 'Zend/Gdata/Calendar/_files/SelectedElementSample1.xml', - true); - $this->selected = new Zend_Gdata_Calendar_Extension_Selected(); - } - - public function testEmptySelectedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->selected->extensionElements)); - $this->assertTrue(count($this->selected->extensionElements) == 0); - } - - public function testEmptySelectedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->selected->extensionAttributes)); - $this->assertTrue(count($this->selected->extensionAttributes) == 0); - } - - public function testSampleSelectedShouldHaveNoExtensionElements() { - $this->selected->transferFromXML($this->selectedText); - $this->assertTrue(is_array($this->selected->extensionElements)); - $this->assertTrue(count($this->selected->extensionElements) == 0); - } - - public function testSampleSelectedShouldHaveNoExtensionAttributes() { - $this->selected->transferFromXML($this->selectedText); - $this->assertTrue(is_array($this->selected->extensionAttributes)); - $this->assertTrue(count($this->selected->extensionAttributes) == 0); - } - - public function testNormalSelectedShouldHaveNoExtensionElements() { - $this->selected->value = true; - $this->assertEquals($this->selected->value, true); - $this->assertEquals(count($this->selected->extensionElements), 0); - $newSelected = new Zend_Gdata_Calendar_Extension_Selected(); - $newSelected->transferFromXML($this->selected->saveXML()); - $this->assertEquals(count($newSelected->extensionElements), 0); - $newSelected->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newSelected->extensionElements), 1); - $this->assertEquals($newSelected->value, true); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newSelected2 = $cal->newSelected(); - $newSelected2->transferFromXML($newSelected->saveXML()); - $this->assertEquals(count($newSelected2->extensionElements), 1); - $this->assertEquals($newSelected2->value, true); - } - - public function testEmptySelectedToAndFromStringShouldMatch() { - $selectedXml = $this->selected->saveXML(); - $newSelected = new Zend_Gdata_Calendar_Extension_Selected(); - $newSelected->transferFromXML($selectedXml); - $newSelectedXml = $newSelected->saveXML(); - $this->assertTrue($selectedXml == $newSelectedXml); - } - - public function testSelectedWithValueToAndFromStringShouldMatch() { - $this->selected->value = true; - $selectedXml = $this->selected->saveXML(); - $newSelected = new Zend_Gdata_Calendar_Extension_Selected(); - $newSelected->transferFromXML($selectedXml); - $newSelectedXml = $newSelected->saveXML(); - $this->assertTrue($selectedXml == $newSelectedXml); - $this->assertEquals(true, $newSelected->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->selected->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->selected->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->selected->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->selected->extensionAttributes['foo2']['value']); - $selectedXml = $this->selected->saveXML(); - $newSelected = new Zend_Gdata_Calendar_Extension_Selected(); - $newSelected->transferFromXML($selectedXml); - $this->assertEquals('bar', $newSelected->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newSelected->extensionAttributes['foo2']['value']); - } - - public function testConvertFullSelectedToAndFromString() { - $this->selected->transferFromXML($this->selectedText); - $this->assertEquals($this->selected->value, false); - } - -} diff --git a/tests/Zend/Gdata/Calendar/SendEventNotificationsTest.php b/tests/Zend/Gdata/Calendar/SendEventNotificationsTest.php deleted file mode 100644 index 4076bf291..000000000 --- a/tests/Zend/Gdata/Calendar/SendEventNotificationsTest.php +++ /dev/null @@ -1,125 +0,0 @@ -sendEventNotificationsText = file_get_contents( - 'Zend/Gdata/Calendar/_files/SendEventNotificationsElementSample1.xml', - true); - $this->sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); - } - - public function testEmptySendEventNotificationsShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->sendEventNotifications->extensionElements)); - $this->assertTrue(count($this->sendEventNotifications->extensionElements) == 0); - } - - public function testEmptySendEventNotificationsShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->sendEventNotifications->extensionAttributes)); - $this->assertTrue(count($this->sendEventNotifications->extensionAttributes) == 0); - } - - public function testSampleSendEventNotificationsShouldHaveNoExtensionElements() { - $this->sendEventNotifications->transferFromXML($this->sendEventNotificationsText); - $this->assertTrue(is_array($this->sendEventNotifications->extensionElements)); - $this->assertTrue(count($this->sendEventNotifications->extensionElements) == 0); - } - - public function testSampleSendEventNotificationsShouldHaveNoExtensionAttributes() { - $this->sendEventNotifications->transferFromXML($this->sendEventNotificationsText); - $this->assertTrue(is_array($this->sendEventNotifications->extensionAttributes)); - $this->assertTrue(count($this->sendEventNotifications->extensionAttributes) == 0); - } - - public function testNormalSendEventNotificationsShouldHaveNoExtensionElements() { - $this->sendEventNotifications->value = true; - $this->assertEquals($this->sendEventNotifications->value, true); - $this->assertEquals(count($this->sendEventNotifications->extensionElements), 0); - $newSendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); - $newSendEventNotifications->transferFromXML($this->sendEventNotifications->saveXML()); - $this->assertEquals(count($newSendEventNotifications->extensionElements), 0); - $newSendEventNotifications->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newSendEventNotifications->extensionElements), 1); - $this->assertEquals($newSendEventNotifications->value, true); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newSendEventNotifications2 = $cal->newSendEventNotifications(); - $newSendEventNotifications2->transferFromXML($newSendEventNotifications->saveXML()); - $this->assertEquals(count($newSendEventNotifications2->extensionElements), 1); - $this->assertEquals($newSendEventNotifications2->value, true); - } - - public function testEmptySendEventNotificationsToAndFromStringShouldMatch() { - $sendEventNotificationsXml = $this->sendEventNotifications->saveXML(); - $newSendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); - $newSendEventNotifications->transferFromXML($sendEventNotificationsXml); - $newSendEventNotificationsXml = $newSendEventNotifications->saveXML(); - $this->assertTrue($sendEventNotificationsXml == $newSendEventNotificationsXml); - } - - public function testSendEventNotificationsWithValueToAndFromStringShouldMatch() { - $this->sendEventNotifications->value = true; - $sendEventNotificationsXml = $this->sendEventNotifications->saveXML(); - $newSendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); - $newSendEventNotifications->transferFromXML($sendEventNotificationsXml); - $newSendEventNotificationsXml = $newSendEventNotifications->saveXML(); - $this->assertTrue($sendEventNotificationsXml == $newSendEventNotificationsXml); - $this->assertEquals(true, $newSendEventNotifications->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->sendEventNotifications->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->sendEventNotifications->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->sendEventNotifications->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->sendEventNotifications->extensionAttributes['foo2']['value']); - $sendEventNotificationsXml = $this->sendEventNotifications->saveXML(); - $newSendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); - $newSendEventNotifications->transferFromXML($sendEventNotificationsXml); - $this->assertEquals('bar', $newSendEventNotifications->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newSendEventNotifications->extensionAttributes['foo2']['value']); - } - - public function testConvertFullSendEventNotificationsToAndFromString() { - $this->sendEventNotifications->transferFromXML($this->sendEventNotificationsText); - $this->assertEquals($this->sendEventNotifications->value, false); - } - -} diff --git a/tests/Zend/Gdata/Calendar/TimezoneTest.php b/tests/Zend/Gdata/Calendar/TimezoneTest.php deleted file mode 100644 index f1ee9788e..000000000 --- a/tests/Zend/Gdata/Calendar/TimezoneTest.php +++ /dev/null @@ -1,125 +0,0 @@ -timezoneText = file_get_contents( - 'Zend/Gdata/Calendar/_files/TimezoneElementSample1.xml', - true); - $this->timezone = new Zend_Gdata_Calendar_Extension_Timezone(); - } - - public function testEmptyTimezoneShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->timezone->extensionElements)); - $this->assertTrue(count($this->timezone->extensionElements) == 0); - } - - public function testEmptyTimezoneShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->timezone->extensionAttributes)); - $this->assertTrue(count($this->timezone->extensionAttributes) == 0); - } - - public function testSampleTimezoneShouldHaveNoExtensionElements() { - $this->timezone->transferFromXML($this->timezoneText); - $this->assertTrue(is_array($this->timezone->extensionElements)); - $this->assertTrue(count($this->timezone->extensionElements) == 0); - } - - public function testSampleTimezoneShouldHaveNoExtensionAttributes() { - $this->timezone->transferFromXML($this->timezoneText); - $this->assertTrue(is_array($this->timezone->extensionAttributes)); - $this->assertTrue(count($this->timezone->extensionAttributes) == 0); - } - - public function testNormalTimezoneShouldHaveNoExtensionElements() { - $this->timezone->value = "America/Chicago"; - $this->assertEquals($this->timezone->value, "America/Chicago"); - $this->assertEquals(count($this->timezone->extensionElements), 0); - $newTimezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $newTimezone->transferFromXML($this->timezone->saveXML()); - $this->assertEquals(count($newTimezone->extensionElements), 0); - $newTimezone->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newTimezone->extensionElements), 1); - $this->assertEquals($newTimezone->value, "America/Chicago"); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newTimezone2 = $cal->newTimezone(); - $newTimezone2->transferFromXML($newTimezone->saveXML()); - $this->assertEquals(count($newTimezone2->extensionElements), 1); - $this->assertEquals($newTimezone2->value, "America/Chicago"); - } - - public function testEmptyTimezoneToAndFromStringShouldMatch() { - $timezoneXml = $this->timezone->saveXML(); - $newTimezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $newTimezone->transferFromXML($timezoneXml); - $newTimezoneXml = $newTimezone->saveXML(); - $this->assertTrue($timezoneXml == $newTimezoneXml); - } - - public function testTimezoneWithValueToAndFromStringShouldMatch() { - $this->timezone->value = "America/Chicago"; - $timezoneXml = $this->timezone->saveXML(); - $newTimezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $newTimezone->transferFromXML($timezoneXml); - $newTimezoneXml = $newTimezone->saveXML(); - $this->assertTrue($timezoneXml == $newTimezoneXml); - $this->assertEquals("America/Chicago", $newTimezone->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->timezone->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->timezone->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->timezone->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->timezone->extensionAttributes['foo2']['value']); - $timezoneXml = $this->timezone->saveXML(); - $newTimezone = new Zend_Gdata_Calendar_Extension_Timezone(); - $newTimezone->transferFromXML($timezoneXml); - $this->assertEquals('bar', $newTimezone->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newTimezone->extensionAttributes['foo2']['value']); - } - - public function testConvertFullTimezoneToAndFromString() { - $this->timezone->transferFromXML($this->timezoneText); - $this->assertEquals($this->timezone->value, "America/Los_Angeles"); - } - -} diff --git a/tests/Zend/Gdata/Calendar/WebContentTest.php b/tests/Zend/Gdata/Calendar/WebContentTest.php deleted file mode 100644 index 6f77f153e..000000000 --- a/tests/Zend/Gdata/Calendar/WebContentTest.php +++ /dev/null @@ -1,141 +0,0 @@ -webContentText = file_get_contents( - 'Zend/Gdata/Calendar/_files/WebContentElementSample1.xml', - true); - $this->webContent = new Zend_Gdata_Calendar_Extension_WebContent(); - } - - public function testEmptyWebContentShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->webContent->extensionElements)); - $this->assertTrue(count($this->webContent->extensionElements) == 0); - } - - public function testEmptyWebContentShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->webContent->extensionAttributes)); - $this->assertTrue(count($this->webContent->extensionAttributes) == 0); - } - - public function testSampleWebContentShouldHaveNoExtensionElements() { - $this->webContent->transferFromXML($this->webContentText); - $this->assertTrue(is_array($this->webContent->extensionElements)); - $this->assertTrue(count($this->webContent->extensionElements) == 0); - } - - public function testSampleWebContentShouldHaveNoExtensionAttributes() { - $this->webContent->transferFromXML($this->webContentText); - $this->assertTrue(is_array($this->webContent->extensionAttributes)); - $this->assertTrue(count($this->webContent->extensionAttributes) == 0); - } - - public function testNormalWebContentShouldHaveNoExtensionElements() { - $this->webContent->url = "http://nowhere.invalid/"; - $this->webContent->height = "100"; - $this->webContent->width = "200"; - - $this->assertEquals($this->webContent->url, "http://nowhere.invalid/"); - $this->assertEquals($this->webContent->height, "100"); - $this->assertEquals($this->webContent->width, "200"); - - $this->assertEquals(count($this->webContent->extensionElements), 0); - $newWebContent = new Zend_Gdata_Calendar_Extension_WebContent(); - $newWebContent->transferFromXML($this->webContent->saveXML()); - $this->assertEquals(count($newWebContent->extensionElements), 0); - $newWebContent->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(count($newWebContent->extensionElements), 1); - $this->assertEquals($newWebContent->url, "http://nowhere.invalid/"); - $this->assertEquals($newWebContent->height, "100"); - $this->assertEquals($newWebContent->width, "200"); - - /* try constructing using magic factory */ - $cal = new Zend_Gdata_Calendar(); - $newWebContent2 = $cal->newWebContent(); - $newWebContent2->transferFromXML($newWebContent->saveXML()); - $this->assertEquals(count($newWebContent2->extensionElements), 1); - $this->assertEquals($newWebContent2->url, "http://nowhere.invalid/"); - $this->assertEquals($newWebContent2->height, "100"); - $this->assertEquals($newWebContent2->width, "200"); - } - - public function testEmptyWebContentToAndFromStringShouldMatch() { - $webContentXml = $this->webContent->saveXML(); - $newWebContent = new Zend_Gdata_Calendar_Extension_WebContent(); - $newWebContent->transferFromXML($webContentXml); - $newWebContentXml = $newWebContent->saveXML(); - $this->assertTrue($webContentXml == $newWebContentXml); - } - - public function testWebContentWithValueToAndFromStringShouldMatch() { - $this->webContent->url = "http://nowhere.invalid/"; - $this->webContent->height = "100"; - $this->webContent->width = "200"; - $webContentXml = $this->webContent->saveXML(); - $newWebContent = new Zend_Gdata_Calendar_Extension_WebContent(); - $newWebContent->transferFromXML($webContentXml); - $newWebContentXml = $newWebContent->saveXML(); - $this->assertTrue($webContentXml == $newWebContentXml); - $this->assertEquals($this->webContent->url, "http://nowhere.invalid/"); - $this->assertEquals($this->webContent->height, "100"); - $this->assertEquals($this->webContent->width, "200"); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->webContent->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->webContent->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->webContent->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->webContent->extensionAttributes['foo2']['value']); - $webContentXml = $this->webContent->saveXML(); - $newWebContent = new Zend_Gdata_Calendar_Extension_WebContent(); - $newWebContent->transferFromXML($webContentXml); - $this->assertEquals('bar', $newWebContent->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newWebContent->extensionAttributes['foo2']['value']); - } - - public function testConvertFullWebContentToAndFromString() { - $this->webContent->transferFromXML($this->webContentText); - $this->assertEquals($this->webContent->url, "http://www.google.com/logos/july4th06.gif"); - $this->assertEquals($this->webContent->height, "120"); - $this->assertEquals($this->webContent->width, "276"); - } - -} diff --git a/tests/Zend/Gdata/Calendar/_files/AccessLevelElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/AccessLevelElementSample1.xml deleted file mode 100644 index 47843bc6c..000000000 --- a/tests/Zend/Gdata/Calendar/_files/AccessLevelElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/ColorElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/ColorElementSample1.xml deleted file mode 100644 index 8e9f29b68..000000000 --- a/tests/Zend/Gdata/Calendar/_files/ColorElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/EventEntrySample1.xml b/tests/Zend/Gdata/Calendar/_files/EventEntrySample1.xml deleted file mode 100644 index 8c4763b72..000000000 --- a/tests/Zend/Gdata/Calendar/_files/EventEntrySample1.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - http://www.google.com/calendar/feeds/default/private/full/s0dtsvq4pe15ku09jideg67fv4_20070509T193000Z - 2007-05-09T16:32:03.000Z - 2007-05-09T16:34:33.000Z - - www2007 recurring - - - - - - - - gdata ops - gdata.ops.test@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/Zend/Gdata/Calendar/_files/EventFeedCompositeSample1.xml b/tests/Zend/Gdata/Calendar/_files/EventFeedCompositeSample1.xml deleted file mode 100644 index 32eb50c3b..000000000 --- a/tests/Zend/Gdata/Calendar/_files/EventFeedCompositeSample1.xml +++ /dev/null @@ -1,362 +0,0 @@ - - - http://www.google.com/calendar/feeds/default/private/composite - 2007-05-31T01:15:00.000Z - - GData Ops Demo's Composite View - GData Is Awesome - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - Google Calendar - 7 - 1 - 25 - - - - http://www.google.com/calendar/feeds/default/private/composite/5v9l3sqdqt0b7mg1nhnmgdfup8 - 2007-09-14T15:37:53.000Z - 2007-09-14T15:37:53.000Z - - Specialized Event - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - DTSTART;TZID=America/Los_Angeles:20070913T080000 - DTEND;TZID=America/Los_Angeles:20070913T090000 - RRULE:FREQ=DAILY;UNTIL=20070920T150000Z;WKST=SU BEGIN:VTIMEZONE - TZID:America/Los_Angeles X-LIC-LOCATION:America/Los_Angeles - BEGIN:DAYLIGHT TZOFFSETFROM:-0800 TZOFFSETTO:-0700 TZNAME:PDT - DTSTART:19700308T020000 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU - END:DAYLIGHT BEGIN:STANDARD TZOFFSETFROM:-0700 TZOFFSETTO:-0800 - TZNAME:PST DTSTART:19701101T020000 - RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD - END:VTIMEZONE - - - - - - - - - - - - 5v9l3sqdqt0b7mg1nhnmgdfup8_20070914T150000Z - 2007-09-14T15:37:53.000Z - 2007-09-14T15:41:06.000Z - - Specialized Event - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/5v9l3sqdqt0b7mg1nhnmgdfup8_20070914T150000Z/comments - 2007-09-14T15:42:41.390Z - - Comments for: Specialized - Event - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/composite/sh6kv08egsls7mc5tf6np8hi9c - 2007-05-24T20:49:14.000Z - 2007-05-24T20:49:14.000Z - - - Tennis Game - Meet for a quick lesson. - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - DTSTART;VALUE=DATE:20070501 DTEND;VALUE=DATE:20070502 RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904 - - - - - - - - http://www.google.com/calendar/feeds/default/private/composite/lq2ai6imsbq209q3aeturho50g - 2007-05-09T16:44:38.000Z - 2007-05-17T10:33:49.000Z - - all day event may 24 - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - 2007-05-31T01:15:13.249Z - - Comments for: all day event may 24 - - - dfr2c8pbtb8g6uphrsrlpao7mc - 2007-05-23T20:38:08.000Z - 2007-05-23T20:38:08.000Z - - <p>This is my comments!</p> - - User 1 - user1@nowhere.invalid - - - - i9q87onko1uphfs7i21elnnb4g - 2007-06-01T21:21:47.000Z - 2007-06-01T21:21:47.000Z - - <p>This is a user supplied comment.</p> - - User 2 - user2@nowhere.invalid - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/composite/4v2a4eddoqja2727ptkq78euq8 - 2007-05-09T16:43:58.000Z - 2007-05-17T10:33:49.000Z - - all day event may 23 - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - 2007-05-31T01:15:13.250Z - - Comments for: all day event may 23 - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/composite/14gfovd20fqvtj1d1np7ei9tbg - 2007-05-09T16:43:53.000Z - 2007-05-17T10:33:49.000Z - - all day event may 22 - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - 2007-05-31T01:15:13.250Z - - Comments for: all day event may 22 - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/composite/s0dtsvq4pe15ku09jideg67fv4_20070509T193000Z - 2007-05-09T16:32:03.000Z - 2007-05-09T16:34:33.000Z - - www2007 recurring - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - 2007-05-31T01:15:13.251Z - - Comments for: www2007 recurring - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/composite/s0dtsvq4pe15ku09jideg67fv4 - 2007-05-09T16:32:03.000Z - 2007-05-09T16:32:03.000Z - - www2007 recurring - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - DTSTART;TZID=America/Anchorage:20070508T113000 DTEND;TZID=America/Anchorage:20070508T123000 RRULE:FREQ=DAILY;UNTIL=20070513T193000Z;WKST=SU BEGIN:VTIMEZONE TZID:America/Anchorage X-LIC-LOCATION:America/Anchorage BEGIN:DAYLIGHT TZOFFSETFROM:-0900 TZOFFSETTO:-0800 TZNAME:AKDT DTSTART:19700308T020000 RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU END:DAYLIGHT BEGIN:STANDARD TZOFFSETFROM:-0800 TZOFFSETTO:-0900 TZNAME:AKST DTSTART:19701101T020000 RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU END:STANDARD END:VTIMEZONE - - - - - - - - - - s0dtsvq4pe15ku09jideg67fv4_20070509T193000Z - 2007-05-09T16:32:03.000Z - 2007-05-09T16:34:33.000Z - - www2007 recurring - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - 2007-05-31T01:15:13.259Z - - Comments for: www2007 recurring - - - - - - - - - - - - - - - - - - - - diff --git a/tests/Zend/Gdata/Calendar/_files/HiddenElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/HiddenElementSample1.xml deleted file mode 100644 index 21c03d729..000000000 --- a/tests/Zend/Gdata/Calendar/_files/HiddenElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/LinkElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/LinkElementSample1.xml deleted file mode 100644 index a39056fd5..000000000 --- a/tests/Zend/Gdata/Calendar/_files/LinkElementSample1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - \ No newline at end of file diff --git a/tests/Zend/Gdata/Calendar/_files/ListFeedSample1.xml b/tests/Zend/Gdata/Calendar/_files/ListFeedSample1.xml deleted file mode 100644 index 7dcd7d445..000000000 --- a/tests/Zend/Gdata/Calendar/_files/ListFeedSample1.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - http://www.google.com/calendar/feeds/default - 2007-05-30T00:23:26.998Z - GData Ops Demo's Calendar List - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - http://test.address.invalid/ - - Google Calendar - 1 - - http://www.google.com/calendar/feeds/default/gdata.ops.demo%40gmail.com - 2007-05-30T00:23:27.006Z - 2007-05-30T00:20:38.000Z - GData Ops Demo - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - http://www.google.com/calendar/feeds/default/ri3u1buho56d1k2papoec4c16s%40group.calendar.google.com - 2007-05-30T00:23:27.005Z - 2007-05-30T00:20:38.000Z - My Other Awesome Calendar - This is my other calendar. - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - http://www.google.com/calendar/feeds/default/5fcmq8mrd633rulib1jgtuuk90%40group.calendar.google.com - 2007-05-30T00:23:27.005Z - 2007-05-22T05:35:47.000Z - Sample Calendar A - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - http://www.google.com/calendar/feeds/default/a2f8cl1m7ottkhmoita51gu9cc%40group.calendar.google.com - 2007-05-30T00:23:27.005Z - 2007-05-21T07:31:41.000Z - Sample Calendar B - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - http://www.google.com/calendar/feeds/default/rndpkbg35nhelu9fbp63u9sgp0%40group.calendar.google.com - 2007-05-30T00:23:27.006Z - 2007-05-22T21:02:34.000Z - Sample Calendar C - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - http://www.google.com/calendar/feeds/default/u4u5cksnpp1vufdarpupn5um5s%40group.calendar.google.com - 2007-05-30T00:23:27.006Z - 2007-05-17T10:12:36.000Z - Sample Calendar D - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - http://www.google.com/calendar/feeds/default/ibdlf33v6fj62rgfucib6s181s%40group.calendar.google.com - 2007-05-30T00:23:27.006Z - 2007-05-17T10:52:01.000Z - Sample Calender E - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - http://www.google.com/calendar/feeds/default/usa__en%40holiday.calendar.google.com - 2007-05-30T00:23:27.006Z - 2007-05-17T09:48:29.000Z - US Holidays - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - http://www.google.com/calendar/feeds/default/7u5mocvk4et2vgtjte1dtcff2o%40group.calendar.google.com - 2007-05-30T00:23:27.005Z - 2007-05-30T00:20:02.000Z - My Awesome Calendar - This is my awesome calendar - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - diff --git a/tests/Zend/Gdata/Calendar/_files/QuickAddElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/QuickAddElementSample1.xml deleted file mode 100644 index 2eaa4960f..000000000 --- a/tests/Zend/Gdata/Calendar/_files/QuickAddElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/SelectedElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/SelectedElementSample1.xml deleted file mode 100644 index 8f8179cde..000000000 --- a/tests/Zend/Gdata/Calendar/_files/SelectedElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/SendEventNotificationsElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/SendEventNotificationsElementSample1.xml deleted file mode 100644 index 317303545..000000000 --- a/tests/Zend/Gdata/Calendar/_files/SendEventNotificationsElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/TestDataEventFeedSample1.xml b/tests/Zend/Gdata/Calendar/_files/TestDataEventFeedSample1.xml deleted file mode 100644 index 08bb95a31..000000000 --- a/tests/Zend/Gdata/Calendar/_files/TestDataEventFeedSample1.xml +++ /dev/null @@ -1,460 +0,0 @@ - - - - http://www.google.com/calendar/feeds/default/private/full - 2007-03-20T21:29:57.000Z - - GData Ops Demo - Demo Feed - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - http://test.address.invalid/ - - - Google Calendar - 10 - 1 - 25 - - - - http://www.google.com/calendar/feeds/default/private/full/o99flmgmkfkfrr8u745ghr3100 - 2007-03-20T21:29:52.000Z - 2007-03-20T21:29:57.000Z - - test deleted - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/2qt3ao5hbaq7m9igr5ak9esjo0 - 2007-03-20T21:26:04.000Z - 2007-03-20T21:28:46.000Z - - Afternoon at Dolores Park with Kim - This will be fun. - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/uvsqhg7klnae40v50vihr1pvos - 2007-03-20T21:28:37.000Z - 2007-03-20T21:28:37.000Z - - Team meeting - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - DTSTART;TZID=America/Los_Angeles:20070323T090000 - DTEND;TZID=America/Los_Angeles:20070323T100000 - RRULE:FREQ=WEEKLY;BYDAY=FR;UNTIL=20070817T160000Z;WKST=SU - BEGIN:VTIMEZONE TZID:America/Los_Angeles - X-LIC-LOCATION:America/Los_Angeles BEGIN:STANDARD - TZOFFSETFROM:-0700 TZOFFSETTO:-0800 TZNAME:PST - DTSTART:19701025T020000 RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU - END:STANDARD BEGIN:DAYLIGHT TZOFFSETFROM:-0800 TZOFFSETTO:-0700 - TZNAME:PDT DTSTART:19700405T020000 - RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU END:DAYLIGHT - END:VTIMEZONE - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/st4vk9kiffs6rasrl32e4a7alo - 2007-03-20T21:25:46.000Z - 2007-03-20T21:25:46.000Z - - Movie with Kim and danah - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/ofl1e45ubtsoh6gtu127cls2oo - 2007-03-20T21:24:43.000Z - 2007-03-20T21:25:08.000Z - - Dinner with Kim and Sarah - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/b69s2avfi2joigsclecvjlc91g - 2007-03-20T21:24:19.000Z - 2007-03-20T21:25:05.000Z - - Dinner with Jane and John - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/u9p66kkiotn8bqh9k7j4rcnjjc - 2007-03-20T21:24:33.000Z - 2007-03-20T21:24:33.000Z - - Tennis with Elizabeth - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/76oj2kceidob3s708tvfnuaq3c - 2007-03-20T21:24:00.000Z - 2007-03-20T21:24:00.000Z - - Lunch with Jenn - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/5np9ec8m7uoauk1vedh5mhodco - 2007-03-20T07:50:02.000Z - 2007-03-20T20:39:26.000Z - - test entry - test desc - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.google.com/calendar/feeds/default/private/full/fu6sl0rqakf3o0a13oo1i1a1mg - 2007-02-14T23:23:37.000Z - 2007-02-14T23:25:30.000Z - - test - - - - - - - - GData Ops Demo - gdata.ops.demo@gmail.com - - - - - - - - - - - - - - - - - - - diff --git a/tests/Zend/Gdata/Calendar/_files/TimezoneElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/TimezoneElementSample1.xml deleted file mode 100644 index f0792d63c..000000000 --- a/tests/Zend/Gdata/Calendar/_files/TimezoneElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Calendar/_files/WebContentElementSample1.xml b/tests/Zend/Gdata/Calendar/_files/WebContentElementSample1.xml deleted file mode 100644 index bea486dd2..000000000 --- a/tests/Zend/Gdata/Calendar/_files/WebContentElementSample1.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/tests/Zend/Gdata/CalendarEventTest.php b/tests/Zend/Gdata/CalendarEventTest.php deleted file mode 100644 index 411cc04fe..000000000 --- a/tests/Zend/Gdata/CalendarEventTest.php +++ /dev/null @@ -1,495 +0,0 @@ -eventFeed = new Zend_Gdata_Calendar_EventFeed($eventFeedText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testEventFeedToAndFromString() - { - $entryCount = 0; - foreach ($this->eventFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_EventEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->eventFeed and convert back to objects */ - $newEventFeed = new Zend_Gdata_Calendar_EventFeed( - $this->eventFeed->saveXML()); - $newEntryCount = 0; - foreach ($newEventFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_EventEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testEntryCount() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->eventFeed as $entry) { - $entryCount++; - } - $this->assertEquals(10, $entryCount); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $feed = $this->eventFeed; - - // Assert that the feed's author is correct - $feedAuthor = $feed->getAuthor(); - $this->assertEquals($feedAuthor, $feed->author); - $this->assertEquals(1, count($feedAuthor)); - $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($feedAuthor[0], "name", "text", "GData Ops Demo"); - $this->verifyProperty2($feedAuthor[0], "email", "text", "gdata.ops.demo@gmail.com"); - $this->assertTrue($feedAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($feedAuthor[0], "uri", "text", "http://test.address.invalid/"); - - // Assert that each entry has valid author data - foreach ($feed as $entry) { - $entryAuthor = $entry->getAuthor(); - $this->assertEquals(1, count($entryAuthor)); - $this->verifyProperty2($entryAuthor[0], "name", "text", "GData Ops Demo"); - $this->verifyProperty2($entryAuthor[0], "email", "text", "gdata.ops.demo@gmail.com"); - $this->verifyProperty($entryAuthor[0], "uri", null); - } - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $feed = $this->eventFeed; - - // Assert that the feed's ID is correct - $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($feed, "id", "text", - "http://www.google.com/calendar/feeds/default/private/full"); - - // Assert that all entry's have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - } - - // Assert one of the entry's IDs - $entry = $feed[1]; - $this->verifyProperty2($entry, "id", "text", - "http://www.google.com/calendar/feeds/default/private/full/2qt3ao5hbaq7m9igr5ak9esjo0"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $feed = $this->eventFeed; - - // Assert that all entry's have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - } - - // Assert one of the entry's Published dates - $entry = $feed[1]; - $this->verifyProperty2($entry, "published", "text", "2007-03-20T21:26:04.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $feed = $this->eventFeed; - - // Assert that the feed's updated date is correct - $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($feed, "updated", "text", - "2007-03-20T21:29:57.000Z"); - - // Assert that all entry's have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - } - - // Assert one of the entry's Published dates - $entry = $feed[1]; - $this->verifyProperty2($entry, "updated", "text", "2007-03-20T21:28:46.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $feed = $this->eventFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($feed, "title", "text", - "GData Ops Demo"); - - // Assert that all entry's have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "title", "text", "Afternoon at Dolores Park with Kim"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSubtitle() - { - $feed = $this->eventFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); - $this->verifyProperty2($feed, "subtitle", "text", - "Demo Feed"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTimezone() - { - $feed = $this->eventFeed; - - // Assert that the feed's timezone is correct - $this->assertTrue($feed->getTimezone() instanceof Zend_Gdata_Calendar_Extension_Timezone); - $this->verifyProperty2($feed, "timezone", "value", - "America/Los_Angeles"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testStartIndex() - { - $feed = $this->eventFeed; - - // Assert that the feed's startIndex is correct - $this->assertTrue($feed->getStartIndex() instanceof Zend_Gdata_Extension_OpenSearchStartIndex); - $this->verifyProperty2($feed, "startIndex", "text", "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testItemsPerPage() - { - $feed = $this->eventFeed; - - // Assert that the feed's itemsPerPage is correct - $this->assertTrue($feed->getItemsPerPage() instanceof Zend_Gdata_Extension_OpenSearchItemsPerPage); - $this->verifyProperty2($feed, "itemsPerPage", "text", "25"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testContent() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a content object - foreach ($feed as $entry) { - $this->assertTrue($entry->getContent() instanceof Zend_Gdata_App_Extension_Content); - } - - // Assert one of the entry's values - $entry = $feed[1]; - $this->verifyProperty2($entry, "content", "text", "This will be fun."); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSendEventNotifications() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a sendEventNotifications object - foreach ($feed as $entry) { - $this->assertTrue($entry->getSendEventNotifications() instanceof Zend_Gdata_Calendar_Extension_SendEventNotifications); - } - - // Assert one of the entry's values - $entry = $feed[1]; - $this->verifyProperty2($entry, "sendEventNotifications", "value", false); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testEventStatus() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a eventStatus object - foreach ($feed as $entry) { - $this->assertTrue($entry->getEventStatus() instanceof Zend_Gdata_Extension_EventStatus); - } - - // Assert one of the entry's values - $entry = $feed[1]; - $this->verifyProperty2($entry, "eventStatus", "value", "http://schemas.google.com/g/2005#event.confirmed"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testComments() - { - $feed = $this->eventFeed; - - // Assert one of the entry's commments links - $entry = $feed[1]; - $this->assertTrue($entry->getComments() instanceof Zend_Gdata_Extension_Comments); - $this->verifyProperty2($entry->getComments(), "feedLink", "href", "http://www.google.com/calendar/feeds/default/private/full/2qt3ao5hbaq7m9igr5ak9esjo0/comments"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testVisibility() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a visibility object - foreach ($feed as $entry) { - $this->assertTrue($entry->getVisibility() instanceof Zend_Gdata_Extension_Visibility); - } - - // Assert one of the entries values - $entry = $feed[1]; - $this->verifyProperty2($entry, "visibility", "value", "http://schemas.google.com/g/2005#event.private"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTransparency() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a transparency object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTransparency() instanceof Zend_Gdata_Extension_Transparency); - } - - // Assert one of the entries values - $entry = $feed[1]; - $this->verifyProperty2($entry, "transparency", "value", "http://schemas.google.com/g/2005#event.opaque"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testWhen() - { - $feed = $this->eventFeed; - - // Assert one of the entry's values - $entry = $feed[1]; - $when = $entry->getWhen(); - $this->assertEquals($entry->getWhen(), $entry->when); - $this->assertEquals(1, count($when)); - $w = $when[0]; - $this->assertTrue($w instanceof Zend_Gdata_Extension_When); - $this->verifyProperty($w, "startTime", "2007-03-24T12:00:00.000-07:00"); - $this->verifyProperty($w, "endTime", "2007-03-24T15:00:00.000-07:00"); - - // Assert that the associated reminders are correct - $reminders = $w->getReminders(); - $this->assertEquals(1, count($reminders)); - $this->verifyProperty($reminders[0], "minutes", "20"); - $this->verifyProperty($reminders[0], "method", "alert"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testWhere() - { - $feed = $this->eventFeed; - - // Assert one of the entry's values - $entry = $feed[1]; - $where = $entry->getWhere(); - $this->assertEquals(1, count($where)); - $this->assertTrue($where[0] instanceof Zend_Gdata_Extension_Where); - $this->verifyProperty($where[0], "valueString", "Dolores Park with Kim"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testWho() - { - $feed = $this->eventFeed; - - // For one of the entries, make sure that all who entries are of the - // right kind - $entry = $feed[1]; - $who = $entry->getWho(); - foreach ($who as $w) { - $this->assertTrue($w instanceof Zend_Gdata_Extension_Who); - } - $this->assertEquals(2, count($who)); - - // Check one of the who entries to make sure the values are valid - $this->verifyProperty($who[0], "rel", "http://schemas.google.com/g/2005#event.organizer"); - $this->verifyProperty($who[0], "valueString", "GData Ops Demo"); - $this->verifyProperty($who[0], "email", "gdata.ops.demo@gmail.com"); - $this->verifyProperty2($who[0], "attendeeStatus", "value", "http://schemas.google.com/g/2005#event.accepted"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGenerator() - { - $feed = $this->eventFeed; - - // Assert that the feed's generator is correct - $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); - $this->verifyProperty2($feed, "generator", "version", "1.0"); - $this->verifyProperty2($feed, "generator", "uri", "http://www.google.com/calendar"); - $this->verifyProperty2($feed, "generator", "text", "Google Calendar"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testQuickAdd() - { - $feed = $this->eventFeed; - - // Assert that one of the event's QuickAdd entries is correct - $quickAdd = $feed->entry[1]->getQuickAdd(); - $this->assertTrue($quickAdd instanceof Zend_Gdata_Calendar_Extension_QuickAdd); - $this->verifyProperty($quickAdd, "value", true); - } - -} diff --git a/tests/Zend/Gdata/CalendarFeedCompositeTest.php b/tests/Zend/Gdata/CalendarFeedCompositeTest.php deleted file mode 100644 index d7926bee2..000000000 --- a/tests/Zend/Gdata/CalendarFeedCompositeTest.php +++ /dev/null @@ -1,510 +0,0 @@ -eventFeed = new Zend_Gdata_Calendar_EventFeed($eventFeedText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($obj->$propGetter(), $value); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($obj->$propGetter()->$secondGetter(), $value); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testEventFeedToAndFromString() - { - $entryCount = 0; - foreach ($this->eventFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_EventEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->eventFeed and convert back to objects */ - $newEventFeed = new Zend_Gdata_Calendar_EventFeed( - $this->eventFeed->saveXML()); - $newEntryCount = 0; - foreach ($newEventFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_EventEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testEntryCount() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->eventFeed as $entry) { - $entryCount++; - } - $this->assertEquals(7, $entryCount); - $this->assertEquals($entryCount, $this->eventFeed->totalResults->text); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $feed = $this->eventFeed; - - // Assert that the feed's author is correct - $feedAuthor = $feed->getAuthor(); - $this->assertEquals($feedAuthor, $feed->author); - $this->assertEquals(1, count($feedAuthor)); - $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($feedAuthor[0], "name", "text", "GData Ops Demo"); - $this->verifyProperty2($feedAuthor[0], "email", "text", "gdata.ops.demo@gmail.com"); - - // Assert that each entry has valid author data - foreach ($feed as $entry) { - $entryAuthor = $entry->getAuthor(); - $this->assertEquals(1, count($entryAuthor)); - $this->verifyProperty2($entryAuthor[0], "name", "text", "GData Ops Demo"); - $this->verifyProperty2($entryAuthor[0], "email", "text", "gdata.ops.demo@gmail.com"); - $this->verifyProperty($entryAuthor[0], "uri", null); - } - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $feed = $this->eventFeed; - - // Assert that the feed's ID is correct - $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($feed, "id", "text", - "http://www.google.com/calendar/feeds/default/private/composite"); - - // Assert that all entry's have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - } - - // Assert one of the entry's IDs - $entry = $feed[2]; - $this->verifyProperty2($entry, "id", "text", - "http://www.google.com/calendar/feeds/default/private/composite/lq2ai6imsbq209q3aeturho50g"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $feed = $this->eventFeed; - - // Assert that all entry's have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - } - - // Assert one of the entry's Published dates - $entry = $feed[2]; - $this->verifyProperty2($entry, "published", "text", "2007-05-09T16:44:38.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $feed = $this->eventFeed; - - // Assert that the feed's updated date is correct - $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($feed, "updated", "text", - "2007-05-31T01:15:00.000Z"); - - // Assert that all entry's have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - } - - // Assert one of the entry's Published dates - $entry = $feed[2]; - $this->verifyProperty2($entry, "updated", "text", "2007-05-17T10:33:49.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $feed = $this->eventFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($feed, "title", "text", - "GData Ops Demo's Composite View"); - - // Assert that all entry's have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - } - - // Assert one of the entry's Titles - $entry = $feed[2]; - $this->verifyProperty2($entry, "title", "text", "all day event may 24"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSubtitle() - { - $feed = $this->eventFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); - $this->verifyProperty2($feed, "subtitle", "text", - "GData Is Awesome"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTimezone() - { - $feed = $this->eventFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTimezone() instanceof Zend_Gdata_Calendar_Extension_Timezone); - $this->verifyProperty2($feed, "timezone", "value", - "America/Chicago"); - } - - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testEventStatus() - { - $feed = $this->eventFeed; - - // Assert that all entry's have an eventStatus object - foreach ($feed as $entry) { - $this->assertTrue($entry->getEventStatus() instanceof Zend_Gdata_Extension_EventStatus); - } - - // Assert one of the entries values - $entry = $feed[2]; - $this->verifyProperty2($entry, "eventStatus", "value", "http://schemas.google.com/g/2005#event.confirmed"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testVisibility() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a visibility object - foreach ($feed as $entry) { - $this->assertTrue($entry->getVisibility() instanceof Zend_Gdata_Extension_Visibility); - } - - // Assert one of the entries values - $entry = $feed[2]; - $this->verifyProperty2($entry, "visibility", "value", "http://schemas.google.com/g/2005#event.default"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTransparency() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a transparency object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTransparency() instanceof Zend_Gdata_Extension_Transparency); - } - - // Assert one of the entries values - $entry = $feed[2]; - $this->verifyProperty2($entry, "transparency", "value", "http://schemas.google.com/g/2005#event.transparent"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSendEventNotifications() - { - $feed = $this->eventFeed; - - // Assert that all entry's have a sendEventNotifications object - foreach ($feed as $entry) { - $this->assertTrue($entry->getSendEventNotifications() instanceof Zend_Gdata_Calendar_Extension_SendEventNotifications); - } - - // Assert one of the entry's values - $entry = $feed[2]; - $this->verifyProperty2($entry, "sendEventNotifications", "value", false); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testWhen() - { - $feed = $this->eventFeed; - - // Assert one of the entry's values - $entry = $feed[2]; - $when = $entry->getWhen(); - $this->assertEquals($entry->getWhen(), $entry->when); - $this->assertEquals(1, count($when)); - $this->assertTrue($when[0] instanceof Zend_Gdata_Extension_When); - $this->verifyProperty($when[0], "startTime", "2007-05-24"); - $this->verifyProperty($when[0], "endTime", "2007-05-25"); - - // Verify that the reminders show up - $reminders = $when[0]->getReminders(); - $this->assertEquals(2, count($reminders)); - $this->assertTrue($reminders[0] instanceof Zend_Gdata_Extension_Reminder); - $this->assertTrue($reminders[1] instanceof Zend_Gdata_Extension_Reminder); - $this->verifyProperty($reminders[0], "minutes", "10"); - $this->verifyProperty($reminders[0], "method", "alert"); - $this->verifyProperty($reminders[1], "minutes", "10"); - $this->verifyProperty($reminders[1], "method", "email"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testWhere() - { - $feed = $this->eventFeed; - - // Assert one of the entry's values - $entry = $feed[2]; - $where = $entry->getWhere(); - $this->assertEquals(1, count($where)); - $this->assertTrue($where[0] instanceof Zend_Gdata_Extension_Where); - $this->verifyProperty($where[0], "valueString", "Mountain View, California"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testComments() - { - $feed = $this->eventFeed; - - - // Assert one of the entries has the correct values - // Make sure the comment element looks right - $entry = $feed[2]; - $c = $entry->getComments(); - $this->assertEquals($c, $entry->comments); - $this->assertTrue($c instanceof Zend_Gdata_Extension_Comments); - - // Make sure that the feedLink looks right - $fl = $c->getFeedLink(); - $this->assertTrue($fl instanceof Zend_Gdata_Extension_FeedLink); - $this->assertEquals($fl, $c->feedLink); - $this->verifyProperty($fl, "href", "http://www.google.com/calendar/feeds/default/private/full/lq2ai6imsbq209q3aeturho50g/comments"); - - // Make sure the embedded feed looks right - $cFeed = $fl->getFeed(); - $this->assertTrue($cFeed instanceof Zend_Gdata_App_Feed); - $this->assertEquals($cFeed, $fl->feed); - - // Verify the remainder of the comment feed metadata - $this->assertTrue($cFeed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($cFeed, "updated", "text", "2007-05-31T01:15:13.249Z"); - - $this->assertTrue($cFeed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($cFeed, "title", "text", "Comments for: all day event may 24"); - - // Verify that the comments appear to be good - $commentCount = 0; - foreach ($cFeed as $entry) - { - $this->assertTrue($entry instanceof Zend_Gdata_Entry); - $commentCount++; - } - $this->assertEquals(2, $commentCount); - - // Closely examine one of the comments - $comment = $cFeed[1]; - - $this->assertTrue($comment->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($comment, "id", "text", "i9q87onko1uphfs7i21elnnb4g"); - - $this->assertTrue($comment->getPublished() instanceof Zend_Gdata_App_Extension_Published); - $this->verifyProperty2($comment, "published", "text", "2007-06-01T21:21:47.000Z"); - - $this->assertTrue($comment->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($comment, "updated", "text", "2007-06-01T21:21:47.000Z"); - - $this->assertEquals(1, count($comment->author)); - $this->assertTrue($comment->author[0] instanceof Zend_Gdata_App_Extension_Author); - $this->assertTrue($comment->author[0]->getName() instanceof Zend_Gdata_App_Extension_Name); - $this->assertTrue($comment->author[0]->getEmail() instanceof Zend_Gdata_App_Extension_Email); - $this->verifyProperty2($comment->author[0], "name", "text", "User 2"); - $this->verifyProperty2($comment->author[0], "email", "text", "user2@nowhere.invalid"); - - $this->assertTrue($comment->getContent() instanceof Zend_Gdata_App_Extension_Content); - $this->verifyProperty($comment->getContent(), "type", "html"); - $this->assertEquals('

This is a user supplied comment.

', $comment->getContent()->text); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testRecurrence() - { - $feed = $this->eventFeed; - - // Assert one of the entry's values - $entry = $feed[1]; - $this->assertTrue($entry->getRecurrence() instanceof Zend_Gdata_Extension_Recurrence); - $this->verifyProperty2($entry, "recurrence", "text", - "DTSTART;VALUE=DATE:20070501 DTEND;VALUE=DATE:20070502 RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testStartIndex() - { - $feed = $this->eventFeed; - - // Assert that the feed's startIndex is correct - $this->assertTrue($feed->getStartIndex() instanceof Zend_Gdata_Extension_OpenSearchStartIndex); - $this->verifyProperty2($feed, "startIndex", "text", "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testItemsPerPage() - { - $feed = $this->eventFeed; - - // Assert that the feed's itemsPerPage is correct - $this->assertTrue($feed->getItemsPerPage() instanceof Zend_Gdata_Extension_OpenSearchItemsPerPage); - $this->verifyProperty2($feed, "itemsPerPage", "text", "25"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGenerator() - { - $feed = $this->eventFeed; - - // Assert that the feed's generator is correct - $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); - $this->verifyProperty2($feed, "generator", "version", "1.0"); - $this->verifyProperty2($feed, "generator", "uri", "http://www.google.com/calendar"); - } - - -} diff --git a/tests/Zend/Gdata/CalendarFeedTest.php b/tests/Zend/Gdata/CalendarFeedTest.php deleted file mode 100644 index bddcaa86b..000000000 --- a/tests/Zend/Gdata/CalendarFeedTest.php +++ /dev/null @@ -1,389 +0,0 @@ -listFeed = new Zend_Gdata_Calendar_ListFeed($listFeedText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testEventFeedToAndFromString() - { - $entryCount = 0; - foreach ($this->listFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_ListEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->listFeed and convert back to objects */ - $newListFeed = new Zend_Gdata_Calendar_ListFeed( - $this->listFeed->saveXML()); - $newEntryCount = 0; - foreach ($newListFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_ListEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testEntryCount() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->listFeed as $entry) { - $entryCount++; - } - $this->assertEquals(9, $entryCount); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $feed = $this->listFeed; - - // Assert that the feed's author is correct - $feedAuthor = $feed->getAuthor(); - $this->assertEquals($feedAuthor, $feed->author); - $this->assertEquals(1, count($feedAuthor)); - $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($feedAuthor[0], "name", "text", "GData Ops Demo"); - $this->verifyProperty2($feedAuthor[0], "email", "text", "gdata.ops.demo@gmail.com"); - $this->assertTrue($feedAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($feedAuthor[0], "uri", "text", "http://test.address.invalid/"); - - // Assert that each entry has valid author data - foreach ($feed as $entry) { - $entryAuthor = $entry->getAuthor(); - $this->assertEquals(1, count($entryAuthor)); - $this->verifyProperty2($entryAuthor[0], "name", "text", "GData Ops Demo"); - $this->verifyProperty2($entryAuthor[0], "email", "text", "gdata.ops.demo@gmail.com"); - $this->verifyProperty($entryAuthor[0], "uri", null); - } - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $feed = $this->listFeed; - - // Assert that the feed's ID is correct - $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($feed, "id", "text", - "http://www.google.com/calendar/feeds/default"); - - // Assert that all entry's have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - } - - // Assert one of the entry's IDs - $entry = $feed[1]; - $this->verifyProperty2($entry, "id", "text", - "http://www.google.com/calendar/feeds/default/ri3u1buho56d1k2papoec4c16s%40group.calendar.google.com"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $feed = $this->listFeed; - - // Assert that all entry's have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - } - - // Assert one of the entry's Published dates - $entry = $feed[1]; - $this->verifyProperty2($entry, "published", "text", "2007-05-30T00:23:27.005Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $feed = $this->listFeed; - - // Assert that the feed's updated date is correct - $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($feed, "updated", "text", - "2007-05-30T00:23:26.998Z"); - - // Assert that all entry's have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - } - - // Assert one of the entry's Published dates - $entry = $feed[1]; - $this->verifyProperty2($entry, "updated", "text", "2007-05-30T00:20:38.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $feed = $this->listFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($feed, "title", "text", - "GData Ops Demo's Calendar List"); - - // Assert that all entry's have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "title", "text", "My Other Awesome Calendar"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testColor() - { - $feed = $this->listFeed; - - // Assert that all entry's have an color object - foreach ($feed as $entry) { - $this->assertTrue($entry->getColor() instanceof Zend_Gdata_Calendar_Extension_Color); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "color", "value", "#A32929"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testAccessLevel() - { - $feed = $this->listFeed; - - // Assert that all entry's have an accessLevel object - foreach ($feed as $entry) { - $this->assertTrue($entry->getAccessLevel() instanceof Zend_Gdata_Calendar_Extension_AccessLevel); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "accessLevel", "value", "owner"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTimezone() - { - $feed = $this->listFeed; - - // Assert that all entry's have an accessLevel object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTimezone() instanceof Zend_Gdata_Calendar_Extension_Timezone); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "timezone", "value", "America/Chicago"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testHidden() - { - $feed = $this->listFeed; - - // Assert that all entry's have an accessLevel object - foreach ($feed as $entry) { - $this->assertTrue($entry->getHidden() instanceof Zend_Gdata_Calendar_Extension_Hidden); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "hidden", "value", false); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSelected() - { - $feed = $this->listFeed; - - // Assert that all entry's have a selected object - foreach ($feed as $entry) { - $this->assertTrue($entry->getSelected() instanceof Zend_Gdata_Calendar_Extension_Selected); - } - - // Assert one of the entry's Titles - $entry = $feed[1]; - $this->verifyProperty2($entry, "selected", "value", true); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testStartIndex() - { - $feed = $this->listFeed; - - // Assert that the feed's startIndex is correct - $this->assertTrue($feed->getStartIndex() instanceof Zend_Gdata_Extension_OpenSearchStartIndex); - $this->verifyProperty2($feed, "startIndex", "text", "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testWhere() - { - $feed = $this->listFeed; - - // Assert one of the entry's where values - $entry = $feed[1]; - $this->assertEquals($entry->getWhere(), $entry->where); - $this->assertTrue($entry->where[0] instanceof Zend_Gdata_Extension_Where); - $this->assertEquals("Palo Alto, California", $entry->where[0]->getValueString()); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSummary() - { - $feed = $this->listFeed; - - // Assert one of the entry's summaries - $entry = $feed[1]; - $this->assertTrue($entry->getSummary() instanceof Zend_Gdata_App_Extension_Summary); - $this->verifyProperty2($entry, "summary", "text", "This is my other calendar."); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGenerator() - { - $feed = $this->listFeed; - - // Assert that the feed's generator is correct - $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); - $this->verifyProperty2($feed, "generator", "version", "1.0"); - $this->verifyProperty2($feed, "generator", "uri", "http://www.google.com/calendar"); - } - -} diff --git a/tests/Zend/Gdata/CalendarOnlineTest.php b/tests/Zend/Gdata/CalendarOnlineTest.php deleted file mode 100644 index 9c3057997..000000000 --- a/tests/Zend/Gdata/CalendarOnlineTest.php +++ /dev/null @@ -1,173 +0,0 @@ -gdata = new Zend_Gdata_Calendar($client); - } - - public function testCalendarListFeed() - { - $calFeed = $this->gdata->getCalendarListFeed(); - $this->assertTrue(strpos((string) $calFeed->title->text, 'Calendar List') - !== false); - $calCount = 0; - foreach ($calFeed as $calendar) { - $calCount++; - } - $this->assertTrue($calCount > 0); - } - - /** - * @group ZF-1701 - */ - public function testCalendarOnlineFeed() - { - $eventFeed = $this->gdata->getCalendarEventFeed(); - $this->assertTrue(strpos((string) $eventFeed->title->text, TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL) - !== false); - $eventCount = 0; - foreach ( $eventFeed as $event ) { - $this->assertTrue($event instanceof Zend_Gdata_Calendar_EventEntry); - $eventCount++; - } - $this->assertTrue($eventCount > 0 ); - $this->assertTrue(count($eventFeed) == $eventCount); - } - - function getEvent($eventId) - { - $query = $this->gdata->newEventQuery(); - $query->setUser('default'); - $query->setVisibility('private'); - $query->setProjection('full'); - $query->setEvent($eventId); - - $eventEntry = $this->gdata->getCalendarEventEntry($query); - $this->assertTrue( - $eventEntry instanceof Zend_Gdata_Calendar_EventEntry); - return $eventEntry; - } - - public function createEvent( - $title = 'Tennis with Beth', - $desc='Meet for a quick lesson', $where = 'On the courts', - $startDate = '2008-01-20', $startTime = '10:00', - $endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08') - { - $newEntry = $this->gdata->newEventEntry(); - $newEntry->title = $this->gdata->newTitle(\trim((string) $title)); - $newEntry->where = array($this->gdata->newWhere($where)); - - $newEntry->content = $this->gdata->newContent($desc); - $newEntry->content->type = 'text'; - - $when = $this->gdata->newWhen(); - $when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00"; - $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00"; - $reminder = $this->gdata->newReminder(); - $reminder->minutes = '30'; - $reminder->method = 'email'; - $when->reminders = array($reminder); - $newEntry->when = array($when); - - $createdEntry = $this->gdata->insertEvent($newEntry); - - $this->assertEquals('email in 30 minutes', $reminder->__toString()); - $this->assertEquals($title, $createdEntry->title->text); - $this->assertEquals($desc, $createdEntry->content->text); - $this->assertEquals(strtotime($when->startTime), - strtotime($createdEntry->when[0]->startTime)); - $this->assertEquals(strtotime($when->endTime), - strtotime($createdEntry->when[0]->endTime)); - $this->assertEquals($reminder->method, - $createdEntry->when[0]->reminders[0]->method); - $this->assertEquals($reminder->minutes, - $createdEntry->when[0]->reminders[0]->minutes); - $this->assertEquals($where, $createdEntry->where[0]->valueString); - - return $createdEntry; - } - - function updateEvent ($eventId, $newTitle) - { - $eventOld = $this->getEvent($eventId); - $eventOld->title = $this->gdata->newTitle($newTitle); - $eventOld->save(); - $eventNew = $this->getEvent($eventId); - $this->assertEquals($newTitle, $eventNew->title->text); - return $eventNew; - } - - public function testCreateEvent() - { - $createdEntry = $this->createEvent(); - } - - public function testCreateAndUpdateEvent() - { - $newTitle = 'my new title'; - $createdEntry = $this->createEvent(); - preg_match('#.*/([A-Za-z0-9]+)$#', $createdEntry->id->text, $matches); - $id = $matches[1]; - $updatedEvent = $this->updateEvent($id, $newTitle); - $this->assertEquals($newTitle, $updatedEvent->title->text); - } - - public function testCreateAndDeleteEvent() - { - /* deletion can be performed in several different ways-- test all */ - $createdEntry = $this->createEvent(); - $createdEntry->delete(); - - $createdEntry2 = $this->createEvent(); - $this->gdata->delete($createdEntry2); - - $createdEntry3 = $this->createEvent(); - $this->gdata->delete($createdEntry3->getEditLink()->href); - } -} diff --git a/tests/Zend/Gdata/CalendarTest.php b/tests/Zend/Gdata/CalendarTest.php deleted file mode 100644 index f6c7c345a..000000000 --- a/tests/Zend/Gdata/CalendarTest.php +++ /dev/null @@ -1,103 +0,0 @@ -eventFeedText = file_get_contents( - 'Zend/Gdata/Calendar/_files/TestDataEventFeedSample1.xml', - true); - $this->eventFeed = new Zend_Gdata_Calendar_EventFeed(); - } - - public function testEmptyEventFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->eventFeed->extensionElements)); - $this->assertTrue(count($this->eventFeed->extensionElements) == 0); - } - - public function testEmptyEventFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->eventFeed->extensionAttributes)); - $this->assertTrue(count($this->eventFeed->extensionAttributes) == 0); - } - - public function testSampleEventFeedShouldHaveNoExtensionElements() { - $this->eventFeed->transferFromXML($this->eventFeedText); - $this->assertTrue(is_array($this->eventFeed->extensionElements)); - $this->assertTrue(count($this->eventFeed->extensionElements) == 0); - } - - public function testSampleEventFeedShouldHaveNoExtensionAttributes() { - $this->eventFeed->transferFromXML($this->eventFeedText); - $this->assertTrue(is_array($this->eventFeed->extensionAttributes)); - $this->assertTrue(count($this->eventFeed->extensionAttributes) == 0); - } - - public function testEventFeedToAndFromString() - { - $this->eventFeed->transferFromXML($this->eventFeedText); - $entryCount = 0; - foreach ($this->eventFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_EventEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->eventFeed and convert back to objects */ - $newEventFeed = new Zend_Gdata_Calendar_EventFeed( - $this->eventFeed->saveXML()); - $newEntryCount = 0; - foreach ($newEventFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Calendar_EventEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - public function testEntryCount() - { - $this->eventFeed->transferFromXML($this->eventFeedText); - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->eventFeed as $entry) { - $entryCount++; - } - $this->assertEquals($entryCount, 10); - $this->assertEquals($entryCount, $this->eventFeed->totalResults->text); - } - -} diff --git a/tests/Zend/Gdata/CommentsTest.php b/tests/Zend/Gdata/CommentsTest.php deleted file mode 100644 index 61457aad1..000000000 --- a/tests/Zend/Gdata/CommentsTest.php +++ /dev/null @@ -1,128 +0,0 @@ -commentsText = file_get_contents( - 'Zend/Gdata/_files/CommentsElementSample1.xml', - true); - $this->comments = new Zend_Gdata_Extension_Comments(); - } - - public function testEmptyCommentsShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->comments->extensionElements)); - $this->assertTrue(count($this->comments->extensionElements) == 0); - } - - public function testEmptyCommentsShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->comments->extensionAttributes)); - $this->assertTrue(count($this->comments->extensionAttributes) == 0); - } - - public function testSampleCommentsShouldHaveNoExtensionElements() { - $this->comments->transferFromXML($this->commentsText); - $this->assertTrue(is_array($this->comments->extensionElements)); - $this->assertTrue(count($this->comments->extensionElements) == 0); - } - - public function testSampleCommentsShouldHaveNoExtensionAttributes() { - $this->comments->transferFromXML($this->commentsText); - $this->assertTrue(is_array($this->comments->extensionAttributes)); - $this->assertTrue(count($this->comments->extensionAttributes) == 0); - } - - public function testNormalCommentsShouldHaveNoExtensionElements() { - $this->comments->rel = "http://schemas.google.com/g/2005#regular"; - - $this->assertEquals("http://schemas.google.com/g/2005#regular", $this->comments->rel); - - $this->assertEquals(0, count($this->comments->extensionElements)); - $newComments = new Zend_Gdata_Extension_Comments(); - $newComments->transferFromXML($this->comments->saveXML()); - $this->assertEquals(0, count($newComments->extensionElements)); - $newComments->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newComments->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#regular", $newComments->rel); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newComments2 = $gdata->newComments(); - $newComments2->transferFromXML($newComments->saveXML()); - $this->assertEquals(1, count($newComments2->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#regular", $newComments2->rel); - } - - public function testEmptyCommentsToAndFromStringShouldMatch() { - $commentsXml = $this->comments->saveXML(); - $newComments = new Zend_Gdata_Extension_Comments(); - $newComments->transferFromXML($commentsXml); - $newCommentsXml = $newComments->saveXML(); - $this->assertTrue($commentsXml == $newCommentsXml); - } - - public function testCommentsWithValueToAndFromStringShouldMatch() { - $this->comments->rel = "http://schemas.google.com/g/2005#regular"; - $commentsXml = $this->comments->saveXML(); - $newComments = new Zend_Gdata_Extension_Comments(); - $newComments->transferFromXML($commentsXml); - $newCommentsXml = $newComments->saveXML(); - $this->assertTrue($commentsXml == $newCommentsXml); - $this->assertEquals("http://schemas.google.com/g/2005#regular", $this->comments->rel); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->comments->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->comments->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->comments->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->comments->extensionAttributes['foo2']['value']); - $commentsXml = $this->comments->saveXML(); - $newComments = new Zend_Gdata_Extension_Comments(); - $newComments->transferFromXML($commentsXml); - $this->assertEquals('bar', $newComments->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newComments->extensionAttributes['foo2']['value']); - } - - public function testConvertFullCommentsToAndFromString() { - $this->comments->transferFromXML($this->commentsText); - $this->assertEquals("http://schemas.google.com/g/2005#reviews", $this->comments->rel); - $this->assertTrue($this->comments->feedLink instanceof Zend_Gdata_Extension_FeedLink); - $this->assertEquals("http://example.com/restaurants/SanFrancisco/432432/reviews", $this->comments->feedLink->href); - } - -} diff --git a/tests/Zend/Gdata/Docs/DocumentListEntryTest.php b/tests/Zend/Gdata/Docs/DocumentListEntryTest.php deleted file mode 100644 index ce309d324..000000000 --- a/tests/Zend/Gdata/Docs/DocumentListEntryTest.php +++ /dev/null @@ -1,73 +0,0 @@ -doc = new Zend_Gdata_Docs_DocumentListEntry( - file_get_contents('Zend/Gdata/Docs/_files/TestDataDocumentListEntrySample.xml', true)); - } - - public function testToAndFromString() - { - $this->assertTrue($this->doc instanceof Zend_Gdata_Docs_DocumentListEntry); - $this->assertTrue($this->doc->title->text === 'Test Spreadsheet'); - - $newDoc = new Zend_Gdata_Docs_DocumentListEntry(); - $doc = new DOMDocument(); - $doc->loadXML($this->doc->saveXML()); - $newDoc->transferFromDom($doc->documentElement); - - $this->assertTrue($newDoc->title == $this->doc->title); - } - - public function testSetMediaSource() - { - // Service object to create the media file source. - $this->docsClient = new Zend_Gdata_Docs(null); - $mediaSource = $this->docsClient->newMediaFileSource('test_file_name'); - $mediaSource->setSlug('test slug'); - $mediaSource->setContentType('test content type'); - $this->doc->setMediaSource($mediaSource); - $this->assertTrue($this->doc->getMediaSource()->getContentType() === - 'test content type'); - $this->assertTrue($this->doc->getMediaSource()->getSlug() === - 'test slug'); - } - -} diff --git a/tests/Zend/Gdata/Docs/DocumentListFeedTest.php b/tests/Zend/Gdata/Docs/DocumentListFeedTest.php deleted file mode 100644 index 2b2cedbf1..000000000 --- a/tests/Zend/Gdata/Docs/DocumentListFeedTest.php +++ /dev/null @@ -1,68 +0,0 @@ -docFeed = new Zend_Gdata_Docs_DocumentListFeed( - file_get_contents(__DIR__ . '/_files/TestDataDocumentListFeedSample.xml'), - true); - } - - public function testToAndFromString() - { - // There should be 2 entries in the feed. - $this->assertTrue(count($this->docFeed->entries) == 2); - $this->assertTrue($this->docFeed->entries->count() == 2); - foreach($this->docFeed->entries as $entry) - { - $this->assertTrue($entry instanceof Zend_Gdata_Docs_DocumentListEntry); - } - - $newDocFeed = new Zend_Gdata_Docs_DocumentListFeed(); - $doc = new DOMDocument(); - $doc->loadXML($this->docFeed->saveXML()); - $newDocFeed->transferFromDom($doc->documentElement); - - $this->assertTrue(count($newDocFeed->entries) == count($this->docFeed->entries)); - foreach($newDocFeed->entries as $entry) - { - $this->assertTrue($entry instanceof Zend_Gdata_Docs_DocumentListEntry); - } - } - -} diff --git a/tests/Zend/Gdata/Docs/QueryTest.php b/tests/Zend/Gdata/Docs/QueryTest.php deleted file mode 100644 index 44dd2e25d..000000000 --- a/tests/Zend/Gdata/Docs/QueryTest.php +++ /dev/null @@ -1,78 +0,0 @@ -docQuery = new Zend_Gdata_Docs_Query(); - } - - 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 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/tests/Zend/Gdata/Docs/_files/TestDataDocumentListEntrySample.xml b/tests/Zend/Gdata/Docs/_files/TestDataDocumentListEntrySample.xml deleted file mode 100644 index 501d5dc77..000000000 --- a/tests/Zend/Gdata/Docs/_files/TestDataDocumentListEntrySample.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - test.user - test.user@gmail.com - - - http://docs.google.com/feeds/documents/private/full/spreadsheet%3Asupercalifragilisticexpealidocious - - - - Test Spreadsheet - 2007-07-03T18:03:32.045Z - diff --git a/tests/Zend/Gdata/Docs/_files/TestDataDocumentListFeedSample.xml b/tests/Zend/Gdata/Docs/_files/TestDataDocumentListFeedSample.xml deleted file mode 100644 index 4521fbf5d..000000000 --- a/tests/Zend/Gdata/Docs/_files/TestDataDocumentListFeedSample.xml +++ /dev/null @@ -1,38 +0,0 @@ - - 2 - 1 - - - - test.user - test.user@gmail.com - - - http://docs.google.com/feeds/documents/private/full/spreadsheet%3Asupercalifragilisticexpeadocious - - - - Test Spreadsheet - 2007-07-03T18:03:32.045Z - - - - - test.user - test.user@gmail.com - - - http://docs.google.com/feeds/documents/private/full/document%3Agr00vy - - - Test Document - 2007-07-03T18:02:50.338Z - - http://docs.google.com/feeds/documents/private/full - - - - - Available Documents - test.user@gmail.com - 2007-07-09T23:07:21.898Z - diff --git a/tests/Zend/Gdata/DocsOnlineTest.php b/tests/Zend/Gdata/DocsOnlineTest.php deleted file mode 100644 index 7f9c877d7..000000000 --- a/tests/Zend/Gdata/DocsOnlineTest.php +++ /dev/null @@ -1,130 +0,0 @@ -docTitle = constant('TESTS_ZEND_GDATA_DOCS_DOCUMENTTITLE'); - $service = Zend_Gdata_Docs::AUTH_SERVICE_NAME; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $this->gdata = new Zend_Gdata_Docs($client); - } - - public function testGetSpreadsheetFeed() - { - $feed = $this->gdata->getDocumentListFeed(); - $this->assertTrue($feed instanceof Zend_Gdata_Docs_DocumentListFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Docs_DocumentListEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $query = new Zend_Gdata_Docs_Query(); - $feed = $this->gdata->getDocumentListFeed($query); - $this->assertTrue($feed instanceof Zend_Gdata_Docs_DocumentListFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Docs_DocumentListEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $uri = $query->getQueryUrl(); - $feed = $this->gdata->getDocumentListFeed($uri); - $this->assertTrue($feed instanceof Zend_Gdata_Docs_DocumentListFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Docs_DocumentListEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - } - - public function testQueryForTitle() - { - $query = new Zend_Gdata_Docs_Query(); - $query->title = $this->docTitle; - $feed = $this->gdata->getDocumentListFeed($query); - $this->assertTrue(strpos((string) strtolower((string) $feed->entries[0]->title), strtolower((string) $this->docTitle)) !== FALSE); - } - - public function testGetDocumentListEntry() - { - $query = new Zend_Gdata_Docs_Query(); - $feed = $this->gdata->getDocumentListFeed($query); - $selfLinkHref = $feed->entries[0]->getSelfLink()->href; - $entry = $this->gdata->getDocumentListEntry($selfLinkHref); - $this->assertTrue($entry instanceof Zend_Gdata_Docs_DocumentListEntry); - } - - public function testUploadFindAndDelete() - { - $documentTitle = 'spreadsheet_upload_test.csv'; - $newDocumentEntry = $this->gdata->uploadFile( - 'Zend/Gdata/_files/DocsTest.csv', $documentTitle, - $this->gdata->lookupMimeType('CSV'), - Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI); - $this->assertTrue($newDocumentEntry->title->text === $documentTitle); - - // Get the newly created document. - // First extract the document's ID key from the Atom id. - $idParts = explode('/', $newDocumentEntry->id->text); - $keyParts = explode('%3A', end($idParts)); - $documentFromGetDoc = $this->gdata->getDoc($keyParts[1], $keyParts[0]); - $this->assertTrue($documentFromGetDoc->title->text === $documentTitle); - if ($keyParts[0] == 'document') { - $documentFromGetDocument = $this->gdata->getDocument($keyParts[1]); - $this->assertTrue( - $documentFromGetDocument->title->text === $documentTitle); - } - if ($keyParts[0] == 'spreadsheet') { - $documentFromGetSpreadsheet = $this->gdata->getSpreadsheet( - $keyParts[1]); - $this->assertTrue( - $documentFromGetSpreadsheet->title->text === $documentTitle); - } - if ($keyParts[0] == 'presentation') { - $documentFromGetPresentation = $this->gdata->getPresentation( - $keyParts[1]); - $this->assertTrue( - $documentFromGetPresentation->title->text === $documentTitle); - } - - // Cleanup and remove the new document. - $newDocumentEntry->delete(); - } - -} diff --git a/tests/Zend/Gdata/DocsTest.php b/tests/Zend/Gdata/DocsTest.php deleted file mode 100644 index 801822341..000000000 --- a/tests/Zend/Gdata/DocsTest.php +++ /dev/null @@ -1,96 +0,0 @@ -adapter = new Test_Zend_Gdata_MockHttpClient(); - $this->client = new Zend_Gdata_HttpClient(); - $this->client->setAdapter($this->adapter); - $this->gdata = new Zend_Gdata_Docs($this->client); - } - - public function testCreateFolder() - { - $this->adapter->setResponse(array('HTTP/1.1 200 OK\r\n\r\n')); - $this->gdata->createFolder("Test Folder"); - $request = $this->adapter->popRequest(); - - // Check to make sure the correct URI is in use - $this->assertEquals( - "docs.google.com", - $request->uri->getHost()); - $this->assertEquals( - "/feeds/documents/private/full", - $request->uri->getPath()); - - // Check to make sure that this is a folder - $this->assertNotEquals( false, strpos((string) $request->body, - "assertNotEquals(false, strpos((string) $request->body, - "Test Folder")); - } - - public function testCreateSubfolder() - { - $subfolderName = "MySubfolder"; - $this->adapter->setResponse(array('HTTP/1.1 200 OK\r\n\r\n')); - $this->gdata->createFolder("Test Folder", $subfolderName); - $request = $this->adapter->popRequest(); - - // Check to make sure the correct URI is in use - $this->assertEquals( - "docs.google.com", - $request->uri->getHost()); - $this->assertEquals( - "/feeds/folders/private/full/" . $subfolderName, - $request->uri->getPath()); - - // Check to make sure that this is a folder - $this->assertNotEquals( false, strpos((string) $request->body, - "assertNotEquals(false, strpos((string) $request->body, - "Test Folder")); - } - - -} diff --git a/tests/Zend/Gdata/EntryLinkTest.php b/tests/Zend/Gdata/EntryLinkTest.php deleted file mode 100644 index 3c9edfce2..000000000 --- a/tests/Zend/Gdata/EntryLinkTest.php +++ /dev/null @@ -1,142 +0,0 @@ -entryLinkText = file_get_contents( - 'Zend/Gdata/_files/EntryLinkElementSample1.xml', - true); - $this->entryLink = new Zend_Gdata_Extension_EntryLink(); - } - - public function testEmptyEntryLinkShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entryLink->extensionElements)); - $this->assertTrue(count($this->entryLink->extensionElements) == 0); - } - - public function testEmptyEntryLinkShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entryLink->extensionAttributes)); - $this->assertTrue(count($this->entryLink->extensionAttributes) == 0); - } - - public function testSampleEntryLinkShouldHaveNoExtensionElements() { - $this->entryLink->transferFromXML($this->entryLinkText); - $this->assertTrue(is_array($this->entryLink->extensionElements)); - $this->assertTrue(count($this->entryLink->extensionElements) == 0); - } - - public function testSampleEntryLinkShouldHaveNoExtensionAttributes() { - $this->entryLink->transferFromXML($this->entryLinkText); - $this->assertTrue(is_array($this->entryLink->extensionAttributes)); - $this->assertTrue(count($this->entryLink->extensionAttributes) == 0); - } - - public function testNormalEntryLinkShouldHaveNoExtensionElements() { - $this->entryLink->href = "http://gmail.com/jo/contacts/Bob"; - $this->entryLink->rel = "self"; - $this->entryLink->readOnly = false; - - $this->assertEquals("http://gmail.com/jo/contacts/Bob", $this->entryLink->href); - $this->assertEquals("self", $this->entryLink->rel); - $this->assertEquals(false, $this->entryLink->readOnly); - - $this->assertEquals(0, count($this->entryLink->extensionElements)); - $newEntryLink = new Zend_Gdata_Extension_EntryLink(); - $newEntryLink->transferFromXML($this->entryLink->saveXML()); - $this->assertEquals(0, count($newEntryLink->extensionElements)); - $newEntryLink->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newEntryLink->extensionElements)); - $this->assertEquals("http://gmail.com/jo/contacts/Bob", $newEntryLink->href); - $this->assertEquals("self", $newEntryLink->rel); - $this->assertEquals(false, $newEntryLink->readOnly); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newEntryLink2 = $gdata->newEntryLink(); - $newEntryLink2->transferFromXML($newEntryLink->saveXML()); - $this->assertEquals(1, count($newEntryLink2->extensionElements)); - $this->assertEquals("http://gmail.com/jo/contacts/Bob", $newEntryLink2->href); - $this->assertEquals("self", $newEntryLink2->rel); - $this->assertEquals(false, $newEntryLink2->readOnly); - } - - public function testEmptyEntryLinkToAndFromStringShouldMatch() { - $entryLinkXml = $this->entryLink->saveXML(); - $newEntryLink = new Zend_Gdata_Extension_EntryLink(); - $newEntryLink->transferFromXML($entryLinkXml); - $newEntryLinkXml = $newEntryLink->saveXML(); - $this->assertTrue($entryLinkXml == $newEntryLinkXml); - } - - public function testEntryLinkWithValueToAndFromStringShouldMatch() { - $this->entryLink->href = "http://gmail.com/jo/contacts/Bob"; - $this->entryLink->rel = "self"; - $this->entryLink->readOnly = false; - $entryLinkXml = $this->entryLink->saveXML(); - $newEntryLink = new Zend_Gdata_Extension_EntryLink(); - $newEntryLink->transferFromXML($entryLinkXml); - $newEntryLinkXml = $newEntryLink->saveXML(); - $this->assertTrue($entryLinkXml == $newEntryLinkXml); - $this->assertEquals("http://gmail.com/jo/contacts/Bob", $this->entryLink->href); - $this->assertEquals("self", $this->entryLink->rel); - $this->assertEquals(false, $this->entryLink->readOnly); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->entryLink->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->entryLink->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->entryLink->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->entryLink->extensionAttributes['foo2']['value']); - $entryLinkXml = $this->entryLink->saveXML(); - $newEntryLink = new Zend_Gdata_Extension_EntryLink(); - $newEntryLink->transferFromXML($entryLinkXml); - $this->assertEquals('bar', $newEntryLink->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newEntryLink->extensionAttributes['foo2']['value']); - } - - public function testConvertFullEntryLinkToAndFromString() { - $this->entryLink->transferFromXML($this->entryLinkText); - $this->assertEquals("http://gmail.com/jo/contacts/Jo", $this->entryLink->href); - $this->assertEquals("via", $this->entryLink->rel); - $this->assertEquals(true, $this->entryLink->readOnly); - $this->assertTrue($this->entryLink->entry instanceof Zend_Gdata_App_Entry); - $this->assertEquals("Jo March", $this->entryLink->entry->title->text); - } - -} diff --git a/tests/Zend/Gdata/EntryTest.php b/tests/Zend/Gdata/EntryTest.php deleted file mode 100644 index 8da3d5086..000000000 --- a/tests/Zend/Gdata/EntryTest.php +++ /dev/null @@ -1,127 +0,0 @@ -entry = new Zend_Gdata_Entry(); - $this->entryText = file_get_contents( - 'Zend/Gdata/_files/EntrySample1.xml', - true); - $this->etagLocalName = 'etag'; - $this->expectedEtag = 'W/"CkcHQH8_fCp7ImA9WxRTGEw."'; - $this->expectedMismatchExceptionMessage = "ETag mismatch"; - $this->gdNamespace = 'http://schemas.google.com/g/2005'; - $this->openSearchNamespacev1 = 'http://a9.com/-/spec/opensearchrss/1.0/'; - $this->openSearchNamespacev2 = 'http://a9.com/-/spec/opensearch/1.1/'; - - } - - public function testXMLHasNoEtagsWhenUsingV1() { - $etagData = 'Quux'; - $this->entry->setEtag($etagData); - $domNode = $this->entry->getDOM(null, 1, null); - $this->assertNull($domNode->attributes->getNamedItemNS($this->gdNamespace, $this->etagLocalName)); - } - - public function testXMLHasNoEtagsWhenUsingV1X() { - $etagData = 'Quux'; - $this->entry->setEtag($etagData); - $domNode = $this->entry->getDOM(null, 1, 1); - $this->assertNull($domNode->attributes->getNamedItemNS($this->gdNamespace, $this->etagLocalName)); - } - - public function testXMLHasEtagsWhenUsingV2() { - $etagData = 'Quux'; - $this->entry->setEtag($etagData); - $domNode = $this->entry->getDOM(null, 2, null); - $this->assertEquals($etagData, $domNode->attributes->getNamedItemNS($this->gdNamespace, $this->etagLocalName)->nodeValue); - } - - public function testXMLHasEtagsWhenUsingV2X() { - $etagData = 'Quux'; - $this->entry->setEtag($etagData); - $domNode = $this->entry->getDOM(null, 2, 1); - $this->assertEquals($etagData, $domNode->attributes->getNamedItemNS($this->gdNamespace, $this->etagLocalName)->nodeValue); - } - - public function testXMLETagsPropagateToEntry() { - $this->entry->transferFromXML($this->entryText); - $this->assertEquals($this->expectedEtag, $this->entry->getEtag()); - } - - public function testXMLandHTMLEtagsDifferingThrowsException() { - $exceptionCaught = false; - $this->entry->setEtag("Foo"); - try { - $this->entry->transferFromXML($this->entryText); - } catch (Zend_Gdata_App_IOException $e) { - $exceptionCaught = true; - } - $this->assertTrue($exceptionCaught, "Exception Zend_Gdata_IO_Exception expected"); - } - - public function testHttpAndXmlEtagsDifferingThrowsExceptionWithMessage() { - $messageCorrect = false; - $this->entry->setEtag("Foo"); - try { - $this->entry->transferFromXML($this->entryText); - } catch (Zend_Gdata_App_IOException $e) { - if ($e->getMessage() == $this->expectedMismatchExceptionMessage) - $messageCorrect = true; - } - $this->assertTrue($messageCorrect, "Exception Zend_Gdata_IO_Exception message incorrect"); - } - - public function testNothingBadHappensWhenHttpAndXmlEtagsMatch() { - $this->entry->setEtag($this->expectedEtag); - $this->entry->transferFromXML($this->entryText); - $this->assertEquals($this->expectedEtag, $this->entry->getEtag()); - } - - public function testLookUpOpenSearchv1Namespace() { - $this->assertEquals($this->openSearchNamespacev1, - $this->entry->lookupNamespace('openSearch', 1, 0)); - $this->assertEquals($this->openSearchNamespacev1, - $this->entry->lookupNamespace('openSearch', 1, null)); - } - - public function testLookupOpenSearchv2Namespace() { - $this->assertEquals($this->openSearchNamespacev2, - $this->entry->lookupNamespace('openSearch', 2, 0)); - $this->assertEquals($this->openSearchNamespacev2, - $this->entry->lookupNamespace('openSearch', 2, null)); - } - -} diff --git a/tests/Zend/Gdata/EventStatusTest.php b/tests/Zend/Gdata/EventStatusTest.php deleted file mode 100644 index 916f5c860..000000000 --- a/tests/Zend/Gdata/EventStatusTest.php +++ /dev/null @@ -1,126 +0,0 @@ -eventStatusText = file_get_contents( - 'Zend/Gdata/_files/EventStatusElementSample1.xml', - true); - $this->eventStatus = new Zend_Gdata_Extension_EventStatus(); - } - - public function testEmptyEventStatusShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->eventStatus->extensionElements)); - $this->assertTrue(count($this->eventStatus->extensionElements) == 0); - } - - public function testEmptyEventStatusShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->eventStatus->extensionAttributes)); - $this->assertTrue(count($this->eventStatus->extensionAttributes) == 0); - } - - public function testSampleEventStatusShouldHaveNoExtensionElements() { - $this->eventStatus->transferFromXML($this->eventStatusText); - $this->assertTrue(is_array($this->eventStatus->extensionElements)); - $this->assertTrue(count($this->eventStatus->extensionElements) == 0); - } - - public function testSampleEventStatusShouldHaveNoExtensionAttributes() { - $this->eventStatus->transferFromXML($this->eventStatusText); - $this->assertTrue(is_array($this->eventStatus->extensionAttributes)); - $this->assertTrue(count($this->eventStatus->extensionAttributes) == 0); - } - - public function testNormalEventStatusShouldHaveNoExtensionElements() { - $this->eventStatus->value = "http://schemas.google.com/g/2005#event.tentative"; - - $this->assertEquals("http://schemas.google.com/g/2005#event.tentative", $this->eventStatus->value); - - $this->assertEquals(0, count($this->eventStatus->extensionElements)); - $newEventStatus = new Zend_Gdata_Extension_EventStatus(); - $newEventStatus->transferFromXML($this->eventStatus->saveXML()); - $this->assertEquals(0, count($newEventStatus->extensionElements)); - $newEventStatus->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newEventStatus->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.tentative", $newEventStatus->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newEventStatus2 = $gdata->newEventStatus(); - $newEventStatus2->transferFromXML($newEventStatus->saveXML()); - $this->assertEquals(1, count($newEventStatus2->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.tentative", $newEventStatus2->value); - } - - public function testEmptyEventStatusToAndFromStringShouldMatch() { - $eventStatusXml = $this->eventStatus->saveXML(); - $newEventStatus = new Zend_Gdata_Extension_EventStatus(); - $newEventStatus->transferFromXML($eventStatusXml); - $newEventStatusXml = $newEventStatus->saveXML(); - $this->assertTrue($eventStatusXml == $newEventStatusXml); - } - - public function testEventStatusWithValueToAndFromStringShouldMatch() { - $this->eventStatus->value = "http://schemas.google.com/g/2005#event.tentative"; - $eventStatusXml = $this->eventStatus->saveXML(); - $newEventStatus = new Zend_Gdata_Extension_EventStatus(); - $newEventStatus->transferFromXML($eventStatusXml); - $newEventStatusXml = $newEventStatus->saveXML(); - $this->assertTrue($eventStatusXml == $newEventStatusXml); - $this->assertEquals("http://schemas.google.com/g/2005#event.tentative", $this->eventStatus->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->eventStatus->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->eventStatus->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->eventStatus->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->eventStatus->extensionAttributes['foo2']['value']); - $eventStatusXml = $this->eventStatus->saveXML(); - $newEventStatus = new Zend_Gdata_Extension_EventStatus(); - $newEventStatus->transferFromXML($eventStatusXml); - $this->assertEquals('bar', $newEventStatus->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newEventStatus->extensionAttributes['foo2']['value']); - } - - public function testConvertFullEventStatusToAndFromString() { - $this->eventStatus->transferFromXML($this->eventStatusText); - $this->assertEquals("http://schemas.google.com/g/2005#event.confirmed", $this->eventStatus->value); - } - -} diff --git a/tests/Zend/Gdata/ExtendedPropertyTest.php b/tests/Zend/Gdata/ExtendedPropertyTest.php deleted file mode 100644 index afb2f8ea7..000000000 --- a/tests/Zend/Gdata/ExtendedPropertyTest.php +++ /dev/null @@ -1,133 +0,0 @@ -extendedPropertyText = file_get_contents( - 'Zend/Gdata/_files/ExtendedPropertyElementSample1.xml', - true); - $this->extendedProperty = new Zend_Gdata_Extension_ExtendedProperty(); - } - - public function testEmptyExtendedPropertyShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->extendedProperty->extensionElements)); - $this->assertTrue(count($this->extendedProperty->extensionElements) == 0); - } - - public function testEmptyExtendedPropertyShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->extendedProperty->extensionAttributes)); - $this->assertTrue(count($this->extendedProperty->extensionAttributes) == 0); - } - - public function testSampleExtendedPropertyShouldHaveNoExtensionElements() { - $this->extendedProperty->transferFromXML($this->extendedPropertyText); - $this->assertTrue(is_array($this->extendedProperty->extensionElements)); - $this->assertTrue(count($this->extendedProperty->extensionElements) == 0); - } - - public function testSampleExtendedPropertyShouldHaveNoExtensionAttributes() { - $this->extendedProperty->transferFromXML($this->extendedPropertyText); - $this->assertTrue(is_array($this->extendedProperty->extensionAttributes)); - $this->assertTrue(count($this->extendedProperty->extensionAttributes) == 0); - } - - public function testNormalExtendedPropertyShouldHaveNoExtensionElements() { - $this->extendedProperty->name = "http://www.example.com/schemas/2007#mycal.foo"; - $this->extendedProperty->value = "5678"; - - $this->assertEquals("http://www.example.com/schemas/2007#mycal.foo", $this->extendedProperty->name); - $this->assertEquals("5678", $this->extendedProperty->value); - - $this->assertEquals(0, count($this->extendedProperty->extensionElements)); - $newExtendedProperty = new Zend_Gdata_Extension_ExtendedProperty(); - $newExtendedProperty->transferFromXML($this->extendedProperty->saveXML()); - $this->assertEquals(0, count($newExtendedProperty->extensionElements)); - $newExtendedProperty->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newExtendedProperty->extensionElements)); - $this->assertEquals("http://www.example.com/schemas/2007#mycal.foo", $newExtendedProperty->name); - $this->assertEquals("5678", $newExtendedProperty->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newExtendedProperty2 = $gdata->newExtendedProperty(); - $newExtendedProperty2->transferFromXML($newExtendedProperty->saveXML()); - $this->assertEquals(1, count($newExtendedProperty2->extensionElements)); - $this->assertEquals("http://www.example.com/schemas/2007#mycal.foo", $newExtendedProperty2->name); - $this->assertEquals("5678", $newExtendedProperty2->value); - } - - public function testEmptyExtendedPropertyToAndFromStringShouldMatch() { - $extendedPropertyXml = $this->extendedProperty->saveXML(); - $newExtendedProperty = new Zend_Gdata_Extension_ExtendedProperty(); - $newExtendedProperty->transferFromXML($extendedPropertyXml); - $newExtendedPropertyXml = $newExtendedProperty->saveXML(); - $this->assertTrue($extendedPropertyXml == $newExtendedPropertyXml); - } - - public function testExtendedPropertyWithValueToAndFromStringShouldMatch() { - $this->extendedProperty->name = "http://www.example.com/schemas/2007#mycal.foo"; - $this->extendedProperty->value = "5678"; - $extendedPropertyXml = $this->extendedProperty->saveXML(); - $newExtendedProperty = new Zend_Gdata_Extension_ExtendedProperty(); - $newExtendedProperty->transferFromXML($extendedPropertyXml); - $newExtendedPropertyXml = $newExtendedProperty->saveXML(); - $this->assertTrue($extendedPropertyXml == $newExtendedPropertyXml); - $this->assertEquals("http://www.example.com/schemas/2007#mycal.foo", $this->extendedProperty->name); - $this->assertEquals("5678", $this->extendedProperty->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->extendedProperty->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->extendedProperty->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->extendedProperty->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->extendedProperty->extensionAttributes['foo2']['value']); - $extendedPropertyXml = $this->extendedProperty->saveXML(); - $newExtendedProperty = new Zend_Gdata_Extension_ExtendedProperty(); - $newExtendedProperty->transferFromXML($extendedPropertyXml); - $this->assertEquals('bar', $newExtendedProperty->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newExtendedProperty->extensionAttributes['foo2']['value']); - } - - public function testConvertFullExtendedPropertyToAndFromString() { - $this->extendedProperty->transferFromXML($this->extendedPropertyText); - $this->assertEquals("http://www.example.com/schemas/2007#mycal.id", $this->extendedProperty->name); - $this->assertEquals("1234", $this->extendedProperty->value); - } - -} diff --git a/tests/Zend/Gdata/FeedLinkTest.php b/tests/Zend/Gdata/FeedLinkTest.php deleted file mode 100644 index 1207c1f0a..000000000 --- a/tests/Zend/Gdata/FeedLinkTest.php +++ /dev/null @@ -1,149 +0,0 @@ -feedLinkText = file_get_contents( - 'Zend/Gdata/_files/FeedLinkElementSample1.xml', - true); - $this->feedLink = new Zend_Gdata_Extension_FeedLink(); - } - - public function testEmptyFeedLinkShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->feedLink->extensionElements)); - $this->assertTrue(count($this->feedLink->extensionElements) == 0); - } - - public function testEmptyFeedLinkShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->feedLink->extensionAttributes)); - $this->assertTrue(count($this->feedLink->extensionAttributes) == 0); - } - - public function testSampleFeedLinkShouldHaveNoExtensionElements() { - $this->feedLink->transferFromXML($this->feedLinkText); - $this->assertTrue(is_array($this->feedLink->extensionElements)); - $this->assertTrue(count($this->feedLink->extensionElements) == 0); - } - - public function testSampleFeedLinkShouldHaveNoExtensionAttributes() { - $this->feedLink->transferFromXML($this->feedLinkText); - $this->assertTrue(is_array($this->feedLink->extensionAttributes)); - $this->assertTrue(count($this->feedLink->extensionAttributes) == 0); - } - - public function testNormalFeedLinkShouldHaveNoExtensionElements() { - $this->feedLink->href = "http://www.google.com/calendar/feeds/default/private/full"; - $this->feedLink->rel = "via"; - $this->feedLink->countHint = "5"; - $this->feedLink->readOnly = false; - - $this->assertEquals("http://www.google.com/calendar/feeds/default/private/full", $this->feedLink->href); - $this->assertEquals("via", $this->feedLink->rel); - $this->assertEquals("5", $this->feedLink->countHint); - $this->assertEquals(false, $this->feedLink->readOnly); - - $this->assertEquals(0, count($this->feedLink->extensionElements)); - $newFeedLink = new Zend_Gdata_Extension_FeedLink(); - $newFeedLink->transferFromXML($this->feedLink->saveXML()); - $this->assertEquals(0, count($newFeedLink->extensionElements)); - $newFeedLink->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newFeedLink->extensionElements)); - $this->assertEquals("http://www.google.com/calendar/feeds/default/private/full", $newFeedLink->href); - $this->assertEquals("via", $newFeedLink->rel); - $this->assertEquals("5", $newFeedLink->countHint); - $this->assertEquals(false, $newFeedLink->readOnly); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newFeedLink2 = $gdata->newFeedLink(); - $newFeedLink2->transferFromXML($newFeedLink->saveXML()); - $this->assertEquals(1, count($newFeedLink2->extensionElements)); - $this->assertEquals("http://www.google.com/calendar/feeds/default/private/full", $newFeedLink2->href); - $this->assertEquals("via", $newFeedLink2->rel); - $this->assertEquals("5", $newFeedLink2->countHint); - $this->assertEquals(false, $newFeedLink2->readOnly); - } - - public function testEmptyFeedLinkToAndFromStringShouldMatch() { - $feedLinkXml = $this->feedLink->saveXML(); - $newFeedLink = new Zend_Gdata_Extension_FeedLink(); - $newFeedLink->transferFromXML($feedLinkXml); - $newFeedLinkXml = $newFeedLink->saveXML(); - $this->assertTrue($feedLinkXml == $newFeedLinkXml); - } - - public function testFeedLinkWithValueToAndFromStringShouldMatch() { - $this->feedLink->href = "http://www.google.com/calendar/feeds/default/private/full"; - $this->feedLink->rel = "via"; - $this->feedLink->countHint = "5"; - $this->feedLink->readOnly = false; - $feedLinkXml = $this->feedLink->saveXML(); - $newFeedLink = new Zend_Gdata_Extension_FeedLink(); - $newFeedLink->transferFromXML($feedLinkXml); - $newFeedLinkXml = $newFeedLink->saveXML(); - $this->assertTrue($feedLinkXml == $newFeedLinkXml); - $this->assertEquals("http://www.google.com/calendar/feeds/default/private/full", $this->feedLink->href); - $this->assertEquals("via", $this->feedLink->rel); - $this->assertEquals("5", $this->feedLink->countHint); - $this->assertEquals(false, $this->feedLink->readOnly); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->feedLink->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->feedLink->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->feedLink->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->feedLink->extensionAttributes['foo2']['value']); - $feedLinkXml = $this->feedLink->saveXML(); - $newFeedLink = new Zend_Gdata_Extension_FeedLink(); - $newFeedLink->transferFromXML($feedLinkXml); - $this->assertEquals('bar', $newFeedLink->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newFeedLink->extensionAttributes['foo2']['value']); - } - - public function testConvertFullFeedLinkToAndFromString() { - $this->feedLink->transferFromXML($this->feedLinkText); - $this->assertEquals("http://www.google.com/calendar/feeds/default/private/full/3tsi3ag1q40bnsik88k25sgpss/comments", $this->feedLink->href); - $this->assertEquals("http://schemas.google.com/g/2005#feed", $this->feedLink->rel); - $this->assertEquals("0", $this->feedLink->countHint); - $this->assertEquals(true, $this->feedLink->readOnly); - $this->assertTrue($this->feedLink->feed instanceof Zend_Gdata_App_Feed); - $this->assertEquals("Comments for: Sample Event", $this->feedLink->feed->title->text); - } - -} diff --git a/tests/Zend/Gdata/FeedTest.php b/tests/Zend/Gdata/FeedTest.php deleted file mode 100644 index c9fc46302..000000000 --- a/tests/Zend/Gdata/FeedTest.php +++ /dev/null @@ -1,159 +0,0 @@ -etagLocalName = 'etag'; - $this->expectedEtag = 'W/"CE4BRXw4cCp7ImA9WxRVFEs."'; - $this->expectedMismatchExceptionMessage = "ETag mismatch"; - $this->feed = new Zend_Gdata_Feed(); - $this->feedTextV1 = file_get_contents( - 'Zend/Gdata/_files/FeedSampleV1.xml', - true); - $this->feedTextV2 = file_get_contents( - 'Zend/Gdata/_files/FeedSampleV2.xml', - true); - $this->gdNamespace = 'http://schemas.google.com/g/2005'; - $this->openSearchNamespacev1 = 'http://a9.com/-/spec/opensearchrss/1.0/'; - $this->openSearchNamespacev2 = 'http://a9.com/-/spec/opensearch/1.1/'; - } - - public function testXMLHasNoEtagsWhenUsingV1() { - $etagData = 'Quux'; - $this->feed->setEtag($etagData); - $domNode = $this->feed->getDOM(null, 1, null); - $this->assertNull( - $domNode->attributes->getNamedItemNS( - $this->gdNamespace, $this->etagLocalName)); - } - - public function testXMLHasNoEtagsWhenUsingV1X() { - $etagData = 'Quux'; - $this->feed->setEtag($etagData); - $domNode = $this->feed->getDOM(null, 1, 1); - $this->assertNull( - $domNode->attributes->getNamedItemNS( - $this->gdNamespace, $this->etagLocalName)); - } - - public function testXMLHasEtagsWhenUsingV2() { - $etagData = 'Quux'; - $this->feed->setEtag($etagData); - $domNode = $this->feed->getDOM(null, 2, null); - $this->assertEquals( - $etagData, - $domNode->attributes->getNamedItemNS( - $this->gdNamespace, $this->etagLocalName)->nodeValue); - } - - public function testXMLHasEtagsWhenUsingV2X() { - $etagData = 'Quux'; - $this->feed->setEtag($etagData); - $domNode = $this->feed->getDOM(null, 2, 1); - $this->assertEquals( - $etagData, - $domNode->attributes->getNamedItemNS( - $this->gdNamespace, $this->etagLocalName)->nodeValue); - } - - public function testXMLETagsPropagateToFeed() { - $this->feed->transferFromXML($this->feedTextV2); - $etagValue = $this->feed->getEtag(); - $this->assertEquals($this->expectedEtag, $this->feed->getEtag()); - } - - public function testXMLandHTMLEtagsDifferingThrowsException() { - $exceptionCaught = false; - $this->feed->setEtag("Foo"); - try { - $this->feed->transferFromXML($this->feedTextV2); - } catch (Zend_Gdata_App_IOException $e) { - $exceptionCaught = true; - } - $this->assertTrue($exceptionCaught, "Exception Zend_Gdata_IO_Exception expected"); - } - - public function testHttpAndXmlEtagsDifferingThrowsExceptionWithMessage() { - $messageCorrect = false; - $this->feed->setEtag("Foo"); - try { - $this->feed->transferFromXML($this->feedTextV2); - } catch (Zend_Gdata_App_IOException $e) { - if ($e->getMessage() == $this->expectedMismatchExceptionMessage) - $messageCorrect = true; - } - $this->assertTrue($messageCorrect, "Exception Zend_Gdata_IO_Exception message incorrect"); - } - - public function testNothingBadHappensWhenHttpAndXmlEtagsMatch() { - $this->feed->setEtag($this->expectedEtag); - $this->feed->transferFromXML($this->feedTextV2); - $this->assertEquals($this->expectedEtag, $this->feed->getEtag()); - } - - public function testLookUpOpenSearchv1Namespace() { - $this->feed->setMajorProtocolVersion(1); - $this->feed->setMinorProtocolVersion(0); - $this->assertEquals($this->openSearchNamespacev1, - $this->feed->lookupNamespace('openSearch', 1)); - $this->feed->setMinorProtocolVersion(null); - $this->assertEquals($this->openSearchNamespacev1, - $this->feed->lookupNamespace('openSearch', 1)); - } - - public function testLookupOpenSearchv2Namespace() { - $this->feed->setMajorProtocolVersion(2); - $this->feed->setMinorProtocolVersion(0); - $this->assertEquals($this->openSearchNamespacev2, - $this->feed->lookupNamespace('openSearch')); - $this->feed->setMinorProtocolVersion(null); - $this->assertEquals($this->openSearchNamespacev2, - $this->feed->lookupNamespace('openSearch')); - } - - public function testNoExtensionElementsInV1Feed() { - $this->feed->setMajorProtocolVersion(1); - $this->feed->transferFromXML($this->feedTextV1); - $this->assertEquals(0, sizeof($this->feed->extensionElements)); - } - - public function testNoExtensionElementsInV2Feed() { - $this->feed->setMajorProtocolVersion(2); - $this->feed->transferFromXML($this->feedTextV2); - $this->assertEquals(0, sizeof($this->feed->extensionElements)); - } -} diff --git a/tests/Zend/Gdata/Gapps/EmailListEntryTest.php b/tests/Zend/Gdata/Gapps/EmailListEntryTest.php deleted file mode 100644 index 2214c4188..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListEntryTest.php +++ /dev/null @@ -1,141 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_EmailListEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($emailListEntry) { - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales', - $emailListEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $emailListEntry->updated->text); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $emailListEntry->category[0]->scheme); - $this->assertEquals('http://schemas.google.com/apps/2006#emailList', $emailListEntry->category[0]->term); - $this->assertEquals('text', $emailListEntry->title->type); - $this->assertEquals('us-sales', $emailListEntry->title->text);; - $this->assertEquals('self', $emailListEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $emailListEntry->getLink('self')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales', $emailListEntry->getLink('self')->href); - $this->assertEquals('edit', $emailListEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $emailListEntry->getLink('edit')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales', $emailListEntry->getLink('edit')->href); - $this->assertEquals('us-sales', $emailListEntry->emailList->name); - $this->assertEquals('http://schemas.google.com/apps/2006#emailList.recipients', $emailListEntry->getFeedLink('http://schemas.google.com/apps/2006#emailList.recipients')->rel); - $this->assertEquals('http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/', $emailListEntry->getFeedLink('http://schemas.google.com/apps/2006#emailList.recipients')->href); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyEmailListEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newEmailListEntry = new Zend_Gdata_Gapps_EmailListEntry(); - $newEmailListEntry->transferFromXML($entryXml); - $newEmailListEntryXml = $newEmailListEntry->saveXML(); - $this->assertTrue($entryXml == $newEmailListEntryXml); - } - - public function testGetFeedLinkReturnsAllStoredEntriesWhenUsedWithNoParameters() { - // Prepare test data - $entry1 = new Zend_Gdata_Extension_FeedLink(); - $entry1->rel = "first"; - $entry1->href= "foo"; - $entry2 = new Zend_Gdata_Extension_FeedLink(); - $entry2->rel = "second"; - $entry2->href= "bar"; - $data = array($entry1, $entry2); - - // Load test data and run test - $this->entry->feedLink = $data; - $this->assertEquals(2, count($this->entry->feedLink)); - } - - public function testGetFeedLinkCanReturnEntriesByRelValue() { - // Prepare test data - $entry1 = new Zend_Gdata_Extension_FeedLink(); - $entry1->rel = "first"; - $entry1->href= "foo"; - $entry2 = new Zend_Gdata_Extension_FeedLink(); - $entry2->rel = "second"; - $entry2->href= "bar"; - $data = array($entry1, $entry2); - - // Load test data and run test - $this->entry->feedLink = $data; - $this->assertEquals($entry1, $this->entry->getFeedLink('first')); - $this->assertEquals($entry2, $this->entry->getFeedLink('second')); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertEmailListEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newEmailListEntry = new Zend_Gdata_Gapps_EmailListEntry(); - $newEmailListEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newEmailListEntry); - $newEmailListEntryXml = $newEmailListEntry->saveXML(); - $this->assertEquals($entryXml, $newEmailListEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/EmailListFeedTest.php b/tests/Zend/Gdata/Gapps/EmailListFeedTest.php deleted file mode 100644 index cbeb821df..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -emailListFeed = new Zend_Gdata_Gapps_EmailListFeed($emailListFeedText); - $this->emptyEmailListFeed = new Zend_Gdata_Gapps_EmailListFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyEmailListFeed->extensionElements)); - $this->assertTrue(count($this->emptyEmailListFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyEmailListFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyEmailListFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emailListFeed->extensionElements)); - $this->assertTrue(count($this->emailListFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emailListFeed->extensionAttributes)); - $this->assertTrue(count($this->emailListFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->emailListFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->emailListFeed and convert back to objects */ - $newEmailListFeed = new Zend_Gdata_Gapps_EmailListFeed( - $this->emailListFeed->saveXML()); - $newEntryCount = 0; - foreach ($newEmailListFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->emailListFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/EmailListQueryTest.php b/tests/Zend/Gdata/Gapps/EmailListQueryTest.php deleted file mode 100644 index dbe35ebaf..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListQueryTest.php +++ /dev/null @@ -1,139 +0,0 @@ -query = new Zend_Gdata_Gapps_EmailListQuery(); - } - - // Test to make sure that URI generation works - public function testDefaultQueryURIGeneration() - { - $this->query->setDomain("foo.bar.invalid"); - $this->assertEquals("https://apps-apis.google.com/a/feeds/foo.bar.invalid/emailList/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/emailList/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the emailListName accessor methods work and propagate - // to the query URI. - public function testCanSetEmailListNameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setEmailListName("foo"); - $this->assertEquals("foo", $this->query->getEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo", - $this->query->getQueryUrl()); - - $this->query->setEmailListName("bar"); - $this->assertEquals("bar", $this->query->getEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/bar", - $this->query->getQueryUrl()); - } - - // Test to make sure that the recipient accessor methods work and propagate - // to the query URI. - public function testCanSetRecipientProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setRecipient("bar@qux.com"); - $this->assertEquals("bar@qux.com", $this->query->getRecipient()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0?recipient=bar%40qux.com", - $this->query->getQueryUrl()); - - $this->query->setRecipient(null); - $this->assertEquals(null, $this->query->getRecipient()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the startUsername accessor methods work and - // propagate to the query URI. - public function testCanSetStartEmailListNameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setStartEmailListName("foo"); - $this->assertEquals("foo", $this->query->getStartEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0?startEmailListName=foo", - $this->query->getQueryUrl()); - - $this->query->setStartEmailListName(null); - $this->assertEquals(null, $this->query->getStartEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that all parameters can be set simultaneously with no - // ill effects. - public function testCanSetAllParameters() - { - $this->query->setDomain("my.domain.com"); - $this->query->setEmailListName("foo"); - $this->query->setRecipient("bar@qux.com"); - $this->query->setStartEmailListName("wibble"); - $this->assertEquals("foo", $this->query->getEmailListName()); - $this->assertEquals("bar@qux.com", $this->query->getRecipient()); - $this->assertEquals("wibble", $this->query->getStartEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo?recipient=bar%40qux.com&startEmailListName=wibble", - $this->query->getQueryUrl()); - - $this->query->setRecipient("baz@blah.com"); - $this->query->setEmailListName("xyzzy"); - $this->query->setStartEmailListName("woof"); - $this->assertEquals("xyzzy", $this->query->getEmailListName()); - $this->assertEquals("baz@blah.com", $this->query->getRecipient()); - $this->assertEquals("woof", $this->query->getStartEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/xyzzy?recipient=baz%40blah.com&startEmailListName=woof", - $this->query->getQueryUrl()); - } - -} diff --git a/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php b/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php deleted file mode 100644 index 6f20197e3..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php +++ /dev/null @@ -1,108 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_EmailListRecipientEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($emailListRecipientEntry) { - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com', - $emailListRecipientEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $emailListRecipientEntry->updated->text); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $emailListRecipientEntry->category[0]->scheme); - $this->assertEquals('http://schemas.google.com/apps/2006#emailList.recipient', $emailListRecipientEntry->category[0]->term); - $this->assertEquals('text', $emailListRecipientEntry->title->type); - $this->assertEquals('SusanJones', $emailListRecipientEntry->title->text);; - $this->assertEquals('self', $emailListRecipientEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $emailListRecipientEntry->getLink('self')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com', $emailListRecipientEntry->getLink('self')->href); - $this->assertEquals('edit', $emailListRecipientEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $emailListRecipientEntry->getLink('edit')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com', $emailListRecipientEntry->getLink('edit')->href); - $this->assertEquals('SusanJones@example.com', $emailListRecipientEntry->who->email); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyEmailListRecipientEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newEmailListRecipientEntry = new Zend_Gdata_Gapps_EmailListRecipientEntry(); - $newEmailListRecipientEntry->transferFromXML($entryXml); - $newEmailListRecipientEntryXml = $newEmailListRecipientEntry->saveXML(); - $this->assertTrue($entryXml == $newEmailListRecipientEntryXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertEmailListRecipientEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newEmailListRecipientEntry = new Zend_Gdata_Gapps_EmailListRecipientEntry(); - $newEmailListRecipientEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newEmailListRecipientEntry); - $newEmailListRecipientEntryXml = $newEmailListRecipientEntry->saveXML(); - $this->assertEquals($entryXml, $newEmailListRecipientEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php b/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php deleted file mode 100644 index 0f6f2d34a..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -emailListRecipientFeed = new Zend_Gdata_Gapps_EmailListRecipientFeed($emailListRecipientFeedText); - $this->emptyEmailListRecipientFeed = new Zend_Gdata_Gapps_EmailListRecipientFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyEmailListRecipientFeed->extensionElements)); - $this->assertTrue(count($this->emptyEmailListRecipientFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyEmailListRecipientFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyEmailListRecipientFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emailListRecipientFeed->extensionElements)); - $this->assertTrue(count($this->emailListRecipientFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emailListRecipientFeed->extensionAttributes)); - $this->assertTrue(count($this->emailListRecipientFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->emailListRecipientFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListRecipientEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->emailListRecipientFeed and convert back to objects */ - $newEmailListRecipientFeed = new Zend_Gdata_Gapps_EmailListRecipientFeed( - $this->emailListRecipientFeed->saveXML()); - $newEntryCount = 0; - foreach ($newEmailListRecipientFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListRecipientEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->emailListRecipientFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php b/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php deleted file mode 100644 index f1a42014f..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php +++ /dev/null @@ -1,91 +0,0 @@ -query = new Zend_Gdata_Gapps_EmailListRecipientQuery(); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setEmailListName("something"); - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/something/recipient/", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/emailList/2.0/something/recipient/", - $this->query->getQueryUrl()); - } - - // Test to make sure that the emailListName accessor methods work and propagate - // to the query URI. - public function testCanSetEmailListNameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setEmailListName("foo"); - $this->assertEquals("foo", $this->query->getEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/", - $this->query->getQueryUrl()); - - $this->query->setEmailListName("bar"); - $this->assertEquals("bar", $this->query->getEmailListName()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/bar/recipient/", - $this->query->getQueryUrl()); - } - - public function testCanSetStartRecipientProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setEmailListName("foo"); - $this->query->setStartRecipient("bar"); - $this->assertEquals("bar", $this->query->getStartRecipient()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/?startRecipient=bar", - $this->query->getQueryUrl()); - - $this->query->setStartRecipient(null); - $this->assertEquals(null, $this->query->getStartRecipient()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/", - $this->query->getQueryUrl()); - } - -} diff --git a/tests/Zend/Gdata/Gapps/EmailListTest.php b/tests/Zend/Gdata/Gapps/EmailListTest.php deleted file mode 100644 index 0541b279e..000000000 --- a/tests/Zend/Gdata/Gapps/EmailListTest.php +++ /dev/null @@ -1,127 +0,0 @@ -emailListText = file_get_contents( - 'Zend/Gdata/Gapps/_files/EmailListElementSample1.xml', - true); - $this->emailList = new Zend_Gdata_Gapps_Extension_EmailList(); - } - - public function testEmptyEmailListShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emailList->extensionElements)); - $this->assertTrue(count($this->emailList->extensionElements) == 0); - } - - public function testEmptyEmailListShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emailList->extensionAttributes)); - $this->assertTrue(count($this->emailList->extensionAttributes) == 0); - } - - public function testSampleEmailListShouldHaveNoExtensionElements() { - $this->emailList->transferFromXML($this->emailListText); - $this->assertTrue(is_array($this->emailList->extensionElements)); - $this->assertTrue(count($this->emailList->extensionElements) == 0); - } - - public function testSampleEmailListShouldHaveNoExtensionAttributes() { - $this->emailList->transferFromXML($this->emailListText); - $this->assertTrue(is_array($this->emailList->extensionAttributes)); - $this->assertTrue(count($this->emailList->extensionAttributes) == 0); - } - - public function testNormalEmailListShouldHaveNoExtensionElements() { - $this->emailList->name = "test-name"; - - $this->assertEquals("test-name", $this->emailList->name); - - $this->assertEquals(0, count($this->emailList->extensionElements)); - $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList(); - $newEmailList->transferFromXML($this->emailList->saveXML()); - $this->assertEquals(0, count($newEmailList->extensionElements)); - $newEmailList->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newEmailList->extensionElements)); - $this->assertEquals("test-name", $newEmailList->name); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata_Gapps(); - $newEmailList2 = $gdata->newEmailList(); - $newEmailList2->transferFromXML($newEmailList->saveXML()); - $this->assertEquals(1, count($newEmailList2->extensionElements)); - $this->assertEquals("test-name", $newEmailList2->name); - } - - public function testEmptyEmailListToAndFromStringShouldMatch() { - $emailListXml = $this->emailList->saveXML(); - $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList(); - $newEmailList->transferFromXML($emailListXml); - $newEmailListXml = $newEmailList->saveXML(); - $this->assertTrue($emailListXml == $newEmailListXml); - } - - public function testEmailListWithValueToAndFromStringShouldMatch() { - $this->emailList->name = "test-name"; - $emailListXml = $this->emailList->saveXML(); - $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList(); - $newEmailList->transferFromXML($emailListXml); - $newEmailListXml = $newEmailList->saveXML(); - $this->assertTrue($emailListXml == $newEmailListXml); - $this->assertEquals("test-name", $this->emailList->name); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->emailList->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->emailList->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->emailList->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->emailList->extensionAttributes['foo2']['value']); - $emailListXml = $this->emailList->saveXML(); - $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList(); - $newEmailList->transferFromXML($emailListXml); - $this->assertEquals('bar', $newEmailList->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newEmailList->extensionAttributes['foo2']['value']); - } - - public function testConvertFullEmailListToAndFromString() { - $this->emailList->transferFromXML($this->emailListText); - $this->assertEquals("us-sales", $this->emailList->name); - } - -} diff --git a/tests/Zend/Gdata/Gapps/ErrorTest.php b/tests/Zend/Gdata/Gapps/ErrorTest.php deleted file mode 100644 index 2867149af..000000000 --- a/tests/Zend/Gdata/Gapps/ErrorTest.php +++ /dev/null @@ -1,89 +0,0 @@ -error = new Zend_Gdata_Gapps_Error(); - } - - public function testCanSetAndGetErrorCodeUsingConstant() { - $this->error->setErrorCode( - Zend_Gdata_Gapps_Error::INVALID_EMAIL_ADDRESS); - $this->assertEquals(Zend_Gdata_Gapps_Error::INVALID_EMAIL_ADDRESS, - $this->error->getErrorCode()); - } - - public function testCanSetAndGetErrorCodeUsingInteger() { - $this->error->setErrorCode(123); - $this->assertEquals(123, $this->error->getErrorCode()); - } - - public function testCanSetAndGetReason() { - $text = "The foo is missing a bar."; - $this->error->setReason($text); - $this->assertEquals($text, $this->error->getReason()); - } - - public function testCanSetAndGetInvalidInput() { - $text = "for___baz"; - $this->error->setInvalidInput($text); - $this->assertEquals($text, $this->error->getInvalidInput()); - } - - public function testContstructorAllowsSettingAllVariables() { - $this->error = new Zend_Gdata_Gapps_Error( - Zend_Gdata_Gapps_Error::USER_DELETED_RECENTLY, - "foo", "bar"); - $this->assertEquals(Zend_Gdata_Gapps_Error::USER_DELETED_RECENTLY, - $this->error->getErrorCode()); - $this->assertEquals("foo", $this->error->getReason()); - $this->assertEquals("bar", $this->error->getInvalidInput()); - } - - public function testToStringProvidesHelpfulMessage() { - $this->error->setErrorCode(Zend_Gdata_Gapps_Error::USER_SUSPENDED); - $this->error->setReason("The foo is missing a bar."); - $this->error->setInvalidInput("for___baz"); - $this->assertEquals("Error 1101: The foo is missing a bar.\n\tInvalid Input: \"for___baz\"", $this->error->__toString()); - - $this->error->setErrorCode(Zend_Gdata_Gapps_Error::UNKNOWN_ERROR); - $this->error->setReason("Unknown error."); - $this->error->setInvalidInput("blah"); - $this->assertEquals("Error 1000: Unknown error.\n\tInvalid Input: \"blah\"", $this->error->__toString()); - } - -} diff --git a/tests/Zend/Gdata/Gapps/GroupEntryTest.php b/tests/Zend/Gdata/Gapps/GroupEntryTest.php deleted file mode 100644 index a747e9b8c..000000000 --- a/tests/Zend/Gdata/Gapps/GroupEntryTest.php +++ /dev/null @@ -1,111 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_GroupEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($groupEntry) { - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales', - $groupEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $groupEntry->updated->text); - $this->assertEquals('self', $groupEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $groupEntry->getLink('self')->type); - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales', $groupEntry->getLink('self')->href); - $this->assertEquals('edit', $groupEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $groupEntry->getLink('edit')->type); - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales', $groupEntry->getLink('edit')->href); - $this->assertEquals('groupId', $groupEntry->property[0]->name); - $this->assertEquals('us-sales', $groupEntry->property[0]->value); - $this->assertEquals('groupName', $groupEntry->property[1]->name); - $this->assertEquals('us-sales', $groupEntry->property[1]->value); - $this->assertEquals('description', $groupEntry->property[2]->name); - $this->assertEquals('UnitedStatesSalesTeam', $groupEntry->property[2]->value); - $this->assertEquals('emailPermission', $groupEntry->property[3]->name); - $this->assertEquals('Domain', $groupEntry->property[3]->value); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyGroupEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newGroupEntry = new Zend_Gdata_Gapps_GroupEntry(); - $newGroupEntry->transferFromXML($entryXml); - $newGroupEntryXml = $newGroupEntry->saveXML(); - $this->assertTrue($entryXml == $newGroupEntryXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertGroupEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newGroupEntry = new Zend_Gdata_Gapps_GroupEntry(); - $newGroupEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newGroupEntry); - $newGroupEntryXml = $newGroupEntry->saveXML(); - $this->assertEquals($entryXml, $newGroupEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/GroupFeedTest.php b/tests/Zend/Gdata/Gapps/GroupFeedTest.php deleted file mode 100644 index c6033dda1..000000000 --- a/tests/Zend/Gdata/Gapps/GroupFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -groupFeed = new Zend_Gdata_Gapps_GroupFeed($groupFeedText); - $this->emptyGroupFeed = new Zend_Gdata_Gapps_GroupFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyGroupFeed->extensionElements)); - $this->assertTrue(count($this->emptyGroupFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyGroupFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyGroupFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->groupFeed->extensionElements)); - $this->assertTrue(count($this->groupFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->groupFeed->extensionAttributes)); - $this->assertTrue(count($this->groupFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of GroupEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->groupFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_GroupEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->groupFeed and convert back to objects */ - $newGroupFeed = new Zend_Gdata_Gapps_GroupFeed( - $this->groupFeed->saveXML()); - $newEntryCount = 0; - foreach ($newGroupFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_GroupEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of group entries equals the number - * of groups defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->groupFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/GroupQueryTest.php b/tests/Zend/Gdata/Gapps/GroupQueryTest.php deleted file mode 100644 index 4dfb01242..000000000 --- a/tests/Zend/Gdata/Gapps/GroupQueryTest.php +++ /dev/null @@ -1,169 +0,0 @@ -query = new Zend_Gdata_Gapps_GroupQuery(); - } - - // Test to make sure that URI generation works - public function testDefaultQueryURIGeneration() - { - $this->query->setDomain("foo.bar.invalid"); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/foo.bar.invalid", - $this->query->getQueryUrl()); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/hello.world.baz", - $this->query->getQueryUrl()); - } - - // Test to make sure that the groupId accessor methods work and propagate - // to the query URI. - public function testCanSetGroupIdProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->assertEquals("foo", $this->query->getGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo", - $this->query->getQueryUrl()); - - $this->query->setGroupId("bar"); - $this->assertEquals("bar", $this->query->getGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar", - $this->query->getQueryUrl()); - } - - // Test to make sure that the member accessor methods work and propagate - // to the query URI. - public function testCanSetMemberProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setMember("bar@qux.com"); - $this->assertEquals("bar@qux.com", $this->query->getMember()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/?member=bar%40qux.com", - $this->query->getQueryUrl()); - - $this->query->setMember(null); - $this->assertEquals(null, $this->query->getMember()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com", - $this->query->getQueryUrl()); - } - - // Test to make sure that the startUsername accessor methods work and - // propagate to the query URI. - public function testCanSetStartGroupIdProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setStartGroupId("foo"); - $this->assertEquals("foo", $this->query->getStartGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com?start=foo", - $this->query->getQueryUrl()); - - $this->query->setStartGroupId(null); - $this->assertEquals(null, $this->query->getStartGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com", - $this->query->getQueryUrl()); - } - - public function testCanSetDirectOnlyProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setMember("bar@qux.com"); - $this->query->setDirectOnly(true); - $this->assertEquals(true, $this->query->getDirectOnly()); - $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/"; - $expected_url .= "?member=bar%40qux.com&directOnly=true"; - $this->assertEquals($expected_url, $this->query->getQueryUrl()); - - $this->query->setDirectOnly(false); - $this->assertEquals(false, $this->query->getDirectOnly()); - $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/"; - $expected_url .= "?member=bar%40qux.com&directOnly=false"; - $this->assertEquals($expected_url, $this->query->getQueryUrl()); - - $this->query->setDirectOnly(null); - $this->assertEquals(null, $this->query->getDirectOnly()); - $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/"; - $expected_url .= "?member=bar%40qux.com"; - $this->assertEquals($expected_url, $this->query->getQueryUrl()); - } - - // Test to make sure that all parameters can be set simultaneously with no - // ill effects. - public function testCanSetAllParameters() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->query->setMember("bar@qux.com"); - $this->query->setStartGroupId("wibble"); - $this->query->setDirectOnly(true); - $this->assertEquals("foo", $this->query->getGroupId()); - $this->assertEquals("bar@qux.com", $this->query->getMember()); - $this->assertEquals("wibble", $this->query->getStartGroupId()); - $this->assertEquals(true, $this->query->getDirectOnly()); - $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/"; - $expected_url .= "foo/?member=bar%40qux.com&start=wibble&directOnly=true"; - $this->assertEquals($expected_url, $this->query->getQueryUrl()); - - $this->query->setMember("baz@blah.com"); - $this->query->setGroupId("xyzzy"); - $this->query->setStartGroupId("woof"); - $this->query->setDirectOnly(false); - $this->assertEquals("xyzzy", $this->query->getGroupId()); - $this->assertEquals("baz@blah.com", $this->query->getMember()); - $this->assertEquals("woof", $this->query->getStartGroupId()); - $this->assertEquals(false, $this->query->getDirectOnly()); - $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/"; - $expected_url .= "xyzzy/?member=baz%40blah.com&start=woof&directOnly=false"; - $this->assertEquals($expected_url, $this->query->getQueryUrl()); - } - -} - diff --git a/tests/Zend/Gdata/Gapps/LoginTest.php b/tests/Zend/Gdata/Gapps/LoginTest.php deleted file mode 100644 index 38a0e6134..000000000 --- a/tests/Zend/Gdata/Gapps/LoginTest.php +++ /dev/null @@ -1,170 +0,0 @@ -loginText = file_get_contents( - 'Zend/Gdata/Gapps/_files/LoginElementSample1.xml', - true); - $this->login = new Zend_Gdata_Gapps_Extension_Login(); - } - - public function testEmptyLoginShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->login->extensionElements)); - $this->assertTrue(count($this->login->extensionElements) == 0); - } - - public function testEmptyLoginShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->login->extensionAttributes)); - $this->assertTrue(count($this->login->extensionAttributes) == 0); - } - - public function testSampleLoginShouldHaveNoExtensionElements() { - $this->login->transferFromXML($this->loginText); - $this->assertTrue(is_array($this->login->extensionElements)); - $this->assertTrue(count($this->login->extensionElements) == 0); - } - - public function testSampleLoginShouldHaveNoExtensionAttributes() { - $this->login->transferFromXML($this->loginText); - $this->assertTrue(is_array($this->login->extensionAttributes)); - $this->assertTrue(count($this->login->extensionAttributes) == 0); - } - - public function testNormalLoginShouldHaveNoExtensionElements() { - $this->login->username = "johndoe"; - $this->login->password = "abcdefg1234567890"; - $this->login->hashFunctionName = "Foo"; - $this->login->suspended = true; - $this->login->admin = true; - $this->login->changePasswordAtNextLogin = true; - $this->login->agreedToTerms = false; - - $this->assertEquals("johndoe", $this->login->username); - $this->assertEquals("abcdefg1234567890", $this->login->password); - $this->assertEquals("Foo", $this->login->hashFunctionName); - $this->assertEquals(true, $this->login->suspended); - $this->assertEquals(true, $this->login->admin); - $this->assertEquals(true, $this->login->changePasswordAtNextLogin); - $this->assertEquals(false, $this->login->agreedToTerms); - - $this->assertEquals(0, count($this->login->extensionElements)); - $newLogin = new Zend_Gdata_Gapps_Extension_Login(); - $newLogin->transferFromXML($this->login->saveXML()); - $this->assertEquals(0, count($newLogin->extensionElements)); - $newLogin->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newLogin->extensionElements)); - $this->assertEquals("johndoe", $newLogin->username); - $this->assertEquals("abcdefg1234567890", $newLogin->password); - $this->assertEquals("Foo", $newLogin->hashFunctionName); - $this->assertEquals(true, $newLogin->suspended); - $this->assertEquals(true, $newLogin->admin); - $this->assertEquals(true, $newLogin->changePasswordAtNextLogin); - $this->assertEquals(false, $newLogin->agreedToTerms); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata_Gapps(); - $newLogin2 = $gdata->newLogin(); - $newLogin2->transferFromXML($newLogin->saveXML()); - $this->assertEquals(1, count($newLogin2->extensionElements)); - $this->assertEquals("johndoe", $newLogin2->username); - $this->assertEquals("abcdefg1234567890", $newLogin2->password); - $this->assertEquals("Foo", $newLogin2->hashFunctionName); - $this->assertEquals(true, $newLogin2->suspended); - $this->assertEquals(true, $newLogin2->admin); - $this->assertEquals(true, $newLogin2->changePasswordAtNextLogin); - $this->assertEquals(false, $newLogin2->agreedToTerms); - } - - public function testEmptyLoginToAndFromStringShouldMatch() { - $loginXml = $this->login->saveXML(); - $newLogin = new Zend_Gdata_Gapps_Extension_Login(); - $newLogin->transferFromXML($loginXml); - $newLoginXml = $newLogin->saveXML(); - $this->assertTrue($loginXml == $newLoginXml); - } - - public function testLoginWithValueToAndFromStringShouldMatch() { - $this->login->username = "johndoe"; - $this->login->password = "abcdefg1234567890"; - $this->login->hashFunctionName = "Foo"; - $this->login->suspended = true; - $this->login->admin = true; - $this->login->changePasswordAtNextLogin = true; - $this->login->agreedToTerms = false; - $loginXml = $this->login->saveXML(); - $newLogin = new Zend_Gdata_Gapps_Extension_Login(); - $newLogin->transferFromXML($loginXml); - $newLoginXml = $newLogin->saveXML(); - $this->assertTrue($loginXml == $newLoginXml); - $this->assertEquals("johndoe", $this->login->username); - $this->assertEquals("abcdefg1234567890", $this->login->password); - $this->assertEquals("Foo", $this->login->hashFunctionName); - $this->assertEquals(true, $this->login->suspended); - $this->assertEquals(true, $this->login->admin); - $this->assertEquals(true, $this->login->changePasswordAtNextLogin); - $this->assertEquals(false, $this->login->agreedToTerms); - - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->login->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->login->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->login->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->login->extensionAttributes['foo2']['value']); - $loginXml = $this->login->saveXML(); - $newLogin = new Zend_Gdata_Gapps_Extension_Login(); - $newLogin->transferFromXML($loginXml); - $this->assertEquals('bar', $newLogin->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newLogin->extensionAttributes['foo2']['value']); - } - - public function testConvertFullLoginToAndFromString() { - $this->login->transferFromXML($this->loginText); - $this->assertEquals("SusanJones-1321", $this->login->username); - $this->assertEquals("123\$\$abc", $this->login->password); - $this->assertEquals("SHA-1", $this->login->hashFunctionName); - $this->assertEquals(false, $this->login->suspended); - $this->assertEquals(false, $this->login->admin); - $this->assertEquals(false, $this->login->changePasswordAtNextLogin); - $this->assertEquals(true, $this->login->agreedToTerms); - } - -} diff --git a/tests/Zend/Gdata/Gapps/MemberEntryTest.php b/tests/Zend/Gdata/Gapps/MemberEntryTest.php deleted file mode 100644 index 9869c4746..000000000 --- a/tests/Zend/Gdata/Gapps/MemberEntryTest.php +++ /dev/null @@ -1,109 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_MemberEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($memberEntry) { - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com', - $memberEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $memberEntry->updated->text); - $this->assertEquals('self', $memberEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $memberEntry->getLink('self')->type); - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com', $memberEntry->getLink('self')->href); - $this->assertEquals('edit', $memberEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $memberEntry->getLink('edit')->type); - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com', $memberEntry->getLink('edit')->href); - $this->assertEquals('memberId', $memberEntry->property[0]->name); - $this->assertEquals('suejones@example.com', $memberEntry->property[0]->value); - $this->assertEquals('memberType', $memberEntry->property[1]->name); - $this->assertEquals('User', $memberEntry->property[1]->value); - $this->assertEquals('directMember', $memberEntry->property[2]->name); - $this->assertEquals('true', $memberEntry->property[2]->value); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyMemberEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newMemberEntry = new Zend_Gdata_Gapps_MemberEntry(); - $newMemberEntry->transferFromXML($entryXml); - $newMemberEntryXml = $newMemberEntry->saveXML(); - $this->assertTrue($entryXml == $newMemberEntryXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertMemberEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newMemberEntry = new Zend_Gdata_Gapps_MemberEntry(); - $newMemberEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newMemberEntry); - $newMemberEntryXml = $newMemberEntry->saveXML(); - $this->assertEquals($entryXml, $newMemberEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/MemberFeedTest.php b/tests/Zend/Gdata/Gapps/MemberFeedTest.php deleted file mode 100644 index 00090c477..000000000 --- a/tests/Zend/Gdata/Gapps/MemberFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -memberFeed = new Zend_Gdata_Gapps_MemberFeed($memberFeedText); - $this->emptyMemberFeed = new Zend_Gdata_Gapps_MemberFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyMemberFeed->extensionElements)); - $this->assertTrue(count($this->emptyMemberFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyMemberFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyMemberFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->memberFeed->extensionElements)); - $this->assertTrue(count($this->memberFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->memberFeed->extensionAttributes)); - $this->assertTrue(count($this->memberFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of MemberEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->memberFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_MemberEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->memberFeed and convert back to objects */ - $newMemberFeed = new Zend_Gdata_Gapps_MemberFeed( - $this->memberFeed->saveXML()); - $newEntryCount = 0; - foreach ($newMemberFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_MemberEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of member entries equals the number - * of members defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->memberFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/MemberQueryTest.php b/tests/Zend/Gdata/Gapps/MemberQueryTest.php deleted file mode 100644 index a760ce9f8..000000000 --- a/tests/Zend/Gdata/Gapps/MemberQueryTest.php +++ /dev/null @@ -1,110 +0,0 @@ -query = new Zend_Gdata_Gapps_MemberQuery(); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setGroupId("something"); - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/something/member", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/hello.world.baz/something/member", - $this->query->getQueryUrl()); - } - - // Test to make sure that the groupId accessor methods work and propagate - // to the query URI. - public function testCanSetGroupIdProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->assertEquals("foo", $this->query->getGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member", - $this->query->getQueryUrl()); - - $this->query->setGroupId("bar"); - $this->assertEquals("bar", $this->query->getGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar/member", - $this->query->getQueryUrl()); - } - - // Test to make sure that the memberId accessor methods work and propagate - // to the query URI. - public function testCanSetMemberIdProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->query->setMemberId("bar"); - $this->assertEquals("bar", $this->query->getMemberId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member/bar", - $this->query->getQueryUrl()); - - $this->query->setGroupId("baz"); - $this->query->setMemberId(null); - $this->assertEquals(null, $this->query->getMemberId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/baz/member", - $this->query->getQueryUrl()); - } - - public function testCanSetStartMemberIdProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->query->setStartMemberId("bar"); - $this->assertEquals("bar", $this->query->getStartMemberId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member?start=bar", - $this->query->getQueryUrl()); - - $this->query->setStartMemberId(null); - $this->assertEquals(null, $this->query->getStartMemberId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member", - $this->query->getQueryUrl()); - } - -} - diff --git a/tests/Zend/Gdata/Gapps/NameTest.php b/tests/Zend/Gdata/Gapps/NameTest.php deleted file mode 100644 index 5c41c6660..000000000 --- a/tests/Zend/Gdata/Gapps/NameTest.php +++ /dev/null @@ -1,134 +0,0 @@ -theNameText = file_get_contents( - 'Zend/Gdata/Gapps/_files/NameElementSample1.xml', - true); - $this->theName = new Zend_Gdata_Gapps_Extension_Name(); - } - - public function testEmptyNameShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->theName->extensionElements)); - $this->assertTrue(count($this->theName->extensionElements) == 0); - } - - public function testEmptyNameShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->theName->extensionAttributes)); - $this->assertTrue(count($this->theName->extensionAttributes) == 0); - } - - public function testSampleNameShouldHaveNoExtensionElements() { - $this->theName->transferFromXML($this->theNameText); - $this->assertTrue(is_array($this->theName->extensionElements)); - $this->assertTrue(count($this->theName->extensionElements) == 0); - } - - public function testSampleNameShouldHaveNoExtensionAttributes() { - $this->theName->transferFromXML($this->theNameText); - $this->assertTrue(is_array($this->theName->extensionAttributes)); - $this->assertTrue(count($this->theName->extensionAttributes) == 0); - } - - public function testNormalNameShouldHaveNoExtensionElements() { - $this->theName->givenName = "John"; - $this->theName->familyName = "Doe"; - - $this->assertEquals("John", $this->theName->givenName); - $this->assertEquals("Doe", $this->theName->familyName); - - $this->assertEquals(0, count($this->theName->extensionElements)); - $newName = new Zend_Gdata_Gapps_Extension_Name(); - $newName->transferFromXML($this->theName->saveXML()); - $this->assertEquals(0, count($newName->extensionElements)); - $newName->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newName->extensionElements)); - $this->assertEquals("John", $newName->givenName); - $this->assertEquals("Doe", $newName->familyName); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata_Gapps(); - $newName2 = $gdata->newName(); - $newName2->transferFromXML($newName->saveXML()); - $this->assertEquals(1, count($newName2->extensionElements)); - $this->assertEquals("John", $newName2->givenName); - $this->assertEquals("Doe", $newName2->familyName); - } - - public function testEmptyNameToAndFromStringShouldMatch() { - $nameXml = $this->theName->saveXML(); - $newName = new Zend_Gdata_Gapps_Extension_Name(); - $newName->transferFromXML($nameXml); - $newNameXml = $newName->saveXML(); - $this->assertTrue($nameXml == $newNameXml); - } - - public function testNameWithValueToAndFromStringShouldMatch() { - $this->theName->givenName = "John"; - $this->theName->familyName = "Doe"; - $nameXml = $this->theName->saveXML(); - $newName = new Zend_Gdata_Gapps_Extension_Name(); - $newName->transferFromXML($nameXml); - $newNameXml = $newName->saveXML(); - $this->assertTrue($nameXml == $newNameXml); - $this->assertEquals("John", $this->theName->givenName); - $this->assertEquals("Doe", $this->theName->familyName); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->theName->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->theName->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->theName->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->theName->extensionAttributes['foo2']['value']); - $nameXml = $this->theName->saveXML(); - $newName = new Zend_Gdata_Gapps_Extension_Name(); - $newName->transferFromXML($nameXml); - $this->assertEquals('bar', $newName->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newName->extensionAttributes['foo2']['value']); - } - - public function testConvertFullNameToAndFromString() { - $this->theName->transferFromXML($this->theNameText); - $this->assertEquals("Susan", $this->theName->givenName); - $this->assertEquals("Jones", $this->theName->familyName); - } - -} diff --git a/tests/Zend/Gdata/Gapps/NicknameEntryTest.php b/tests/Zend/Gdata/Gapps/NicknameEntryTest.php deleted file mode 100644 index f2fd32a3e..000000000 --- a/tests/Zend/Gdata/Gapps/NicknameEntryTest.php +++ /dev/null @@ -1,113 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_NicknameEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($nicknameEntry) { - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy', - $nicknameEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $nicknameEntry->updated->text); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $nicknameEntry->category[0]->scheme); - $this->assertEquals('http://schemas.google.com/apps/2006#nickname', $nicknameEntry->category[0]->term); - $this->assertEquals('text', $nicknameEntry->title->type); - $this->assertEquals('Susy', $nicknameEntry->title->text);; - $this->assertEquals('self', $nicknameEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $nicknameEntry->getLink('self')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy', $nicknameEntry->getLink('self')->href); - $this->assertEquals('edit', $nicknameEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $nicknameEntry->getLink('edit')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy', $nicknameEntry->getLink('edit')->href); - $this->assertEquals('Susy', $nicknameEntry->nickname->name); - $this->assertEquals('SusanJones', $nicknameEntry->login->username); - $this->assertEquals(false, $nicknameEntry->login->suspended); - $this->assertEquals(false, $nicknameEntry->login->admin); - $this->assertEquals(false, $nicknameEntry->login->changePasswordAtNextLogin); - $this->assertEquals(true, $nicknameEntry->login->agreedToTerms); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyNicknameEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newNicknameEntry = new Zend_Gdata_Gapps_NicknameEntry(); - $newNicknameEntry->transferFromXML($entryXml); - $newNicknameEntryXml = $newNicknameEntry->saveXML(); - $this->assertTrue($entryXml == $newNicknameEntryXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertNicknameEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newNicknameEntry = new Zend_Gdata_Gapps_NicknameEntry(); - $newNicknameEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newNicknameEntry); - $newNicknameEntryXml = $newNicknameEntry->saveXML(); - $this->assertEquals($entryXml, $newNicknameEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/NicknameFeedTest.php b/tests/Zend/Gdata/Gapps/NicknameFeedTest.php deleted file mode 100644 index 71eed0fd4..000000000 --- a/tests/Zend/Gdata/Gapps/NicknameFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -nicknameFeed = new Zend_Gdata_Gapps_NicknameFeed($nicknameFeedText); - $this->emptyNicknameFeed = new Zend_Gdata_Gapps_NicknameFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyNicknameFeed->extensionElements)); - $this->assertTrue(count($this->emptyNicknameFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyNicknameFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyNicknameFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->nicknameFeed->extensionElements)); - $this->assertTrue(count($this->nicknameFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->nicknameFeed->extensionAttributes)); - $this->assertTrue(count($this->nicknameFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->nicknameFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_NicknameEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->nicknameFeed and convert back to objects */ - $newNicknameFeed = new Zend_Gdata_Gapps_NicknameFeed( - $this->nicknameFeed->saveXML()); - $newEntryCount = 0; - foreach ($newNicknameFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_NicknameEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->nicknameFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/NicknameQueryTest.php b/tests/Zend/Gdata/Gapps/NicknameQueryTest.php deleted file mode 100644 index 8807250de..000000000 --- a/tests/Zend/Gdata/Gapps/NicknameQueryTest.php +++ /dev/null @@ -1,141 +0,0 @@ -query = new Zend_Gdata_Gapps_NicknameQuery(); - } - - // Test to make sure that URI generation works - public function testDefaultQueryURIGeneration() - { - $this->query->setDomain("foo.bar.invalid"); - $this->assertEquals("https://apps-apis.google.com/a/feeds/foo.bar.invalid/nickname/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/nickname/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the username accessor methods work and propagate - // to the query URI. - public function testCanSetUsernameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setUsername("foo"); - $this->assertEquals("foo", $this->query->getUsername()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0?username=foo", - $this->query->getQueryUrl()); - - $this->query->setUsername(null); - $this->assertEquals(null, $this->query->getUsername()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the nickname accessor methods work and propagate - // to the query URI. - public function testCanSetNicknameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setNickname("foo"); - $this->assertEquals("foo", $this->query->getNickname()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo", - $this->query->getQueryUrl()); - - $this->query->setNickname("bar"); - $this->assertEquals("bar", $this->query->getNickname()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/bar", - $this->query->getQueryUrl()); - } - - // Test to make sure that the startNickname accessor methods work and - // propagate to the query URI. - public function testCanSetStartNicknameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setNickname("foo"); - $this->query->setStartNickname("bar"); - $this->assertEquals("bar", $this->query->getStartNickname()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo?startNickname=bar", - $this->query->getQueryUrl()); - - $this->query->setStartNickname(null); - $this->assertEquals(null, $this->query->getStartNickname()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo", - $this->query->getQueryUrl()); - } - - - // Test to make sure that all parameters can be set simultaneously with no - // ill effects. - public function testCanSetAllParameters() - { - $this->query->setDomain("my.domain.com"); - $this->query->setNickname("foo"); - $this->query->setUsername("bar"); - $this->query->setStartNickname("baz"); - $this->assertEquals("foo", $this->query->getNickname()); - $this->assertEquals("bar", $this->query->getUsername()); - $this->assertEquals("baz", $this->query->getStartNickname()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo?username=bar&startNickname=baz", - $this->query->getQueryUrl()); - - $this->query->setUsername("qux"); - $this->query->setNickname("baz"); - $this->query->setStartNickname("wibble"); - $this->assertEquals("baz", $this->query->getNickname()); - $this->assertEquals("qux", $this->query->getUsername()); - $this->assertEquals("wibble", $this->query->getStartNickname()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/baz?username=qux&startNickname=wibble", - $this->query->getQueryUrl()); - } - -} diff --git a/tests/Zend/Gdata/Gapps/NicknameTest.php b/tests/Zend/Gdata/Gapps/NicknameTest.php deleted file mode 100644 index a5c73fdae..000000000 --- a/tests/Zend/Gdata/Gapps/NicknameTest.php +++ /dev/null @@ -1,127 +0,0 @@ -nicknameText = file_get_contents( - 'Zend/Gdata/Gapps/_files/NicknameElementSample1.xml', - true); - $this->nickname = new Zend_Gdata_Gapps_Extension_Nickname(); - } - - public function testEmptyNicknameShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->nickname->extensionElements)); - $this->assertTrue(count($this->nickname->extensionElements) == 0); - } - - public function testEmptyNicknameShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->nickname->extensionAttributes)); - $this->assertTrue(count($this->nickname->extensionAttributes) == 0); - } - - public function testSampleNicknameShouldHaveNoExtensionElements() { - $this->nickname->transferFromXML($this->nicknameText); - $this->assertTrue(is_array($this->nickname->extensionElements)); - $this->assertTrue(count($this->nickname->extensionElements) == 0); - } - - public function testSampleNicknameShouldHaveNoExtensionAttributes() { - $this->nickname->transferFromXML($this->nicknameText); - $this->assertTrue(is_array($this->nickname->extensionAttributes)); - $this->assertTrue(count($this->nickname->extensionAttributes) == 0); - } - - public function testNormalNicknameShouldHaveNoExtensionElements() { - $this->nickname->name = "Trogdor"; - - $this->assertEquals("Trogdor", $this->nickname->name); - - $this->assertEquals(0, count($this->nickname->extensionElements)); - $newNickname = new Zend_Gdata_Gapps_Extension_Nickname(); - $newNickname->transferFromXML($this->nickname->saveXML()); - $this->assertEquals(0, count($newNickname->extensionElements)); - $newNickname->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newNickname->extensionElements)); - $this->assertEquals("Trogdor", $newNickname->name); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata_Gapps(); - $newNickname2 = $gdata->newNickname(); - $newNickname2->transferFromXML($newNickname->saveXML()); - $this->assertEquals(1, count($newNickname2->extensionElements)); - $this->assertEquals("Trogdor", $newNickname2->name); - } - - public function testEmptyNicknameToAndFromStringShouldMatch() { - $nicknameXml = $this->nickname->saveXML(); - $newNickname = new Zend_Gdata_Gapps_Extension_Nickname(); - $newNickname->transferFromXML($nicknameXml); - $newNicknameXml = $newNickname->saveXML(); - $this->assertTrue($nicknameXml == $newNicknameXml); - } - - public function testNicknameWithValueToAndFromStringShouldMatch() { - $this->nickname->name = "Trogdor"; - $nicknameXml = $this->nickname->saveXML(); - $newNickname = new Zend_Gdata_Gapps_Extension_Nickname(); - $newNickname->transferFromXML($nicknameXml); - $newNicknameXml = $newNickname->saveXML(); - $this->assertTrue($nicknameXml == $newNicknameXml); - $this->assertEquals("Trogdor", $this->nickname->name); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->nickname->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->nickname->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->nickname->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->nickname->extensionAttributes['foo2']['value']); - $nicknameXml = $this->nickname->saveXML(); - $newNickname = new Zend_Gdata_Gapps_Extension_Nickname(); - $newNickname->transferFromXML($nicknameXml); - $this->assertEquals('bar', $newNickname->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newNickname->extensionAttributes['foo2']['value']); - } - - public function testConvertFullNicknameToAndFromString() { - $this->nickname->transferFromXML($this->nicknameText); - $this->assertEquals("Jones", $this->nickname->name); - } - -} diff --git a/tests/Zend/Gdata/Gapps/OwnerEntryTest.php b/tests/Zend/Gdata/Gapps/OwnerEntryTest.php deleted file mode 100644 index 53d74025f..000000000 --- a/tests/Zend/Gdata/Gapps/OwnerEntryTest.php +++ /dev/null @@ -1,105 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_OwnerEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($ownerEntry) { - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com', - $ownerEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $ownerEntry->updated->text); - $this->assertEquals('self', $ownerEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $ownerEntry->getLink('self')->type); - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com', $ownerEntry->getLink('self')->href); - $this->assertEquals('edit', $ownerEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $ownerEntry->getLink('edit')->type); - $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com', $ownerEntry->getLink('edit')->href); - $this->assertEquals('email', $ownerEntry->property[0]->name); - $this->assertEquals('joe@example.com', $ownerEntry->property[0]->value); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyOwnerEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newOwnerEntry = new Zend_Gdata_Gapps_OwnerEntry(); - $newOwnerEntry->transferFromXML($entryXml); - $newOwnerEntryXml = $newOwnerEntry->saveXML(); - $this->assertTrue($entryXml == $newOwnerEntryXml); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertOwnerEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newOwnerEntry = new Zend_Gdata_Gapps_OwnerEntry(); - $newOwnerEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newOwnerEntry); - $newOwnerEntryXml = $newOwnerEntry->saveXML(); - $this->assertEquals($entryXml, $newOwnerEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/OwnerFeedTest.php b/tests/Zend/Gdata/Gapps/OwnerFeedTest.php deleted file mode 100644 index c5e4bb07b..000000000 --- a/tests/Zend/Gdata/Gapps/OwnerFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -ownerFeed = new Zend_Gdata_Gapps_OwnerFeed($ownerFeedText); - $this->emptyOwnerFeed = new Zend_Gdata_Gapps_OwnerFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyOwnerFeed->extensionElements)); - $this->assertTrue(count($this->emptyOwnerFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyOwnerFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyOwnerFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->ownerFeed->extensionElements)); - $this->assertTrue(count($this->ownerFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->ownerFeed->extensionAttributes)); - $this->assertTrue(count($this->ownerFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of OwnerEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->ownerFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_OwnerEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->ownerFeed and convert back to objects */ - $newOwnerFeed = new Zend_Gdata_Gapps_OwnerFeed( - $this->ownerFeed->saveXML()); - $newEntryCount = 0; - foreach ($newOwnerFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_OwnerEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of owner entries equals the number - * of owners defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->ownerFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/OwnerQueryTest.php b/tests/Zend/Gdata/Gapps/OwnerQueryTest.php deleted file mode 100644 index f2830f6c5..000000000 --- a/tests/Zend/Gdata/Gapps/OwnerQueryTest.php +++ /dev/null @@ -1,92 +0,0 @@ -query = new Zend_Gdata_Gapps_OwnerQuery(); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setGroupId("something"); - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/something/owner", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/hello.world.baz/something/owner", - $this->query->getQueryUrl()); - } - - // Test to make sure that the groupId accessor methods work and propagate - // to the query URI. - public function testCanSetGroupIdProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->assertEquals("foo", $this->query->getGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner", - $this->query->getQueryUrl()); - - $this->query->setGroupId("bar"); - $this->assertEquals("bar", $this->query->getGroupId()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar/owner", - $this->query->getQueryUrl()); - } - - public function testCanSetOwnerEmailProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setGroupId("foo"); - $this->query->setOwnerEmail("bar@blah.com"); - $this->assertEquals("bar@blah.com", $this->query->getOwnerEmail()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner/bar@blah.com", - $this->query->getQueryUrl()); - - $this->query->setOwnerEmail('baz@blah.com'); - $this->assertEquals('baz@blah.com', $this->query->getOwnerEmail()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner/baz@blah.com", - $this->query->getQueryUrl()); - } - -} - diff --git a/tests/Zend/Gdata/Gapps/PropertyTest.php b/tests/Zend/Gdata/Gapps/PropertyTest.php deleted file mode 100644 index f5edf474c..000000000 --- a/tests/Zend/Gdata/Gapps/PropertyTest.php +++ /dev/null @@ -1,134 +0,0 @@ -thePropertyText = file_get_contents( - 'Zend/Gdata/Gapps/_files/PropertyElementSample1.xml', - true); - $this->theProperty = new Zend_Gdata_Gapps_Extension_Property(); - } - - public function testEmptyPropertyShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->theProperty->extensionElements)); - $this->assertTrue(count($this->theProperty->extensionElements) == 0); - } - - public function testEmptyPropertyShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->theProperty->extensionAttributes)); - $this->assertTrue(count($this->theProperty->extensionAttributes) == 0); - } - - public function testSamplePropertyShouldHaveNoExtensionElements() { - $this->theProperty->transferFromXML($this->thePropertyText); - $this->assertTrue(is_array($this->theProperty->extensionElements)); - $this->assertTrue(count($this->theProperty->extensionElements) == 0); - } - - public function testSamplePropertyShouldHaveNoExtensionAttributes() { - $this->theProperty->transferFromXML($this->thePropertyText); - $this->assertTrue(is_array($this->theProperty->extensionAttributes)); - $this->assertTrue(count($this->theProperty->extensionAttributes) == 0); - } - - public function testNormalPropertyShouldHaveNoExtensionElements() { - $this->theProperty->name = "foo"; - $this->theProperty->value = "bar"; - - $this->assertEquals("foo", $this->theProperty->name); - $this->assertEquals("bar", $this->theProperty->value); - - $this->assertEquals(0, count($this->theProperty->extensionElements)); - $newProperty = new Zend_Gdata_Gapps_Extension_Property(); - $newProperty->transferFromXML($this->theProperty->saveXML()); - $this->assertEquals(0, count($newProperty->extensionElements)); - $newProperty->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newProperty->extensionElements)); - $this->assertEquals("foo", $newProperty->name); - $this->assertEquals("bar", $newProperty->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata_Gapps(); - $newProperty2 = $gdata->newProperty(); - $newProperty2->transferFromXML($newProperty->saveXML()); - $this->assertEquals(1, count($newProperty2->extensionElements)); - $this->assertEquals("foo", $newProperty2->name); - $this->assertEquals("bar", $newProperty2->value); - } - - public function testEmptyPropertyToAndFromStringShouldMatch() { - $propertyXml = $this->theProperty->saveXML(); - $newProperty = new Zend_Gdata_Gapps_Extension_Property(); - $newProperty->transferFromXML($propertyXml); - $newPropertyXml = $newProperty->saveXML(); - $this->assertTrue($propertyXml == $newPropertyXml); - } - - public function testPropertyWithValueToAndFromStringShouldMatch() { - $this->theProperty->name = "foo2"; - $this->theProperty->value = "bar2"; - $propertyXml = $this->theProperty->saveXML(); - $newProperty = new Zend_Gdata_Gapps_Extension_Property(); - $newProperty->transferFromXML($propertyXml); - $newPropertyXml = $newProperty->saveXML(); - $this->assertTrue($propertyXml == $newPropertyXml); - $this->assertEquals("foo2", $this->theProperty->name); - $this->assertEquals("bar2", $this->theProperty->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->theProperty->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->theProperty->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->theProperty->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->theProperty->extensionAttributes['foo2']['value']); - $propertyXml = $this->theProperty->saveXML(); - $newProperty = new Zend_Gdata_Gapps_Extension_Property(); - $newProperty->transferFromXML($propertyXml); - $this->assertEquals('bar', $newProperty->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newProperty->extensionAttributes['foo2']['value']); - } - - public function testConvertFullNameToAndFromString() { - $this->theProperty->transferFromXML($this->thePropertyText); - $this->assertEquals("Some Name", $this->theProperty->name); - $this->assertEquals("Some Value", $this->theProperty->value); - } - -} diff --git a/tests/Zend/Gdata/Gapps/QuotaTest.php b/tests/Zend/Gdata/Gapps/QuotaTest.php deleted file mode 100644 index 5c7cb1b42..000000000 --- a/tests/Zend/Gdata/Gapps/QuotaTest.php +++ /dev/null @@ -1,127 +0,0 @@ -quotaText = file_get_contents( - 'Zend/Gdata/Gapps/_files/QuotaElementSample1.xml', - true); - $this->quota = new Zend_Gdata_Gapps_Extension_Quota(); - } - - public function testEmptyQuotaShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->quota->extensionElements)); - $this->assertTrue(count($this->quota->extensionElements) == 0); - } - - public function testEmptyQuotaShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->quota->extensionAttributes)); - $this->assertTrue(count($this->quota->extensionAttributes) == 0); - } - - public function testSampleQuotaShouldHaveNoExtensionElements() { - $this->quota->transferFromXML($this->quotaText); - $this->assertTrue(is_array($this->quota->extensionElements)); - $this->assertTrue(count($this->quota->extensionElements) == 0); - } - - public function testSampleQuotaShouldHaveNoExtensionAttributes() { - $this->quota->transferFromXML($this->quotaText); - $this->assertTrue(is_array($this->quota->extensionAttributes)); - $this->assertTrue(count($this->quota->extensionAttributes) == 0); - } - - public function testNormalQuotaShouldHaveNoExtensionElements() { - $this->quota->limit = "123456789"; - - $this->assertEquals("123456789", $this->quota->limit); - - $this->assertEquals(0, count($this->quota->extensionElements)); - $newQuota = new Zend_Gdata_Gapps_Extension_Quota(); - $newQuota->transferFromXML($this->quota->saveXML()); - $this->assertEquals(0, count($newQuota->extensionElements)); - $newQuota->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newQuota->extensionElements)); - $this->assertEquals("123456789", $newQuota->limit); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata_Gapps(); - $newQuota2 = $gdata->newQuota(); - $newQuota2->transferFromXML($newQuota->saveXML()); - $this->assertEquals(1, count($newQuota2->extensionElements)); - $this->assertEquals("123456789", $newQuota2->limit); - } - - public function testEmptyQuotaToAndFromStringShouldMatch() { - $quotaXml = $this->quota->saveXML(); - $newQuota = new Zend_Gdata_Gapps_Extension_Quota(); - $newQuota->transferFromXML($quotaXml); - $newQuotaXml = $newQuota->saveXML(); - $this->assertTrue($quotaXml == $newQuotaXml); - } - - public function testQuotaWithValueToAndFromStringShouldMatch() { - $this->quota->limit = "123456789"; - $quotaXml = $this->quota->saveXML(); - $newQuota = new Zend_Gdata_Gapps_Extension_Quota(); - $newQuota->transferFromXML($quotaXml); - $newQuotaXml = $newQuota->saveXML(); - $this->assertTrue($quotaXml == $newQuotaXml); - $this->assertEquals("123456789", $this->quota->limit); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->quota->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->quota->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->quota->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->quota->extensionAttributes['foo2']['value']); - $quotaXml = $this->quota->saveXML(); - $newQuota = new Zend_Gdata_Gapps_Extension_Quota(); - $newQuota->transferFromXML($quotaXml); - $this->assertEquals('bar', $newQuota->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newQuota->extensionAttributes['foo2']['value']); - } - - public function testConvertFullQuotaToAndFromString() { - $this->quota->transferFromXML($this->quotaText); - $this->assertEquals("2048", $this->quota->limit); - } - -} diff --git a/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php b/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php deleted file mode 100644 index c304f7765..000000000 --- a/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php +++ /dev/null @@ -1,143 +0,0 @@ -xmlSample = file_get_contents( - 'Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml', - true); - $this->fixture = new Zend_Gdata_Gapps_ServiceException(); - $this->data[1] = new Zend_Gdata_Gapps_Error(1234, "foo", "bar"); - $this->data[2] = new Zend_Gdata_Gapps_Error(4317, "blah", "woof"); - $this->data[3] = new Zend_Gdata_Gapps_Error(5978, "blue", "puppy"); - $this->data[4] = new Zend_Gdata_Gapps_Error(2398, "red", "kitten"); - } - - /** - * @expectedException Zend_Gdata_Gapps_ServiceException - */ - public function testCanThrowServiceException() { - throw $this->fixture; - } - - public function testCanSetAndGetErrorArray() { - $this->fixture->setErrors($this->data); - $incoming = $this->fixture->getErrors(); - $this->assertTrue(is_array($incoming)); - $this->assertEquals(count($this->data), count($incoming)); - foreach ($this->data as $i) { - $this->assertEquals($i, $incoming[$i->getErrorCode()]); - } - } - - public function testCanInsertSingleError() { - $this->fixture->setErrors($this->data); - $outgoing = new Zend_Gdata_Gapps_Error(1111, "a", "b"); - $this->fixture->addError($outgoing); - $result = $this->fixture->getError(1111); - $this->assertEquals($outgoing, $result); - } - - public function testCanSetPropertiesViaConstructor() { - $this->fixture = new Zend_Gdata_Gapps_ServiceException($this->data); - $incoming = $this->fixture->getErrors(); - $this->assertTrue(is_array($incoming)); - $this->assertEquals(count($this->data), count($incoming)); - foreach($this->data as $i) { - $this->assertEquals($i, $incoming[$i->getErrorCode()]); - } - } - - public function testCanRetrieveASpecificErrorByCode() { - $this->fixture->setErrors($this->data); - $result = $this->fixture->getError(5978); - $this->assertEquals($this->data[3], $result); - } - - public function testRetrievingNonexistantErrorCodeReturnsNull() { - $this->fixture->setErrors($this->data); - $result = $this->fixture->getError(0000); - $this->assertEquals(null, $result); - } - - public function testCanCheckIfAKeyExists() { - $this->fixture->setErrors($this->data); - $this->assertTrue($this->fixture->hasError(2398)); - $this->assertFalse($this->fixture->hasError(0000)); - } - - public function testCanConvertFromXML() { - $this->fixture->importFromString($this->xmlSample); - $incoming = $this->fixture->getErrors(); - $this->assertTrue(is_array($incoming)); - $this->assertEquals(3, count($incoming)); - $this->assertEquals("9925", $incoming[9925]->errorCode); - $this->assertEquals("Foo", $incoming[9925]->invalidInput); - $this->assertEquals("Bar", $incoming[9925]->reason); - } - - public function testImportFromStringException() - { - try { - $this->fixture->importFromString('foo'); - } catch (Zend_Gdata_App_Exception $e) { - self::assertInstanceOf('Zend_Gdata_App_Exception', $e); - self::assertContains('cannot parse', $e->getMessage()); - - return; - } - - self::fail('Illegal string should\'ve cause an expcetion'); - } - - public function testCanConvertToString() { - $this->fixture->setErrors($this->data); - $this->assertEquals("The server encountered the following errors processing the request: -Error 1234: foo -\tInvalid Input: \"bar\" -Error 4317: blah -\tInvalid Input: \"woof\" -Error 5978: blue -\tInvalid Input: \"puppy\" -Error 2398: red -\tInvalid Input: \"kitten\"", $this->fixture->__toString()); - } - -} diff --git a/tests/Zend/Gdata/Gapps/UserEntryTest.php b/tests/Zend/Gdata/Gapps/UserEntryTest.php deleted file mode 100644 index ee1a0703c..000000000 --- a/tests/Zend/Gdata/Gapps/UserEntryTest.php +++ /dev/null @@ -1,146 +0,0 @@ -entryText = file_get_contents( - 'Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml', - true); - $this->entry = new Zend_Gdata_Gapps_UserEntry(); - } - - private function verifyAllSamplePropertiesAreCorrect ($userEntry) { - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones', - $userEntry->id->text); - $this->assertEquals('1970-01-01T00:00:00.000Z', $userEntry->updated->text); - $this->assertEquals('http://schemas.google.com/g/2005#kind', $userEntry->category[0]->scheme); - $this->assertEquals('http://schemas.google.com/apps/2006#user', $userEntry->category[0]->term); - $this->assertEquals('text', $userEntry->title->type); - $this->assertEquals('SusanJones', $userEntry->title->text);; - $this->assertEquals('self', $userEntry->getLink('self')->rel); - $this->assertEquals('application/atom+xml', $userEntry->getLink('self')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones', $userEntry->getLink('self')->href); - $this->assertEquals('edit', $userEntry->getLink('edit')->rel); - $this->assertEquals('application/atom+xml', $userEntry->getLink('edit')->type); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones', $userEntry->getLink('edit')->href); - $this->assertEquals('SusanJones', $userEntry->login->username); - $this->assertEquals('Jones', $userEntry->name->familyName); - $this->assertEquals('Susan', $userEntry->name->givenName); - $this->assertEquals('http://schemas.google.com/apps/2006#user.nicknames', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.nicknames')->rel); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0?username=Susy-1321', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.nicknames')->href); - $this->assertEquals('http://schemas.google.com/apps/2006#user.emailLists', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.emailLists')->rel); - $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0?recipient=us-sales@example.com', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.emailLists')->href); - $this->assertEquals('2048', $userEntry->quota->limit); - } - - public function testEmptyEntryShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testEmptyEntryShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionElements() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionElements)); - $this->assertTrue(count($this->entry->extensionElements) == 0); - } - - public function testSampleEntryShouldHaveNoExtensionAttributes() { - $this->entry->transferFromXML($this->entryText); - $this->assertTrue(is_array($this->entry->extensionAttributes)); - $this->assertTrue(count($this->entry->extensionAttributes) == 0); - } - - public function testEmptyUserEntryToAndFromStringShouldMatch() { - $entryXml = $this->entry->saveXML(); - $newUserEntry = new Zend_Gdata_Gapps_UserEntry(); - $newUserEntry->transferFromXML($entryXml); - $newUserEntryXml = $newUserEntry->saveXML(); - $this->assertTrue($entryXml == $newUserEntryXml); - } - - public function testGetFeedLinkReturnsAllStoredEntriesWhenUsedWithNoParameters() { - // Prepare test data - $entry1 = new Zend_Gdata_Extension_FeedLink(); - $entry1->rel = "first"; - $entry1->href= "foo"; - $entry2 = new Zend_Gdata_Extension_FeedLink(); - $entry2->rel = "second"; - $entry2->href= "bar"; - $data = array($entry1, $entry2); - - // Load test data and run test - $this->entry->feedLink = $data; - $this->assertEquals(2, count($this->entry->feedLink)); - } - - public function testGetFeedLinkCanReturnEntriesByRelValue() { - // Prepare test data - $entry1 = new Zend_Gdata_Extension_FeedLink(); - $entry1->rel = "first"; - $entry1->href= "foo"; - $entry2 = new Zend_Gdata_Extension_FeedLink(); - $entry2->rel = "second"; - $entry2->href= "bar"; - $data = array($entry1, $entry2); - - // Load test data and run test - $this->entry->feedLink = $data; - $this->assertEquals($entry1, $this->entry->getFeedLink('first')); - $this->assertEquals($entry2, $this->entry->getFeedLink('second')); - } - - public function testSamplePropertiesAreCorrect () { - $this->entry->transferFromXML($this->entryText); - $this->verifyAllSamplePropertiesAreCorrect($this->entry); - } - - public function testConvertUserEntryToAndFromString() { - $this->entry->transferFromXML($this->entryText); - $entryXml = $this->entry->saveXML(); - $newUserEntry = new Zend_Gdata_Gapps_UserEntry(); - $newUserEntry->transferFromXML($entryXml); - $this->verifyAllSamplePropertiesAreCorrect($newUserEntry); - $newUserEntryXml = $newUserEntry->saveXML(); - $this->assertEquals($entryXml, $newUserEntryXml); - } - -} diff --git a/tests/Zend/Gdata/Gapps/UserFeedTest.php b/tests/Zend/Gdata/Gapps/UserFeedTest.php deleted file mode 100644 index 0e8206dcf..000000000 --- a/tests/Zend/Gdata/Gapps/UserFeedTest.php +++ /dev/null @@ -1,110 +0,0 @@ -userFeed = new Zend_Gdata_Gapps_UserFeed($userFeedText); - $this->emptyUserFeed = new Zend_Gdata_Gapps_UserFeed(); - } - - public function testEmptyFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->emptyUserFeed->extensionElements)); - $this->assertTrue(count($this->emptyUserFeed->extensionElements) == 0); - } - - public function testEmptyFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->emptyUserFeed->extensionAttributes)); - $this->assertTrue(count($this->emptyUserFeed->extensionAttributes) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->userFeed->extensionElements)); - $this->assertTrue(count($this->userFeed->extensionElements) == 0); - } - - public function testSampleFeedShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->userFeed->extensionAttributes)); - $this->assertTrue(count($this->userFeed->extensionAttributes) == 0); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of EventEntry and object count matches. - */ - public function testXmlImportAndOutputAreNonDestructive() - { - $entryCount = 0; - foreach ($this->userFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_UserEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->userFeed and convert back to objects */ - $newUserFeed = new Zend_Gdata_Gapps_UserFeed( - $this->userFeed->saveXML()); - $newEntryCount = 0; - foreach ($newUserFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Gapps_UserEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that there number of lsit feeds equals the number - * of calendars defined in the sample file. - */ - public function testAllEntriesInFeedAreInstantiated() - { - //TODO feeds implementing ArrayAccess would be helpful here - $entryCount = 0; - foreach ($this->userFeed as $entry) { - $entryCount++; - } - $this->assertEquals(2, $entryCount); - } - -} diff --git a/tests/Zend/Gdata/Gapps/UserQueryTest.php b/tests/Zend/Gdata/Gapps/UserQueryTest.php deleted file mode 100644 index 162179080..000000000 --- a/tests/Zend/Gdata/Gapps/UserQueryTest.php +++ /dev/null @@ -1,99 +0,0 @@ -query = new Zend_Gdata_Gapps_UserQuery(); - } - - // Test to make sure that URI generation works - public function testDefaultQueryURIGeneration() - { - $this->query->setDomain("foo.bar.invalid"); - $this->assertEquals("https://apps-apis.google.com/a/feeds/foo.bar.invalid/user/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the domain accessor methods work and propagate - // to the query URI. - public function testCanSetQueryDomain() - { - $this->query->setDomain("my.domain.com"); - $this->assertEquals("my.domain.com", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0", - $this->query->getQueryUrl()); - - $this->query->setDomain("hello.world.baz"); - $this->assertEquals("hello.world.baz", $this->query->getDomain()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/user/2.0", - $this->query->getQueryUrl()); - } - - // Test to make sure that the username accessor methods work and propagate - // to the query URI. - public function testCanSetUsernameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setUsername("foo"); - $this->assertEquals("foo", $this->query->getUsername()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0/foo", - $this->query->getQueryUrl()); - - $this->query->setUsername("bar"); - $this->assertEquals("bar", $this->query->getUsername()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0/bar", - $this->query->getQueryUrl()); - } - - // Test to make sure that the startUsername accessor methods work and - // propagate to the query URI. - public function testCanSetStartUsernameProperty() - { - $this->query->setDomain("my.domain.com"); - $this->query->setStartUsername("foo"); - $this->assertEquals("foo", $this->query->getStartUsername()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0?startUsername=foo", - $this->query->getQueryUrl()); - - $this->query->setStartUsername(null); - $this->assertEquals(null, $this->query->getStartUsername()); - $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0", - $this->query->getQueryUrl()); - } - -} diff --git a/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml deleted file mode 100644 index e4ec89f42..000000000 --- a/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml deleted file mode 100644 index 09349e88f..000000000 --- a/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml deleted file mode 100644 index ddbd2c7b3..000000000 --- a/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales - 1970-01-01T00:00:00.000Z - - us-sales - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml deleted file mode 100644 index 8d779c7b6..000000000 --- a/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - http://apps-apis.google.com/a/feeds/example.com/emailList/2.0 - - 1970-01-01T00:00:00.000Z - - EmailLists - diff --git a/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml deleted file mode 100644 index 8bd3c8dfe..000000000 --- a/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com - 1970-01-01T00:00:00.000Z - - SusanJones - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml deleted file mode 100644 index b217c0d37..000000000 --- a/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient - - 1970-01-01T00:00:00.000Z - - Recipients for email list us-sales - diff --git a/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml deleted file mode 100644 index a23e6b5ea..000000000 --- a/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales - 1970-01-01T00:00:00.000Z - - - - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml deleted file mode 100644 index c37ec263c..000000000 --- a/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - https://www.google.com/a/feeds/group/2.0/example.com - 2008-12-03T16:33:05.260Z - - - - 1 - - https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales%40example.com - 2008-12-03T16:33:05.261Z - - - - - - - - - https://apps-apis.google.com/a/feeds/group/2.0/example.com/Staff-2435%40example.com - 2008-12-03T16:33:05.260Z - - - - - - - - \ No newline at end of file diff --git a/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml deleted file mode 100644 index f6971dc84..000000000 --- a/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml deleted file mode 100644 index 953fa2a6c..000000000 --- a/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com - 1970-01-01T00:00:00.000Z - - - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml deleted file mode 100644 index aa395ffaa..000000000 --- a/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member - - 1 - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com - - - - - - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/ca-sales%40example.com - - - - - - - \ No newline at end of file diff --git a/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml deleted file mode 100644 index 4b30681cb..000000000 --- a/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml deleted file mode 100644 index a986073cf..000000000 --- a/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml deleted file mode 100644 index 8c165cea5..000000000 --- a/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy - 1970-01-01T00:00:00.000Z - - Susy - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml deleted file mode 100644 index 9598bf449..000000000 --- a/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - http://apps-apis.google.com/a/feeds/example.com/nickname/2.0 - - 1970-01-01T00:00:00.000Z - - Nicknames for user SusanJones - - - - 1 - 2 - - - http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/susy - - - susy - - - - - - - - http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse - - - suse - - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml deleted file mode 100644 index c59c87b08..000000000 --- a/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com - 1970-01-01T00:00:00.000Z - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml deleted file mode 100644 index bf1c77536..000000000 --- a/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner - 1970-01-01T00:00:00.000Z - - - - 1 - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com - 1970-01-01T00:00:00.000Z - - - - - - https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/suejones%40example.com - 1970-01-01T00:00:00.000Z - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml deleted file mode 100644 index 740207140..000000000 --- a/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml b/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml deleted file mode 100644 index f516dbd7e..000000000 --- a/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml deleted file mode 100644 index 075444302..000000000 --- a/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones - 1970-01-01T00:00:00.000Z - - SusanJones - - - - - - - - diff --git a/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml b/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml deleted file mode 100644 index ff4b78e57..000000000 --- a/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - http://apps-apis.google.com/a/feeds/example.com/user/2.0 - - 1970-01-01T00:00:00.000Z - - Users - diff --git a/tests/Zend/Gdata/GappsOnlineTest.php b/tests/Zend/Gdata/GappsOnlineTest.php deleted file mode 100644 index f94c9835b..000000000 --- a/tests/Zend/Gdata/GappsOnlineTest.php +++ /dev/null @@ -1,835 +0,0 @@ -id = uniqid('ZF-'); - $username = constant('TESTS_ZEND_GDATA_GAPPS_EMAIL'); - $pass = constant('TESTS_ZEND_GDATA_GAPPS_PASSWORD'); - $this->domain = constant('TESTS_ZEND_GDATA_GAPPS_DOMAIN'); - $client = Zend_Gdata_ClientLogin::getHttpClient($username, $pass, Zend_Gdata_Gapps::AUTH_SERVICE_NAME); - $this->gdata = new Zend_Gdata_Gapps($client, $this->domain); - - // Container to hold users and lists created during tests. All entries in - // here will have delete() called during tear down. - // - // Failed deletions are okay, so add everying creatd in here, even if - // you plan to delete the user yourself! - $this->autoDeletePool = array(); - } - - public function tearDown() - { - // Delete all entries in $this->autoDeletePool. - foreach ($this->autoDeletePool as $x) { - try { - $x->delete(); - } catch (\Throwable $e) { - // Failed deletes are okay. Try and delete the rest anyway. - } - } - } - - // Schedule an entry for deletion at test tear-down. - protected function autoDelete($entry) { - $this->autoDeletePool[] = $entry; - } - - // Test Create/Read/Update/Destroy operations on a UserEntry - public function testUserCRUDOperations() { - // Create a new user - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Verify that returned values are correct - $this->assertEquals($this->id, $user->login->username); - $this->assertEquals(self::GIVEN_NAME, $user->name->givenName); - $this->assertEquals(self::FAMILY_NAME, $user->name->familyName); - - // Since we can't retrieve the password or hash function via the - // API, let's see if a ClientLogin auth request succeeds - try { - Zend_Gdata_ClientLogin::getHTTPClient($this->id . '@' . - $this->domain, self::PASSWORD, 'xapi'); - } catch (Zend_Gdata_App_AuthException $e) { - $this->fail("Unable to authenticate new user via ClientLogin."); - } - - // Check to make sure there are no extension elements/attributes - // in the retrieved user - $this->assertTrue(count($user->extensionElements) == 0); - $this->assertTrue(count($user->extensionAttributes) == 0); - - // Try searching for the same user and make sure that they're returned - $user2 = $this->gdata->retrieveUser($this->id); - $this->assertEquals($user->saveXML(), $user2->saveXML()); - - // Delete user (uses builtin delete method, convenience delete - // method tested further down) - $user->delete(); - - // Ensure that user was deleted - $deletedUser = $this->gdata->retrieveUser($this->id); - $this->assertNull($deletedUser); - } - - // Test to make sure that users with unicode characters can be created - // okay. - public function testUsersSupportUnicode() { - // Create a user - $user = $this->gdata->createUser($this->id, 'テスト', 'ユーザー', - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Make sure the user is the same as returned by the server - $this->assertEquals('テスト', $user->name->givenName); - $this->assertEquals('ユーザー', $user->name->familyName); - } - - // Test to make sure that a page of users can be retrieved. - public function testRetrievePageOfUsers() { - $feed = $this->gdata->retrievePageOfUsers(); - $this->assertTrue(count($feed->entries) > 0); - } - - // Test to make sure that a page of users can be retrieved with a - // startUsername parameter. - public function testRetrievePageOfUsersWithStartingUsername() { - $feed = $this->gdata->retrievePageOfUsers(); - $this->assertTrue(count($feed->entries) > 0); - $username = $feed->entries[0]->login->username; - $feed = $this->gdata->retrievePageOfUsers($username); - $this->assertTrue(count($feed->entries) > 0); - } - - // Test to see if all users can be retrieved - // NOTE: This test may timeout if the domain used for testing contains - // many pages of users. - public function testRetrieveAllUsers() { - // Create 35 users to make sure that there's more than one page. - for ($i = 0; $i < 25; $i++) { - $user = $this->gdata->createUser(uniqid('ZF-'), self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - } - - $feed = $this->gdata->retrieveAllUsers(); - $this->assertTrue(count($feed->entry) > 0); - } - - // Test to see if a user can be manually updated by calling updateUser(). - public function testManualUserEntryUpdate() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $user->name->givenName = "Renamed"; - $user2 = $this->gdata->updateUser($this->id, $user); - $this->assertEquals("Renamed", $user2->name->givenName); - } - - // Test to see if a user can be suspended, then un-suspended - public function testCanSuspendAndRestoreUser() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - $returned = $this->gdata->suspendUser($this->id); - $user = $this->gdata->retrieveUser($this->id); - $this->assertEquals(true, $user->login->suspended); - $this->assertEquals($this->id, $returned->login->username); - - $returned = $this->gdata->restoreUser($this->id); - $user = $this->gdata->retrieveUser($this->id); - $this->assertEquals(false, $user->login->suspended); - $this->assertEquals($this->id, $returned->login->username); - } - - // Test the convenience delete method for users - public function testCanDeleteUser() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Assert that the user exists, just in case... - $rUser = $this->gdata->retrieveUser($this->id); - $this->assertNotNull($rUser); - - // Delete user - $this->gdata->deleteUser($this->id); - - // Ensure that user was deleted - $rUser = $this->gdata->retrieveUser($this->id); - $this->assertNull($rUser); - } - - public function testNicknameCRUDOperations() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Create nickname - // Apps will convert the nickname to lowercase on the server, so - // we just make sure the generated nickname is lowercase here to start - // to avoid confusion later on. - $generatedNickname = strtolower((string) uniqid('zf-nick-')); - $nickname = $this->gdata->createNickname($this->id, $generatedNickname); - $this->assertEquals($generatedNickname, $nickname->nickname->name); - $this->assertEquals($this->id, $nickname->login->username); - - // Retrieve nickname - $nickname = $this->gdata->retrieveNickname($generatedNickname); - $this->assertEquals($generatedNickname, $nickname->nickname->name); - $this->assertEquals($this->id, $nickname->login->username); - - // Delete nickname (uses builtin delete method, convenience delete - // method tested further down) - $nickname->delete(); - - // Ensure that nickname was deleted - $nickname = $this->gdata->retrieveNickname($generatedNickname); - $this->assertNull($nickname); - } - - public function testRetrieveNicknames() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Create 5 nicknames - for ($i = 0; $i < 5; $i++) { - $generatedNickname[$i] = strtolower((string) uniqid('zf-nick-')); - $this->gdata->createNickname($this->id, $generatedNickname[$i]); - } - - // Retrieve all nicknames for the test user and see if they match - $nicknameFeed = $this->gdata->retrieveNicknames($this->id); - $this->assertEquals(count($generatedNickname), count($nicknameFeed->entry)); - foreach ($nicknameFeed as $nicknameEntry) { - $searchResult = array_search($nicknameEntry->nickname->name, - $generatedNickname); - $this->assertNotSame(false, $searchResult); - unset($generatedNickname[$searchResult]); - } - $this->assertEquals(0, count($generatedNickname)); - } - - public function testRetrievePageOfNicknames() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Create 5 nicknames - for ($i = 0; $i < 5; $i++) { - $generatedNickname[$i] = strtolower((string) uniqid('zf-nick-')); - $this->gdata->createNickname($this->id, $generatedNickname[$i]); - } - - // Test to make sure that we receive at least 5 nicknames back - // from the server - $results = $this->gdata->retrievePageOfNicknames(); - $this->assertTrue(count($results->entry) >= 5); - } - - public function testRetrieveAllNicknames() { - // Create 3 users, each with 10 nicknames - for ($i = 0; $i < 3; $i++) { - $user = $this->gdata->createUser(uniqid('ZF-'), self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - for ($j = 0; $j < 10; $j++) { - $generatedNickname = strtolower((string) uniqid('zf-nick-')); - $this->gdata->createNickname($user->login->username, $generatedNickname); - } - } - - // Test to make sure that we receive at least 5 nicknames back - // from the server - $results = $this->gdata->retrieveAllNicknames(); - $this->assertTrue(count($results->entry) >= 30); - } - - // Test the convenience delete method for nicknames - public function testCanDeleteNickname() { - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $generatedNickname = strtolower((string) uniqid('zf-nick-')); - $this->gdata->createNickname($this->id, $generatedNickname); - - // Assert that the nickname exists, just in case... - $rNick = $this->gdata->retrieveNickname($generatedNickname); - $this->assertNotNull($rNick); - - // Delete nickname - $this->gdata->deleteNickname($generatedNickname); - - // Ensure that nickname was deleted - $rNick = $this->gdata->retrieveNickname($generatedNickname); - $this->assertNull($rNick); - } - - public function testGroupCRUDOperations() { - // Create group - $generatedGroupName = strtolower((string) uniqid('zf-group-')); - $group = $this->gdata->createGroup($generatedGroupName, 'zf-group-', - 'testGroupCRUDOperations()'); - $this->autoDelete($group); - - $groupId = null; - $properties = $group->getProperty(); - foreach ($properties as $property) { - if($property->name == 'groupId') { - $groupId = $property->value; - } - } - - $this->assertEquals($generatedGroupName, $groupId); - - // Retrieve group - $query = $this->gdata->newGroupQuery(); - $groupFeed = $this->gdata->getGroupFeed($query); - $entryCount = count($groupFeed->entry); - $this->assertTrue($entryCount > 0); - - // Delete group (uses builtin delete method, convenience delete - // method tested further down) - $group->delete(); - - // Ensure that group was deleted - $groupFeed = $this->gdata->getGroupFeed($query); - $this->assertEquals($entryCount - 1, count($groupFeed->entry)); - - } - - public function testCanAssignMultipleGroupsToOneUser() { - // Create a user - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Create two groups - $groupCount = 2; - - for ($i = 0; $i < $groupCount; $i++) { - $generatedGroupName = strtolower((string) uniqid('zf-group-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanAssignMultipleGroupsToOneUser() ' . $i); - $this->autoDelete($group); - $this->gdata->addMemberToGroup($this->id, $generatedGroupName); - } - - // Make sure that the user is subscribed to both groups - $subscriptions = $this->gdata->retrieveGroups($this->id); - $this->assertEquals($groupCount, count($subscriptions->entry)); - - } - - public function testCanRetrievePageOfGroups() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-group-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanRetrievePageOfGroups()'); - $this->autoDelete($group); - - // Try retrieving the group feed - $feed = $this->gdata->retrievePageOfGroups(); - $this->assertTrue(count($feed->entry) > 0); - - } - - public function testCanRetrieveAllGroups() { - // Create a couple of users to make sure we don't hit the limit - // on the max number of groups. - for ($i = 0; $i < 3; $i++) { - $user = $this->gdata->createUser(uniqid('ZF-'), self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - } - - // Create a whole bunch of groups to make sure we trigger - // paging. - for ($i = 0; $i < 30; $i++) { - $generatedGroupName = strtolower((string) uniqid('zf-group-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group ' . $i, - 'testCanRetrieveAllGroups()'); - $this->autoDelete($group); - } - - // Try retrieving the group feed - $feed = $this->gdata->retrieveAllGroups(); - $this->assertTrue(count($feed->entry) >= 30); - - } - - // Test the convenience delete method for groups - public function testCanDeleteGroup() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-group-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanDeleteGroup()'); - $this->autoDelete($group); - - // Assert that the group exists, just in case... - $query = $this->gdata->newGroupQuery(); - $query->setGroupId($generatedGroupName); - $entry = $this->gdata->getGroupEntry($query); - $this->assertNotNull($entry); - - // Delete group - $this->gdata->deleteGroup($generatedGroupName); - - // Ensure that group was deleted - try { - $query = $this->gdata->newGroupQuery(); - $query->setGroupId($generatedGroupName); - $entry = $this->gdata->getGroupEntry($query); - // This souldn't execute - $this->fail('Retrieving a non-existant group entry didn\'t' . - 'raise exception.'); - } catch (Zend_Gdata_Gapps_ServiceException $e) { - if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { - // Dummy assertion just to say we tested something here. - $this->assertTrue(true); - } else { - // Exception thrown for an unexpected reason - throw $e; - } - } - - } - - public function testCanRetrievePageOfMembers() { - // Create a new group - $generatedGroupName = strtolower((string) uniqid('zf-group-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanRetrievePageOfMembers()'); - $this->autoDelete($group); - - // Create two users and assign them to the group - $userCount = 2; - for ($i = 0; $i < $userCount; $i++) { - $generatedUsername = uniqid('ZF-'); - $user = $this->gdata->createUser($generatedUsername, - self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), - self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addMemberToGroup($generatedUsername, - $generatedGroupName); - } - - // Retrieve members - $memberFeed = $this->gdata->retrievePageOfMembers($generatedGroupName); - $this->assertTrue(count($memberFeed->entry) == $userCount); - - } - - public function testCanRetrievAllMembers() { - // Create a new group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanRetrievAllMembers()'); - $this->autoDelete($group); - - // Create enough users to trigger paging and assign them to the group - $userCount = 30; - for ($i = 0; $i < $userCount; $i++) { - $generatedUsername = uniqid('ZF-'); - $user = $this->gdata->createUser($generatedUsername, - self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), - self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addMemberToGroup($generatedUsername, $generatedGroupName); - } - - // Retrieve members - $memberFeed = $this->gdata->retrieveAllMembers($generatedGroupName); - $this->assertTrue(count($memberFeed->entry) == $userCount); - - } - - // Test the convenience removeMemberFromGroup method for group members - public function testCanRemoveMemberFromGroup() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanDeleteGroupMember()'); - $this->autoDelete($group); - - // Create a user for the group - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addMemberToGroup($this->id, $generatedGroupName); - - // Assert that the member exists, just in case... - $members = $this->gdata->retrieveAllMembers($generatedGroupName); - $this->assertTrue(count($members->entry) == 1); - - // Remove the member from the group - $this->gdata->removeMemberFromGroup($user->login->username, - $generatedGroupName); - - // Ensure that user was deleted - $members = $this->gdata->retrieveAllMembers($generatedGroupName); - $this->assertTrue(count($members->entry) == 0); - - } - - public function testCanRetrieveGroupOwners() { - // Create a new group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanRetrievAllOwners()'); - $this->autoDelete($group); - - $userCount = 3; - for ($i = 0; $i < $userCount; $i++) { - $generatedUsername = uniqid('ZF-'); - $user = $this->gdata->createUser($generatedUsername, - self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), - self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addOwnerToGroup($generatedUsername, - $generatedGroupName); - } - - // Retrieve owners - $ownerFeed = $this->gdata->retrieveGroupOwners($generatedGroupName); - $this->assertTrue(count($ownerFeed->entry) == $userCount); - - } - - // Test the convenience removeOwnerFromGroup method for group owners - public function testCanRemoveOwnerFromGroup() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanDeleteGroupOwner()'); - $this->autoDelete($group); - - // Create a user for the group - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addOwnerToGroup($this->id, $generatedGroupName); - - // Assert that the owner exists, just in case... - $owners = $this->gdata->retrieveGroupOwners($generatedGroupName); - $this->assertTrue(count($owners->entry) == 1); - - // Remove the owner from the group - $this->gdata->removeOwnerFromGroup($user->login->username, - $generatedGroupName); - - // Ensure that user was deleted - $owners = $this->gdata->retrieveGroupOwners($generatedGroupName); - $this->assertTrue(count($owners->entry) == 0); - } - - // Test the convenience isMember method - public function testIsMember() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testIsMember()'); - $this->autoDelete($group); - - // Create a user for the group - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addMemberToGroup($this->id, $generatedGroupName); - - $isMember = $this->gdata->isMember($this->id, $generatedGroupName); - - $this->assertTrue($isMember); - - $isMember = $this->gdata->isMember('foo_' . $this->id, $generatedGroupName); - - $this->assertFalse($isMember); - - } - - // Test the convenience isOwner method - public function testIsOwner() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testIsMember()'); - $this->autoDelete($group); - - // Create a user for the group - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addOwnerToGroup($this->id, $generatedGroupName); - - $isOwner = $this->gdata->isOwner($this->id, $generatedGroupName); - - $this->assertTrue($isOwner); - - $isOwner = $this->gdata->isOwner('foo_' . $this->id, $generatedGroupName); - - $this->assertFalse($isOwner); - - } - - // Test the convenience updateGroup method - public function testCanUpdateGroup() { - // Create a group - $generatedGroupName = strtolower((string) uniqid('zf-list-')); - $group = $this->gdata->createGroup($generatedGroupName, 'Test Group', - 'testCanUpdateGroup()'); - $this->autoDelete($group); - - //set new value and save it - - $group = $this->gdata->updateGroup($generatedGroupName, null, 'new description here'); - - //verify new value - $description = null; - - $properties = $group->getProperty(); - foreach ($properties as $property) { - if($property->name == 'description') { - $description = $property->value; - } - } - - $this->assertEquals('new description here', $description); - - } - - public function testEmailListCRUDOperations() { - // Create email list - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - $this->assertEquals($generatedListName, $list->emailList->name); - - // Retrieve email list - $query = $this->gdata->newEmailListQuery(); - $listFeed = $this->gdata->getEmailListFeed($query); - $entryCount = count($listFeed->entry); - $this->assertTrue($entryCount > 0); - - // Delete email list (uses builtin delete method, convenience delete - // method tested further down) - $list->delete(); - - // Ensure that nickname was deleted - $listFeed = $this->gdata->getEmailListFeed($query); - $this->assertEquals($entryCount - 1, count($listFeed->entry)); - } - - public function testCanAssignMultipleEmailListsToOneUser() { - // Create a user - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - - // Create two email lists - $listCount = 2; - - for ($i = 0; $i < $listCount; $i++) { - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - $this->gdata->addRecipientToEmailList($this->id, $generatedListName); - } - - // Make sure that the user is subscribed to both lists - $subscriptions = $this->gdata->retrieveEmailLists($this->id); - $this->assertEquals($listCount, count($subscriptions->entry)); - } - - public function testCanRetrievePageOfEmailLists() { - // Create an email list - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - - // Try retrieving the email list feed - $feed = $this->gdata->retrievePageOfEmailLists(); - $this->assertTrue(count($feed->entry) > 0); - } - - public function testCanRetrieveAllEmailLists() { - // Create a couple of users to make sure we don't hit the limit - // on the max number of email lists. - for ($i = 0; $i < 3; $i++) { - $user = $this->gdata->createUser(uniqid('ZF-'), self::GIVEN_NAME, self::FAMILY_NAME, - sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - } - - // Create a whole bunch of email lists to make sure we trigger - // paging. - for ($i = 0; $i < 30; $i++) { - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - } - - // Try retrieving the email list feed - $feed = $this->gdata->retrieveAllEmailLists(); - $this->assertTrue(count($feed->entry) >= 30); - } - - // Test the convenience delete method for email lists - public function testCanDeleteEmailList() { - // Create an email list - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - - // Assert that the email list exists, just in case... - $query = $this->gdata->newEmailListQuery(); - $query->setEmailListName($generatedListName); - $entry = $this->gdata->getEmailListEntry($query); - $this->assertNotNull($entry); - - // Delete nickname - $this->gdata->deleteEmailList($generatedListName); - - // Ensure that nickname was deleted - try { - $query = $this->gdata->newEmailListQuery(); - $query->setEmailListName($generatedListName); - $entry = $this->gdata->getEmailListEntry($query); - // This souldn't execute - $this->fail('Retrieving a non-existant email list entry didn\'t' . - 'raise exception.'); - } catch (Zend_Gdata_Gapps_ServiceException $e) { - if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { - // Dummy assertion just to say we tested something here. - $this->assertTrue(true); - } else { - // Exception thrown for an unexpected reason - throw $e; - } - } - } - - public function testCanRetrievePageOfRecipients() { - // Create a new email list - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - - // Create two users and assign them to the email list - $userCount = 2; - for ($i = 0; $i < $userCount; $i++) { - $generatedUsername = uniqid('ZF-'); - $user = $this->gdata->createUser($generatedUsername, - self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), - self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addRecipientToEmailList($generatedUsername, - $generatedListName); - } - - // Retrieve recipients - $recipientFeed = - $this->gdata->retrievePageOfRecipients($generatedListName); - $this->assertTrue(count($recipientFeed->entry) == $userCount); - } - - public function testCanRetrievAllRecipients() { - // Create a new email list - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - - // Create enough users to trigger paging and assign them to the email - // list - $userCount = 30; - for ($i = 0; $i < $userCount; $i++) { - $generatedUsername = uniqid('ZF-'); - $user = $this->gdata->createUser($generatedUsername, - self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), - self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addRecipientToEmailList($generatedUsername, - $generatedListName); - } - - // Retrieve recipients - $recipientFeed = - $this->gdata->retrieveAllRecipients($generatedListName); - $this->assertTrue(count($recipientFeed->entry) == $userCount); - } - - // Test the convenience delete method for email list recipients - public function testCanDeleteEmailListRecipient() { - // Create an email list - $generatedListName = strtolower((string) uniqid('zf-list-')); - $list = $this->gdata->createEmailList($generatedListName); - $this->autoDelete($list); - - // Create a user for the email list - $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, - self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); - $this->autoDelete($user); - $this->gdata->addRecipientToEmailList($this->id, $generatedListName); - - // Assert that the recipient exists, just in case... - $recipients = - $this->gdata->retrieveAllRecipients($generatedListName); - $this->assertTrue(count($recipients->entry) == 1); - - // Remove the user from the list - $this->gdata->removeRecipientFromEmailList($user->login->username, - $generatedListName); - - // Ensure that user was deleted - $recipients = - $this->gdata->retrieveAllRecipients($generatedListName); - $this->assertTrue(count($recipients->entry) == 0); - } - -} diff --git a/tests/Zend/Gdata/GappsTest.php b/tests/Zend/Gdata/GappsTest.php deleted file mode 100644 index 67aaacad7..000000000 --- a/tests/Zend/Gdata/GappsTest.php +++ /dev/null @@ -1,80 +0,0 @@ -gdata = new Zend_Gdata_Gapps(null, self::TEST_DOMAIN); - } - - public function testMagicFactoryProvidesQueriesWithDomains() { - $userQ = $this->gdata->newUserQuery(); - $this->assertTrue($userQ instanceof Zend_Gdata_Gapps_UserQuery); - $this->assertEquals(self::TEST_DOMAIN, $userQ->getDomain()); - $this->assertEquals(null, $userQ->getUsername()); - - $userQ = $this->gdata->newUserQuery('foo'); - $this->assertTrue($userQ instanceof Zend_Gdata_Gapps_UserQuery); - $this->assertEquals(self::TEST_DOMAIN, $userQ->getDomain()); - $this->assertEquals('foo', $userQ->getUsername()); - } - - public function testMagicFactoryLeavesNonQueriesAlone() { - $login = $this->gdata->newLogin('blah'); - $this->assertTrue($login instanceof Zend_Gdata_Gapps_Extension_Login); - $this->assertEquals('blah', $login->username); - } - - public function testEmptyResponseExceptionRaisesException() { - // require_once('Zend/Gdata/App/HttpException.php'); - $e = new Zend_Gdata_App_HttpException(); - $e->setResponse(null); - $success = false; - try { - $this->gdata->throwServiceExceptionIfDetected($e); - } catch (Zend_Gdata_App_IOException $f) { - $success = true; - } - $this->assertTrue($success, 'Zend_Gdata_App_IOException not thrown'); - } - -} diff --git a/tests/Zend/Gdata/GdataOnlineTest.php b/tests/Zend/Gdata/GdataOnlineTest.php deleted file mode 100644 index 38aa3b9a5..000000000 --- a/tests/Zend/Gdata/GdataOnlineTest.php +++ /dev/null @@ -1,342 +0,0 @@ -blog = constant('TESTS_ZEND_GDATA_BLOG_ID'); - $service = 'blogger'; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $this->gdata = new Zend_Gdata($client); - $this->gdata->setMajorProtocolVersion(2); - } - - public function testPostAndDeleteByEntry() - { - $postUrl = 'http://www.blogger.com/feeds/' . $this->blog . - '/posts/default'; - $entry = $this->gdata->newEntry(); - $entry->title = $this->gdata->newTitle('PHP test blog post'); - $entry->content = $this->gdata->newContent('Blog post content...'); - $insertedEntry = $this->gdata->insertEntry($entry, $postUrl); - $this->assertEquals('PHP test blog post', $insertedEntry->title->text); - $this->assertEquals('Blog post content...', - $insertedEntry->content->text); - $this->assertTrue( - strpos((string) $insertedEntry->getEditLink()->href, 'http') === 0); - $this->gdata->delete($insertedEntry); - } - - public function testPostAndDeleteByUrl() - { - $postUrl = 'http://www.blogger.com/feeds/' . $this->blog . - '/posts/default'; - $entry = $this->gdata->newEntry(); - $entry->title = $this->gdata->newTitle('PHP test blog post'); - $entry->content = $this->gdata->newContent('Blog post content...'); - $insertedEntry = $this->gdata->insertEntry($entry, $postUrl); - $this->assertTrue( - strpos((string) $insertedEntry->getEditLink()->href, 'http') === 0); - $this->gdata->delete($insertedEntry->getEditLink()->href); - } - - public function testPostRetrieveEntryAndDelete() - { - $postUrl = 'http://www.blogger.com/feeds/' . $this->blog . - '/posts/default'; - $entry = $this->gdata->newEntry(); - $entry->title = $this->gdata->newTitle(' PHP test blog post '); - $this->assertTrue(isset($entry->title)); - $entry->content = $this->gdata->newContent('Blog post content...'); - - /* testing getText and __toString */ - $this->assertEquals("PHP test blog post", - $entry->title->getText()); - $this->assertEquals(" PHP test blog post ", - $entry->title->getText(false)); - $this->assertEquals($entry->title->getText(), - $entry->title->__toString()); - - $insertedEntry = $this->gdata->insertEntry($entry, $postUrl); - $retrievedEntryQuery = $this->gdata->newQuery( - $insertedEntry->getSelfLink()->href); - $retrievedEntry = $this->gdata->getEntry($retrievedEntryQuery); - $this->assertTrue( - strpos((string) $retrievedEntry->getEditLink()->href, 'http') === 0); - $this->gdata->delete($retrievedEntry); - } - - public function testPostUpdateAndDeleteEntry() - { - $postUrl = 'http://www.blogger.com/feeds/' . $this->blog . - '/posts/default'; - $entry = $this->gdata->newEntry(); - $entry->title = $this->gdata->newTitle('PHP test blog post'); - $entry->content = $this->gdata->newContent('Blog post content...'); - $insertedEntry = $this->gdata->insertEntry($entry, $postUrl); - $this->assertTrue( - strpos((string) $insertedEntry->getEditLink()->href, 'http') === 0); - $insertedEntry->title->text = 'PHP test blog post modified'; - $updatedEntry = $this->gdata->updateEntry($insertedEntry); - $this->assertEquals('PHP test blog post modified', - $updatedEntry->title->text); - $updatedEntry->title->text = 'PHP test blog post modified twice'; - // entry->saveXML() and entry->getXML() should be the same - $this->assertEquals($updatedEntry->saveXML(), - $updatedEntry->getXML()); - $newlyUpdatedEntry = $this->gdata->updateEntry($updatedEntry); - $this->assertEquals('PHP test blog post modified twice', - $updatedEntry->title->text); - $updatedEntry->delete(); - } - - public function testFeedImplementation() - { - $blogsUrl = 'http://www.blogger.com/feeds/default/blogs'; - $blogsQuery = $this->gdata->newQuery($blogsUrl); - $retrievedFeed = $this->gdata->getFeed($blogsQuery); - // rewind the retrieved feed first - $retrievedFeed->rewind(); - - // Make sure the iterator and array impls match - $entry1 = $retrievedFeed->current(); - $entry2 = $retrievedFeed[0]; - $this->assertEquals($entry1, $entry2); - - /* - TODO: Fix these tests - // Test ArrayAccess interface - $firstBlogTitle = $retrievedFeed[0]->title->text; - $entries = $retrievedFeed->entry; - $entries[0]->title->text = $firstBlogTitle . "**"; - $retrievedFeed[0] = $entries[0]; - $this->assertEquals($retrievedFeed->entry[0]->title->text, - $retrievedFeed[0]->title->text); - $this->assertEquals($firstBlogTitle . "**", - $retrievedFeed[0]->title->text); - */ - } - - public function testBadFeedRetrieval() - { - $feed = $this->gdata->newFeed(); - try { - $returnedFeed = $this->gdata->getFeed($feed); - } catch (Zend_Gdata_App_InvalidArgumentException $e) { - // we're expecting to cause an exception here - } - } - - public function testBadEntryRetrieval() - { - $entry = $this->gdata->newEntry(); - try { - $returnedEntry = $this->gdata->getEntry($entry); - } catch (Zend_Gdata_App_InvalidArgumentException $e) { - // we're expecting to cause an exception here - } - } - - public function testMediaUpload() - { - // the standard sevice for Gdata testing is Blogger, due to the strong - // match to the standard Gdata/APP protocol. However, Blogger doesn't - // currently support media uploads, so we're using Picasa Web Albums - // for this test instead - $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); - $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); - $this->blog = constant('TESTS_ZEND_GDATA_BLOG_ID'); - $service = 'lh2'; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $gd = new Zend_Gdata($client); - - // setup the photo content - $fs = $gd->newMediaFileSource('Zend/Gdata/_files/testImage.jpg'); - $fs->setContentType('image/jpeg'); - - - // create a new picasa album - $albumEntry = $gd->newEntry(); - $albumEntry->setTitle($gd->newTitle('My New Test Album')); - $albumEntry->setCategory(array($gd->newCategory( - 'http://schemas.google.com/photos/2007#album', - 'http://schemas.google.com/g/2005#kind' - ))); - $createdAlbumEntry = $gd->insertEntry($albumEntry, - 'http://picasaweb.google.com/data/feed/api/user/default'); - $this->assertEquals('My New Test Album', - $createdAlbumEntry->title->text); - $albumUrl = $createdAlbumEntry->getLink('http://schemas.google.com/g/2005#feed')->href; - - // post the photo to the new album, without any metadata - // other than the slug - // add a slug header to the media file source - $fs->setSlug('Going to the park'); - $createdPhotoBinaryOnly = $gd->insertEntry($fs, $albumUrl); - $this->assertEquals('Going to the park', - $createdPhotoBinaryOnly->title->text); - - // post the photo to the new album along with the entry - // remove slug header from the media file source - $fs->setSlug(null); - - // setup an entry with metadata - $mediaEntry = $gd->newMediaEntry(); - $mediaEntry->setMediaSource($fs); - - $mediaEntry->setTitle($gd->newTitle('My New Test Photo')); - $mediaEntry->setSummary($gd->newSummary('My New Test Photo Summary')); - $mediaEntry->setCategory(array($gd->newCategory( - 'http://schemas.google.com/photos/2007#photo ', - 'http://schemas.google.com/g/2005#kind' - ))); - $createdPhotoMultipart = $gd->insertEntry($mediaEntry, $albumUrl); - $this->assertEquals('My New Test Photo', - $createdPhotoMultipart->title->text); - - // cleanup and remove the album - // first we wait 5 seconds - sleep(5); - try { - $albumEntry->delete(); - } catch (Zend_Gdata_App_Exception $e) { - $this->fail('Tried to delete the test album, got exception: ' . - $e->getMessage()); - } - } - - function testIsAuthenticated() - { - $this->assertTrue($this->gdata->isAuthenticated()); - } - - function testRetrieveNextAndPreviousFeedsFromService() - { - $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); - $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); - $this->blog = constant('TESTS_ZEND_GDATA_BLOG_ID'); - $service = 'youtube'; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $gd = new Zend_Gdata($client); - - $feed = $gd->getFeed( - 'http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured', - 'Zend_Gdata_App_Feed'); - - $this->assertNotNull($feed); - $this->assertTrue($feed instanceof Zend_Gdata_App_Feed); - $this->assertEquals($feed->count(), 25); - - $nextFeed = $gd->getNextFeed($feed); - - $this->assertNotNull($nextFeed); - $this->assertTrue($nextFeed instanceof Zend_Gdata_App_Feed); - $this->assertEquals($nextFeed->count(), 25); - - $previousFeed = $gd->getPreviousFeed($nextFeed); - - $this->assertNotNull($previousFeed); - $this->assertTrue($previousFeed instanceof Zend_Gdata_App_Feed); - $this->assertEquals($previousFeed->count(), 25); - - } - - function testRetrieveNextFeedAndPreviousFeedsFromFeed() - { - $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); - $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); - $this->blog = constant('TESTS_ZEND_GDATA_BLOG_ID'); - $service = 'youtube'; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $gd = new Zend_Gdata($client); - - $feed = $gd->getFeed( - 'http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured', - 'Zend_Gdata_App_Feed'); - - $nextFeed = $feed->getNextFeed(); - - $this->assertNotNull($nextFeed); - $this->assertTrue($nextFeed instanceof Zend_Gdata_App_Feed); - $this->assertEquals($nextFeed->count(), 25); - - $previousFeed = $nextFeed->getPreviousFeed(); - - $this->assertNotNull($previousFeed); - $this->assertTrue($previousFeed instanceof Zend_Gdata_App_Feed); - $this->assertEquals($previousFeed->count(), 25); - - } - - public function testDisableXMLToObjectMappingReturnsStringForFeed() - { - $gdata = new Zend_Gdata(); - $gdata->useObjectMapping(false); - $xmlString = $gdata->getFeed( - 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated'); - $this->assertEquals('string', gettype($xmlString)); - } - - public function testDisableXMLToObjectMappingReturnsStringForEntry() - { - $gdata = new Zend_Gdata(); - $gdata->useObjectMapping(false); - $xmlString = $gdata->getFeed( - 'http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); - $this->assertEquals('string', gettype($xmlString)); - } - - public function testDisableAndReEnableXMLToObjectMappingReturnsObject() - { - $gdata = new Zend_Gdata(); - $gdata->useObjectMapping(false); - $xmlString = $gdata->getEntry( - 'http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); - $this->assertEquals('string', gettype($xmlString)); - $gdata->useObjectMapping(true); - $entry = $gdata->getEntry( - 'http://gdata.youtube.com/feeds/api/videos/O4SWAfisH-8'); - $this->assertTrue($entry instanceof Zend_Gdata_Entry); - } - -} diff --git a/tests/Zend/Gdata/GdataTest.php b/tests/Zend/Gdata/GdataTest.php deleted file mode 100644 index ed4bd4743..000000000 --- a/tests/Zend/Gdata/GdataTest.php +++ /dev/null @@ -1,103 +0,0 @@ -getHttpClient(); - $this->assertTrue($client instanceof Zend_Http_Client, - 'Expecting object of type Zend_Http_Client, got ' - . (gettype($client) == 'object' ? get_class($client) : gettype($client)) - ); - } - - public function testSpecificHttpClient() - { - $client = new Zend_Http_Client(); - $gdata = new Zend_Gdata($client); - $client2 = $gdata->getHttpClient(); - $this->assertTrue($client2 instanceof Zend_Http_Client, - 'Expecting object of type Zend_Http_Client, got ' - . (gettype($client) == 'object' ? get_class($client) : gettype($client)) - ); - $this->assertSame($client, $client2); - } - - public function testExceptionNotHttpClient() - { - $obj = new ArrayObject(); - try { - $gdata = new Zend_Gdata($obj); - $this->fail('Expecting to catch Zend_Gdata_App_HttpException'); - } catch (\Throwable $e) { - $this->assertThat($e, $this->isInstanceOf('Zend_Gdata_App_HttpException'), - 'Expecting Zend_Gdata_App_HttpException, got '.get_class($e)); - $this->assertEquals('Argument is not an instance of Zend_Http_Client.', $e->getMessage()); - } - } - - public function testGetFeedExceptionInvalidLocationType() - { - $gdata = new Zend_Gdata(); - try { - // give it neither a string nor a Zend_Gdata_Query object, - // and see if it throws an exception. - $feed = $gdata->getFeed(new stdClass()); - $this->fail('Expecting to catch Zend_Gdata_App_InvalidArgumentException'); - } catch (Zend_Exception $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException, - 'Expecting Zend_Gdata_App_InvalidArgumentException, got '.get_class($e)); - $this->assertEquals('You must specify the location as either a string URI or a child of Zend_Gdata_Query', $e->getMessage()); - } - } - - public function testGetEntryExceptionInvalidLocationType() - { - $gdata = new Zend_Gdata(); - try { - // give it neither a string nor a Zend_Gdata_Query object, - // and see if it throws an exception. - $feed = $gdata->getEntry(new stdClass()); - $this->fail('Expecting to catch Zend_Gdata_App_InvalidArgumentException'); - } catch (Zend_Exception $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException, - 'Expecting Zend_Gdata_App_InvalidArgumentException, got '.get_class($e)); - $this->assertEquals('You must specify the location as either a string URI or a child of Zend_Gdata_Query', $e->getMessage()); - } - } - -} diff --git a/tests/Zend/Gdata/MediaMimeStreamTest.php b/tests/Zend/Gdata/MediaMimeStreamTest.php deleted file mode 100644 index 99b8af87e..000000000 --- a/tests/Zend/Gdata/MediaMimeStreamTest.php +++ /dev/null @@ -1,187 +0,0 @@ -locationOfFakeBinary = - 'Zend/Gdata/_files/MediaMimeStreamSample1.txt'; - $this->smallXMLString = 'foo'; - $this->testMediaType = 'video/mpeg'; - $this->mediaMimeStream = new Zend_Gdata_MediaMimeStream( - $this->smallXMLString, $this->locationOfFakeBinary, - $this->testMediaType); - $this->exceptedLenOfMimeMessage = 283; - } - - public function testExceptionOnUnreadableFile() - { - $exceptionThrown = false; - try { - $mediaMimeStream = new Zend_Gdata_MediaMimeStream( - $this->smallXMLString, '/non/existant/path/to/nowhere'); - } catch (Zend_Gdata_App_IOException $e) { - $exceptionThrown = true; - } - $this->assertTrue($exceptionThrown, 'Was expecting an exception on ' . - 'attempting to read an unreadable or non-existant file'); - } - - public function testGetTotalSize() - { - $this->assertEquals($this->exceptedLenOfMimeMessage, - $this->mediaMimeStream->getTotalSize()); - } - - public function testHasData() - { - $this->assertTrue($this->mediaMimeStream->hasData()); - } - - public function testGetContentType() - { - $pattern = - '/multipart\/related;\sboundary=\"=_[a-z0-9]{32,}.*\"/'; - $this->assertEquals(1, preg_match($pattern, - $this->mediaMimeStream->getContentType())); - } - - /** - * Ensure that nothing breaks if we read past the end of the messsage in a - * single read. - * - * Note: The test message has the following part sizes in length: - * 211, 22, 39 for a total size of 272. This test performs a single read - * for 400 bytes. - */ - public function testReadAll() - { - $this->assertEquals($this->exceptedLenOfMimeMessage, - $this->mediaMimeStream->getTotalSize()); - $outputArray = array(); - while ($this->mediaMimeStream->hasData()) { - $outputArray = explode("\r\n", $this->mediaMimeStream->read(400)); - } - $mimeBoundaryPattern = '/--=_[a-z0-9]{32,}/'; - $mimeClosingBoundaryPattern = '/--=_[a-z0-9]{32,}--/'; - $this->assertEquals('', $outputArray[0]); - $this->assertEquals(1, - preg_match($mimeBoundaryPattern, $outputArray[1])); - $this->assertEquals('Content-Type: application/atom+xml', - $outputArray[2]); - $this->assertEquals('', $outputArray[3]); - $this->assertEquals($this->smallXMLString, $outputArray[4]); - $this->assertEquals('', $outputArray[5]); - $this->assertEquals(1, - preg_match($mimeBoundaryPattern, $outputArray[6])); - $this->assertEquals('Content-Type: video/mpeg', $outputArray[7]); - $this->assertEquals('Content-Transfer-Encoding: binary', - $outputArray[8]); - $this->assertEquals('', $outputArray[9]); - $this->assertEquals(file_get_contents($this->locationOfFakeBinary), - $outputArray[10]); - $this->assertEquals(1, - preg_match($mimeClosingBoundaryPattern, $outputArray[11])); - } - - /** - * Ensure that a variety of different stream sizes work. - * - * Note: The test message has the following part sizes in length: - * 211, 22, 39 for a total size of 287. - */ - public function testReadVariousBufferSizes() - { - $bufferSizesToTest = array(2, 20, 33, 44, 88, 100, 201); - foreach($bufferSizesToTest as $sizeToTest) { - $mediaMimeStream = new Zend_Gdata_MediaMimeStream( - $this->smallXMLString, $this->locationOfFakeBinary, - $this->testMediaType); - $this->assertEquals($sizeToTest, - strlen((string) $mediaMimeStream->read($sizeToTest))); - } - } - - /** - * Ensure that nothing breaks if we read a message 1 byte at time. - */ - public function testReadWithoutCrossingSections() - { - $outputString = ''; - while ($this->mediaMimeStream->hasData()) { - $outputString .= $this->mediaMimeStream->read(1); - } - $this->assertEquals($this->exceptedLenOfMimeMessage, - strlen((string) $outputString)); - } - - /** - * Ensure that nothing breaks if we read past at least two sections of - * the message. - * - * Note: The test message has the following part sizes in length: - * 211, 22, 39 for a total size of 272. This test reads 250 bytes at a time - * to make sure that we cross sections 1 and 2 and then read part of - * section 3. - */ - public function testReadCrossing2Sections() - { - $outputString = ''; - while ($this->mediaMimeStream->hasData()) { - $outputString .= $this->mediaMimeStream->read(250); - } - $this->assertEquals($this->exceptedLenOfMimeMessage, - strlen((string) $outputString)); - } - - /** - * Ensure that nothing breaks if we read past at least one section of - * the message. - * - * Note: The test message has the following part sizes in length: - * 211, 22, 39 for a total size of 272. This test reads 230 bytes at a time - * to make sure that we cross section 1 and then read sections 2 and 3. - */ - public function testReadCrossing1Section() - { - $outputString = ''; - while ($this->mediaMimeStream->hasData()) { - $outputString .= $this->mediaMimeStream->read(230); - } - $this->assertEquals($this->exceptedLenOfMimeMessage, - strlen((string) $outputString)); - } - -} diff --git a/tests/Zend/Gdata/OpenSearchItemsPerPageTest.php b/tests/Zend/Gdata/OpenSearchItemsPerPageTest.php deleted file mode 100644 index 5848eb19e..000000000 --- a/tests/Zend/Gdata/OpenSearchItemsPerPageTest.php +++ /dev/null @@ -1,127 +0,0 @@ -openSearchItemsPerPageText = file_get_contents( - 'Zend/Gdata/_files/OpenSearchItemsPerPageElementSample1.xml', - true); - $this->openSearchItemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); - } - - public function testEmptyOpenSearchItemsPerPageShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->openSearchItemsPerPage->extensionElements)); - $this->assertTrue(count($this->openSearchItemsPerPage->extensionElements) == 0); - } - - public function testEmptyOpenSearchItemsPerPageShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->openSearchItemsPerPage->extensionAttributes)); - $this->assertTrue(count($this->openSearchItemsPerPage->extensionAttributes) == 0); - } - - public function testSampleOpenSearchItemsPerPageShouldHaveNoExtensionElements() { - $this->openSearchItemsPerPage->transferFromXML($this->openSearchItemsPerPageText); - $this->assertTrue(is_array($this->openSearchItemsPerPage->extensionElements)); - $this->assertTrue(count($this->openSearchItemsPerPage->extensionElements) == 0); - } - - public function testSampleOpenSearchItemsPerPageShouldHaveNoExtensionAttributes() { - $this->openSearchItemsPerPage->transferFromXML($this->openSearchItemsPerPageText); - $this->assertTrue(is_array($this->openSearchItemsPerPage->extensionAttributes)); - $this->assertTrue(count($this->openSearchItemsPerPage->extensionAttributes) == 0); - } - - public function testNormalOpenSearchItemsPerPageShouldHaveNoExtensionElements() { - $this->openSearchItemsPerPage->text = "200"; - - $this->assertEquals("200", $this->openSearchItemsPerPage->text); - - $this->assertEquals(0, count($this->openSearchItemsPerPage->extensionElements)); - $newOpenSearchItemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); - $newOpenSearchItemsPerPage->transferFromXML($this->openSearchItemsPerPage->saveXML()); - $this->assertEquals(0, count($newOpenSearchItemsPerPage->extensionElements)); - $newOpenSearchItemsPerPage->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newOpenSearchItemsPerPage->extensionElements)); - $this->assertEquals("200", $newOpenSearchItemsPerPage->text); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newOpenSearchItemsPerPage2 = $gdata->newOpenSearchItemsPerPage(); - $newOpenSearchItemsPerPage2->transferFromXML($newOpenSearchItemsPerPage->saveXML()); - $this->assertEquals(1, count($newOpenSearchItemsPerPage2->extensionElements)); - $this->assertEquals("200", $newOpenSearchItemsPerPage2->text); - } - - public function testEmptyOpenSearchItemsPerPageToAndFromStringShouldMatch() { - $openSearchItemsPerPageXml = $this->openSearchItemsPerPage->saveXML(); - $newOpenSearchItemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); - $newOpenSearchItemsPerPage->transferFromXML($openSearchItemsPerPageXml); - $newOpenSearchItemsPerPageXml = $newOpenSearchItemsPerPage->saveXML(); - $this->assertTrue($openSearchItemsPerPageXml == $newOpenSearchItemsPerPageXml); - } - - public function testOpenSearchItemsPerPageWithValueToAndFromStringShouldMatch() { - $this->openSearchItemsPerPage->text = "200"; - $openSearchItemsPerPageXml = $this->openSearchItemsPerPage->saveXML(); - $newOpenSearchItemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); - $newOpenSearchItemsPerPage->transferFromXML($openSearchItemsPerPageXml); - $newOpenSearchItemsPerPageXml = $newOpenSearchItemsPerPage->saveXML(); - $this->assertTrue($openSearchItemsPerPageXml == $newOpenSearchItemsPerPageXml); - $this->assertEquals("200", $this->openSearchItemsPerPage->text); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->openSearchItemsPerPage->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->openSearchItemsPerPage->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->openSearchItemsPerPage->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->openSearchItemsPerPage->extensionAttributes['foo2']['value']); - $openSearchItemsPerPageXml = $this->openSearchItemsPerPage->saveXML(); - $newOpenSearchItemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage(); - $newOpenSearchItemsPerPage->transferFromXML($openSearchItemsPerPageXml); - $this->assertEquals('bar', $newOpenSearchItemsPerPage->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newOpenSearchItemsPerPage->extensionAttributes['foo2']['value']); - } - - public function testConvertFullOpenSearchItemsPerPageToAndFromString() { - $this->openSearchItemsPerPage->transferFromXML($this->openSearchItemsPerPageText); - $this->assertEquals("25", $this->openSearchItemsPerPage->text); - } - -} diff --git a/tests/Zend/Gdata/OpenSearchStartIndexTest.php b/tests/Zend/Gdata/OpenSearchStartIndexTest.php deleted file mode 100644 index 9ffd23a02..000000000 --- a/tests/Zend/Gdata/OpenSearchStartIndexTest.php +++ /dev/null @@ -1,127 +0,0 @@ -openSearchStartIndexText = file_get_contents( - 'Zend/Gdata/_files/OpenSearchStartIndexElementSample1.xml', - true); - $this->openSearchStartIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); - } - - public function testEmptyOpenSearchStartIndexShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->openSearchStartIndex->extensionElements)); - $this->assertTrue(count($this->openSearchStartIndex->extensionElements) == 0); - } - - public function testEmptyOpenSearchStartIndexShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->openSearchStartIndex->extensionAttributes)); - $this->assertTrue(count($this->openSearchStartIndex->extensionAttributes) == 0); - } - - public function testSampleOpenSearchStartIndexShouldHaveNoExtensionElements() { - $this->openSearchStartIndex->transferFromXML($this->openSearchStartIndexText); - $this->assertTrue(is_array($this->openSearchStartIndex->extensionElements)); - $this->assertTrue(count($this->openSearchStartIndex->extensionElements) == 0); - } - - public function testSampleOpenSearchStartIndexShouldHaveNoExtensionAttributes() { - $this->openSearchStartIndex->transferFromXML($this->openSearchStartIndexText); - $this->assertTrue(is_array($this->openSearchStartIndex->extensionAttributes)); - $this->assertTrue(count($this->openSearchStartIndex->extensionAttributes) == 0); - } - - public function testNormalOpenSearchStartIndexShouldHaveNoExtensionElements() { - $this->openSearchStartIndex->text = "20"; - - $this->assertEquals("20", $this->openSearchStartIndex->text); - - $this->assertEquals(0, count($this->openSearchStartIndex->extensionElements)); - $newOpenSearchStartIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); - $newOpenSearchStartIndex->transferFromXML($this->openSearchStartIndex->saveXML()); - $this->assertEquals(0, count($newOpenSearchStartIndex->extensionElements)); - $newOpenSearchStartIndex->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newOpenSearchStartIndex->extensionElements)); - $this->assertEquals("20", $newOpenSearchStartIndex->text); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newOpenSearchStartIndex2 = $gdata->newOpenSearchStartIndex(); - $newOpenSearchStartIndex2->transferFromXML($newOpenSearchStartIndex->saveXML()); - $this->assertEquals(1, count($newOpenSearchStartIndex2->extensionElements)); - $this->assertEquals("20", $newOpenSearchStartIndex2->text); - } - - public function testEmptyOpenSearchStartIndexToAndFromStringShouldMatch() { - $openSearchStartIndexXml = $this->openSearchStartIndex->saveXML(); - $newOpenSearchStartIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); - $newOpenSearchStartIndex->transferFromXML($openSearchStartIndexXml); - $newOpenSearchStartIndexXml = $newOpenSearchStartIndex->saveXML(); - $this->assertTrue($openSearchStartIndexXml == $newOpenSearchStartIndexXml); - } - - public function testOpenSearchStartIndexWithValueToAndFromStringShouldMatch() { - $this->openSearchStartIndex->text = "20"; - $openSearchStartIndexXml = $this->openSearchStartIndex->saveXML(); - $newOpenSearchStartIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); - $newOpenSearchStartIndex->transferFromXML($openSearchStartIndexXml); - $newOpenSearchStartIndexXml = $newOpenSearchStartIndex->saveXML(); - $this->assertTrue($openSearchStartIndexXml == $newOpenSearchStartIndexXml); - $this->assertEquals("20", $this->openSearchStartIndex->text); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->openSearchStartIndex->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->openSearchStartIndex->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->openSearchStartIndex->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->openSearchStartIndex->extensionAttributes['foo2']['value']); - $openSearchStartIndexXml = $this->openSearchStartIndex->saveXML(); - $newOpenSearchStartIndex = new Zend_Gdata_Extension_OpenSearchStartIndex(); - $newOpenSearchStartIndex->transferFromXML($openSearchStartIndexXml); - $this->assertEquals('bar', $newOpenSearchStartIndex->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newOpenSearchStartIndex->extensionAttributes['foo2']['value']); - } - - public function testConvertFullOpenSearchStartIndexToAndFromString() { - $this->openSearchStartIndex->transferFromXML($this->openSearchStartIndexText); - $this->assertEquals("5", $this->openSearchStartIndex->text); - } - -} diff --git a/tests/Zend/Gdata/OpenSearchTotalResultsTest.php b/tests/Zend/Gdata/OpenSearchTotalResultsTest.php deleted file mode 100644 index 8a4b70773..000000000 --- a/tests/Zend/Gdata/OpenSearchTotalResultsTest.php +++ /dev/null @@ -1,127 +0,0 @@ -openSearchTotalResultsText = file_get_contents( - 'Zend/Gdata/_files/OpenSearchTotalResultsElementSample1.xml', - true); - $this->openSearchTotalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); - } - - public function testEmptyOpenSearchTotalResultsShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->openSearchTotalResults->extensionElements)); - $this->assertTrue(count($this->openSearchTotalResults->extensionElements) == 0); - } - - public function testEmptyOpenSearchTotalResultsShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->openSearchTotalResults->extensionAttributes)); - $this->assertTrue(count($this->openSearchTotalResults->extensionAttributes) == 0); - } - - public function testSampleOpenSearchTotalResultsShouldHaveNoExtensionElements() { - $this->openSearchTotalResults->transferFromXML($this->openSearchTotalResultsText); - $this->assertTrue(is_array($this->openSearchTotalResults->extensionElements)); - $this->assertTrue(count($this->openSearchTotalResults->extensionElements) == 0); - } - - public function testSampleOpenSearchTotalResultsShouldHaveNoExtensionAttributes() { - $this->openSearchTotalResults->transferFromXML($this->openSearchTotalResultsText); - $this->assertTrue(is_array($this->openSearchTotalResults->extensionAttributes)); - $this->assertTrue(count($this->openSearchTotalResults->extensionAttributes) == 0); - } - - public function testNormalOpenSearchTotalResultsShouldHaveNoExtensionElements() { - $this->openSearchTotalResults->text = "42"; - - $this->assertEquals("42", $this->openSearchTotalResults->text); - - $this->assertEquals(0, count($this->openSearchTotalResults->extensionElements)); - $newOpenSearchTotalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); - $newOpenSearchTotalResults->transferFromXML($this->openSearchTotalResults->saveXML()); - $this->assertEquals(0, count($newOpenSearchTotalResults->extensionElements)); - $newOpenSearchTotalResults->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newOpenSearchTotalResults->extensionElements)); - $this->assertEquals("42", $newOpenSearchTotalResults->text); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newOpenSearchTotalResults2 = $gdata->newOpenSearchTotalResults(); - $newOpenSearchTotalResults2->transferFromXML($newOpenSearchTotalResults->saveXML()); - $this->assertEquals(1, count($newOpenSearchTotalResults2->extensionElements)); - $this->assertEquals("42", $newOpenSearchTotalResults2->text); - } - - public function testEmptyOpenSearchTotalResultsToAndFromStringShouldMatch() { - $openSearchTotalResultsXml = $this->openSearchTotalResults->saveXML(); - $newOpenSearchTotalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); - $newOpenSearchTotalResults->transferFromXML($openSearchTotalResultsXml); - $newOpenSearchTotalResultsXml = $newOpenSearchTotalResults->saveXML(); - $this->assertTrue($openSearchTotalResultsXml == $newOpenSearchTotalResultsXml); - } - - public function testOpenSearchTotalResultsWithValueToAndFromStringShouldMatch() { - $this->openSearchTotalResults->text = "42"; - $openSearchTotalResultsXml = $this->openSearchTotalResults->saveXML(); - $newOpenSearchTotalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); - $newOpenSearchTotalResults->transferFromXML($openSearchTotalResultsXml); - $newOpenSearchTotalResultsXml = $newOpenSearchTotalResults->saveXML(); - $this->assertTrue($openSearchTotalResultsXml == $newOpenSearchTotalResultsXml); - $this->assertEquals("42", $this->openSearchTotalResults->text); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->openSearchTotalResults->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->openSearchTotalResults->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->openSearchTotalResults->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->openSearchTotalResults->extensionAttributes['foo2']['value']); - $openSearchTotalResultsXml = $this->openSearchTotalResults->saveXML(); - $newOpenSearchTotalResults = new Zend_Gdata_Extension_OpenSearchTotalResults(); - $newOpenSearchTotalResults->transferFromXML($openSearchTotalResultsXml); - $this->assertEquals('bar', $newOpenSearchTotalResults->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newOpenSearchTotalResults->extensionAttributes['foo2']['value']); - } - - public function testConvertFullOpenSearchTotalResultsToAndFromString() { - $this->openSearchTotalResults->transferFromXML($this->openSearchTotalResultsText); - $this->assertEquals("12", $this->openSearchTotalResults->text); - } - -} diff --git a/tests/Zend/Gdata/OriginalEventTest.php b/tests/Zend/Gdata/OriginalEventTest.php deleted file mode 100644 index 38517243c..000000000 --- a/tests/Zend/Gdata/OriginalEventTest.php +++ /dev/null @@ -1,135 +0,0 @@ -originalEventText = file_get_contents( - 'Zend/Gdata/_files/OriginalEventElementSample1.xml', - true); - $this->originalEvent = new Zend_Gdata_Extension_OriginalEvent(); - } - - public function testEmptyOriginalEventShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->originalEvent->extensionElements)); - $this->assertTrue(count($this->originalEvent->extensionElements) == 0); - } - - public function testEmptyOriginalEventShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->originalEvent->extensionAttributes)); - $this->assertTrue(count($this->originalEvent->extensionAttributes) == 0); - } - - public function testSampleOriginalEventShouldHaveNoExtensionElements() { - $this->originalEvent->transferFromXML($this->originalEventText); - $this->assertTrue(is_array($this->originalEvent->extensionElements)); - $this->assertTrue(count($this->originalEvent->extensionElements) == 0); - } - - public function testSampleOriginalEventShouldHaveNoExtensionAttributes() { - $this->originalEvent->transferFromXML($this->originalEventText); - $this->assertTrue(is_array($this->originalEvent->extensionAttributes)); - $this->assertTrue(count($this->originalEvent->extensionAttributes) == 0); - } - - public function testNormalOriginalEventShouldHaveNoExtensionElements() { - $this->originalEvent->href = "http://www.google.com/calendar/feeds/nobody@gmail.com/private/composite"; - $this->originalEvent->id = "abcdef123456789"; - - $this->assertEquals("http://www.google.com/calendar/feeds/nobody@gmail.com/private/composite", $this->originalEvent->href); - $this->assertEquals("abcdef123456789", $this->originalEvent->id); - - $this->assertEquals(0, count($this->originalEvent->extensionElements)); - $newOriginalEvent = new Zend_Gdata_Extension_OriginalEvent(); - $newOriginalEvent->transferFromXML($this->originalEvent->saveXML()); - $this->assertEquals(0, count($newOriginalEvent->extensionElements)); - $newOriginalEvent->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newOriginalEvent->extensionElements)); - $this->assertEquals("http://www.google.com/calendar/feeds/nobody@gmail.com/private/composite", $newOriginalEvent->href); - $this->assertEquals("abcdef123456789", $newOriginalEvent->id); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newOriginalEvent2 = $gdata->newOriginalEvent(); - $newOriginalEvent2->transferFromXML($newOriginalEvent->saveXML()); - $this->assertEquals(1, count($newOriginalEvent2->extensionElements)); - $this->assertEquals("http://www.google.com/calendar/feeds/nobody@gmail.com/private/composite", $newOriginalEvent2->href); - $this->assertEquals("abcdef123456789", $newOriginalEvent2->id); - } - - public function testEmptyOriginalEventToAndFromStringShouldMatch() { - $originalEventXml = $this->originalEvent->saveXML(); - $newOriginalEvent = new Zend_Gdata_Extension_OriginalEvent(); - $newOriginalEvent->transferFromXML($originalEventXml); - $newOriginalEventXml = $newOriginalEvent->saveXML(); - $this->assertTrue($originalEventXml == $newOriginalEventXml); - } - - public function testOriginalEventWithValueToAndFromStringShouldMatch() { - $this->originalEvent->href = "http://www.google.com/calendar/feeds/nobody@gmail.com/private/composite"; - $this->originalEvent->id = "abcdef123456789"; - $originalEventXml = $this->originalEvent->saveXML(); - $newOriginalEvent = new Zend_Gdata_Extension_OriginalEvent(); - $newOriginalEvent->transferFromXML($originalEventXml); - $newOriginalEventXml = $newOriginalEvent->saveXML(); - $this->assertTrue($originalEventXml == $newOriginalEventXml); - $this->assertEquals("http://www.google.com/calendar/feeds/nobody@gmail.com/private/composite", $this->originalEvent->href); - $this->assertEquals("abcdef123456789", $this->originalEvent->id); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->originalEvent->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->originalEvent->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->originalEvent->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->originalEvent->extensionAttributes['foo2']['value']); - $originalEventXml = $this->originalEvent->saveXML(); - $newOriginalEvent = new Zend_Gdata_Extension_OriginalEvent(); - $newOriginalEvent->transferFromXML($originalEventXml); - $this->assertEquals('bar', $newOriginalEvent->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newOriginalEvent->extensionAttributes['foo2']['value']); - } - - public function testConvertFullOriginalEventToAndFromString() { - $this->originalEvent->transferFromXML($this->originalEventText); - $this->assertEquals("http://www.google.com/calendar/feeds/userID/private/full/123456789", $this->originalEvent->href); - $this->assertEquals("i8fl1nrv2bl57c1qgr3f0onmgg", $this->originalEvent->id); - $this->assertTrue($this->originalEvent->when instanceof Zend_Gdata_Extension_When); - $this->assertEquals("2006-03-17T22:00:00.000Z", $this->originalEvent->when->startTime); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosAlbumEntryTest.php b/tests/Zend/Gdata/Photos/PhotosAlbumEntryTest.php deleted file mode 100644 index 1d9391553..000000000 --- a/tests/Zend/Gdata/Photos/PhotosAlbumEntryTest.php +++ /dev/null @@ -1,365 +0,0 @@ -albumEntry = new Zend_Gdata_Photos_AlbumEntry($albumEntryText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $entry = $this->albumEntry; - - // Assert that the entry's author is correct - $entryAuthor = $entry->getAuthor(); - $this->assertEquals($entryAuthor, $entry->author); - $this->assertEquals(1, count($entryAuthor)); - $this->assertTrue($entryAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); - $this->assertTrue($entryAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $entry = $this->albumEntry; - - // Assert that the entry's ID is correct - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $entry = $this->albumEntry; - - // Assert that the photo entry has an Atom Published object - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - $this->verifyProperty2($entry, "published", "text", "2007-09-05T07:00:00.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $entry = $this->albumEntry; - - // Assert that the entry's updated date is correct - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($entry, "updated", "text", - "2007-09-05T20:49:24.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($entry, "title", "text", "Test"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoUser() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); - $this->verifyProperty2($entry, "gphotoUser", "text", - "sample.user"); - $this->verifyProperty3($entry, "gphotoUser", "text", - "sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoNickname() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); - $this->verifyProperty2($entry, "gphotoNickname", "text", - "sample"); - $this->verifyProperty3($entry, "gphotoNickname", "text", - "sample"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoName() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoName() instanceof Zend_Gdata_Photos_Extension_Name); - $this->verifyProperty2($entry, "gphotoName", "text", - "Test"); - $this->verifyProperty3($entry, "gphotoName", "text", - "Test"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoId() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); - $this->verifyProperty2($entry, "gphotoId", "text", - "1"); - $this->verifyProperty3($entry, "gphotoId", "text", - "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoLocation() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoLocation() instanceof Zend_Gdata_Photos_Extension_Location); - $this->verifyProperty2($entry, "gphotoLocation", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoAccess() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoAccess() instanceof Zend_Gdata_Photos_Extension_Access); - $this->verifyProperty2($entry, "gphotoAccess", "text", - "public"); - $this->verifyProperty3($entry, "gphotoAccess", "text", - "public"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoTimestamp() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); - $this->verifyProperty2($entry, "gphotoTimestamp", "text", - "1188975600000"); - $this->verifyProperty3($entry, "gphotoTimestamp", "text", - "1188975600000"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoNumPhotos() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoNumPhotos() instanceof Zend_Gdata_Photos_Extension_NumPhotos); - $this->verifyProperty2($entry, "gphotoNumPhotos", "text", - "2"); - $this->verifyProperty3($entry, "gphotoNumPhotos", "text", - "2"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentingEnabled() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); - $this->verifyProperty2($entry, "gphotoCommentingEnabled", "text", - "true"); - $this->verifyProperty3($entry, "gphotoCommentingEnabled", "text", - "true"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentCount() - { - $entry = $this->albumEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); - $this->verifyProperty2($entry, "gphotoCommentCount", "text", - "0"); - $this->verifyProperty3($entry, "gphotoCommentCount", "text", - "0"); - } - - /** - * Check for the existence of a - */ - public function testMediaGroup() - { - $entry = $this->albumEntry; - - // Assert that the entry's media group exists - $this->assertTrue($entry->getMediaGroup() instanceof Zend_Gdata_Media_Extension_MediaGroup); - } - - /** - * Check for the geo data and verify that it contains the expected values - */ - public function testGeoData() - { - $geoRssWhere = $this->albumEntry->geoRssWhere; - $point = $geoRssWhere->point; - $pos = $point->pos; - $this->assertEquals("42.87194 13.56738", $pos->text); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosAlbumFeedTest.php b/tests/Zend/Gdata/Photos/PhotosAlbumFeedTest.php deleted file mode 100644 index e39931253..000000000 --- a/tests/Zend/Gdata/Photos/PhotosAlbumFeedTest.php +++ /dev/null @@ -1,470 +0,0 @@ -albumFeed = new Zend_Gdata_Photos_AlbumFeed($albumFeedText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of appropriate entry type and object count matches. - */ - public function testAlbumFeedToAndFromString() - { - $entryCount = 0; - foreach ($this->albumFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Photos_PhotoEntry || - $entry instanceof Zend_Gdata_Photos_TagEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->albumFeed and convert back to objects */ - $newListFeed = new Zend_Gdata_Photos_UserFeed( - $this->albumFeed->saveXML()); - $newEntryCount = 0; - foreach ($newListFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Photos_PhotoEntry || - $entry instanceof Zend_Gdata_Photos_TagEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that the number of entries equals the number - * of entries defined in the sample file. - */ - public function testEntryCount() - { - $entryCount = 0; - foreach ($this->albumFeed as $entry) { - $entryCount++; - } - $this->assertEquals(4, $entryCount); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $feed = $this->albumFeed; - - // Assert that the feed's author is correct - $feedAuthor = $feed->getAuthor(); - $this->assertEquals($feedAuthor, $feed->author); - $this->assertEquals(1, count($feedAuthor)); - $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($feedAuthor[0], "name", "text", "sample"); - $this->assertTrue($feedAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($feedAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - - // Assert that each entry has valid author data - foreach ($feed as $entry) { - if ($entry instanceof Zend_Gdata_Photos_AlbumEntry) { - $entryAuthor = $entry->getAuthor(); - $this->assertEquals(1, count($entryAuthor)); - $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); - $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - } - } - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $feed = $this->albumFeed; - - // Assert that the feed's ID is correct - $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($feed, "id", "text", - "http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"); - - // Assert that all entries have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - } - - // Assert one of the entry's IDs - $entry = $feed[0]; - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $feed = $this->albumFeed; - - // Assert that all photo entries have an Atom Published object - foreach ($feed as $entry) { - if ($entry instanceof Zend_Gdata_Photos_PhotoEntry) { - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - } - } - - // Assert one of the entry's Published dates - $entry = $feed[0]; - $this->verifyProperty2($entry, "published", "text", "2007-09-05T20:49:23.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $feed = $this->albumFeed; - - // Assert that the feed's updated date is correct - $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($feed, "updated", "text", - "2007-09-21T18:23:05.000Z"); - - // Assert that all entries have an Atom Updated object - foreach ($feed as $entry) { - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - } - - // Assert one of the entry's Updated dates - $entry = $feed[0]; - $this->verifyProperty2($entry, "updated", "text", "2007-09-21T18:23:05.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($feed, "title", "text", "Test"); - - // Assert that all entries have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - } - - // Assert one of the entry's Titles - $entry = $feed[0]; - $this->verifyProperty2($entry, "title", "text", "Aqua Blue.jpg"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSubtitle() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); - $this->verifyProperty2($feed, "subtitle", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGenerator() - { - $feed = $this->albumFeed; - - // Assert that the feed's generator is correct - $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); - $this->verifyProperty2($feed, "generator", "version", "1.00"); - $this->verifyProperty2($feed, "generator", "uri", "http://picasaweb.google.com/"); - $this->verifyProperty2($feed, "generator", "text", "Picasaweb"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testIcon() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getIcon() instanceof Zend_Gdata_App_Extension_Icon); - $this->verifyProperty2($feed, "icon", "text", - "http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/s160-c/Test.jpg"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoUser() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); - $this->verifyProperty2($feed, "gphotoUser", "text", - "sample.user"); - $this->verifyProperty3($feed, "gphotoUser", "text", - "sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoNickname() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); - $this->verifyProperty2($feed, "gphotoNickname", "text", - "sample"); - $this->verifyProperty3($feed, "gphotoNickname", "text", - "sample"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoName() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoName() instanceof Zend_Gdata_Photos_Extension_Name); - $this->verifyProperty2($feed, "gphotoName", "text", - "Test"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoId() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); - $this->verifyProperty2($feed, "gphotoId", "text", - "1"); - $this->verifyProperty3($feed, "gphotoId", "text", - "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoLocation() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoLocation() instanceof Zend_Gdata_Photos_Extension_Location); - $this->verifyProperty2($feed, "gphotoLocation", "text", - ""); - $this->verifyProperty3($feed, "gphotoLocation", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoAccess() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoAccess() instanceof Zend_Gdata_Photos_Extension_Access); - $this->verifyProperty2($feed, "gphotoAccess", "text", - "public"); - $this->verifyProperty3($feed, "gphotoAccess", "text", - "public"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoTimestamp() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); - $this->verifyProperty2($feed, "gphotoTimestamp", "text", - "1188975600000"); - $this->verifyProperty3($feed, "gphotoTimestamp", "text", - "1188975600000"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoNumPhotos() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoNumPhotos() instanceof Zend_Gdata_Photos_Extension_NumPhotos); - $this->verifyProperty2($feed, "gphotoNumPhotos", "text", - "2"); - $this->verifyProperty3($feed, "gphotoNumPhotos", "text", - "2"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentingEnabled() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); - $this->verifyProperty2($feed, "gphotoCommentingEnabled", "text", - "true"); - $this->verifyProperty3($feed, "gphotoCommentingEnabled", "text", - "true"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentCount() - { - $feed = $this->albumFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); - $this->verifyProperty2($feed, "gphotoCommentCount", "text", - "0"); - $this->verifyProperty3($feed, "gphotoCommentCount", "text", - "0"); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosAlbumQueryTest.php b/tests/Zend/Gdata/Photos/PhotosAlbumQueryTest.php deleted file mode 100644 index 4e9da35f6..000000000 --- a/tests/Zend/Gdata/Photos/PhotosAlbumQueryTest.php +++ /dev/null @@ -1,199 +0,0 @@ -setUser("sample.user"); - $query->setAlbumId("1"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/album/test"; - - $query->setAlbumId(null); - $query->setAlbumName("test"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check for thrown exceptions upon improper albumname/id setting - */ - public function testAlbumQueryExceptions() - { - $query = new Zend_Gdata_Photos_AlbumQuery(); - $query->setUser("sample.user"); - - try { - $generatedString = $query->getQueryUrl(); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - - $query->setAlbumId("1"); - $query->setAlbumName("test"); - - try { - $generatedString = $query->getQueryUrl(); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - } - - /** - * Check the consistency of an album feed request - * Projection is set to base - */ - public function testBaseAlbumQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/base/user/sample.user/albumid/1"; - - $query = new Zend_Gdata_Photos_AlbumQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setProjection("base"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of an album feed request filtered - * for a specific tag - */ - public function testTagFilterAlbumQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?tag=test"; - - $query = new Zend_Gdata_Photos_AlbumQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setTag("test"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of an album feed request for private data - */ - public function testPrivateAlbumQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?access=private"; - - $query = new Zend_Gdata_Photos_AlbumQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setAccess("private"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of an album feed request for specifically-sized thumbnails - */ - public function testThumbnailAlbumQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?thumbsize=72"; - - $query = new Zend_Gdata_Photos_AlbumQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setThumbsize("72"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the set thumbsize is correct - $this->assertEquals("72", $query->getThumbsize()); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of an album feed request for specifically-sized images - */ - public function testImgAlbumQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?imgmax=800"; - - $query = new Zend_Gdata_Photos_AlbumQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setImgMax("800"); - - // Assert that the set ImgMax is correct - $this->assertEquals("800", $query->getImgMax()); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - - // Check that ImgMax is set back to null - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"; - $query->setImgMax(null); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosCommentEntryTest.php b/tests/Zend/Gdata/Photos/PhotosCommentEntryTest.php deleted file mode 100644 index 2d6ba273b..000000000 --- a/tests/Zend/Gdata/Photos/PhotosCommentEntryTest.php +++ /dev/null @@ -1,230 +0,0 @@ -commentEntry = new Zend_Gdata_Photos_CommentEntry($commentEntryText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $entry = $this->commentEntry; - - // Assert that the entry's ID is correct - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5"); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $entry = $this->commentEntry; - - // Assert that the entry's author is correct - $entryAuthor = $entry->getAuthor(); - $this->assertEquals($entryAuthor, $entry->author); - $this->assertEquals(1, count($entryAuthor)); - $this->assertTrue($entryAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); - $this->assertTrue($entryAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $entry = $this->commentEntry; - - // Assert that the photo entry has an Atom Published object - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - $this->verifyProperty2($entry, "published", "text", "2007-09-21T18:22:53.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $entry = $this->commentEntry; - - // Assert that the entry's updated date is correct - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($entry, "updated", "text", - "2007-09-21T18:22:53.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $entry = $this->commentEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($entry, "title", "text", "sample"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testContent() - { - $entry = $this->commentEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getContent() instanceof Zend_Gdata_App_Extension_Content); - $this->verifyProperty2($entry, "content", "text", "test comment"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoId() - { - $entry = $this->commentEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); - $this->verifyProperty2($entry, "gphotoId", "text", - "5"); - $this->verifyProperty3($entry, "gphotoId", "text", - "5"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoPhotoId() - { - $entry = $this->commentEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoPhotoId() instanceof Zend_Gdata_Photos_Extension_PhotoId); - $this->verifyProperty2($entry, "gphotoPhotoId", "text", - "100"); - $this->verifyProperty3($entry, "gphotoPhotoId", "text", - "100"); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosPhotoEntryTest.php b/tests/Zend/Gdata/Photos/PhotosPhotoEntryTest.php deleted file mode 100644 index d424e32f5..000000000 --- a/tests/Zend/Gdata/Photos/PhotosPhotoEntryTest.php +++ /dev/null @@ -1,396 +0,0 @@ -photoEntry = new Zend_Gdata_Photos_PhotoEntry($photoEntryText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $entry = $this->photoEntry; - - // Assert that the entry's ID is correct - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $entry = $this->photoEntry; - - // Assert that the photo entry has an Atom Published object - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - $this->verifyProperty2($entry, "published", "text", "2007-09-05T20:49:24.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $entry = $this->photoEntry; - - // Assert that the entry's updated date is correct - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($entry, "updated", "text", - "2007-09-21T18:19:38.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $entry = $this->photoEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($entry, "title", "text", "Aqua Graphite.jpg"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoId() - { - $entry = $this->photoEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); - $this->verifyProperty2($entry, "gphotoId", "text", - "100"); - $this->verifyProperty3($entry, "gphotoId", "text", - "100"); - } - - /** - * Check for the existance of exif namespaced data and verify that it contains - * the expected value. - */ - public function testExifData() - { - $exifTags = $this->photoEntry->exifTags; - $this->assertTrue($exifTags != null); - $this->assertTrue($exifTags->flash != null); - $this->assertTrue($exifTags->fstop != null); - $this->assertTrue($exifTags->exposure != null); - $this->assertTrue($exifTags->focallength != null); - $this->assertTrue($exifTags->iso != null); - $this->assertTrue($exifTags->time != null); - $this->assertTrue($exifTags->distance != null); - $this->assertTrue($exifTags->make != null); - $this->assertTrue($exifTags->model != null); - $this->assertTrue($exifTags->imageUniqueID != null); - $this->assertEquals("true", $exifTags->flash->text); - $this->assertEquals("11.0", $exifTags->fstop->text); - $this->assertEquals("0.0040", $exifTags->exposure->text); - $this->assertEquals("22.0", $exifTags->focallength->text); - $this->assertEquals("200", $exifTags->iso->text); - $this->assertEquals("1180950900000", $exifTags->time->text); - $this->assertEquals("0.0",$exifTags->distance->text); - $this->assertEquals("Fictitious Camera Company",$exifTags->make->text); - $this->assertEquals("AMAZING-100D",$exifTags->model->text); - $this->assertEquals("a5ce2e36b9df7d3cb081511c72e73926", $exifTags->imageUniqueID->text); - } - - /** - * Check for the geo data and verify that it contains the expected values - */ - public function testGeoData() - { - $geoRssWhere = $this->photoEntry->geoRssWhere; - $point = $geoRssWhere->point; - $pos = $point->pos; - $this->assertEquals("41.87194 12.56738", $pos->text); - } - - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoVersion() - { - $entry = $this->photoEntry; - - // Assert that the entry's version is correct - $this->assertTrue($entry->getGphotoVersion() instanceof Zend_Gdata_Photos_Extension_Version); - $this->verifyProperty2($entry, "gphotoVersion", "text", - "1190398778006402"); - $this->verifyProperty3($entry, "gphotoVersion", "text", - "1190398778006402"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoAlbumId() - { - $entry = $this->photoEntry; - - // Assert that the entry's albumid is correct - $this->assertTrue($entry->getGphotoAlbumId() instanceof Zend_Gdata_Photos_Extension_AlbumId); - $this->verifyProperty2($entry, "gphotoAlbumId", "text", - "1"); - $this->verifyProperty3($entry, "gphotoAlbumId", "text", - "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoWidth() - { - $entry = $this->photoEntry; - - // Assert that the entry's width is correct - $this->assertTrue($entry->getGphotoWidth() instanceof Zend_Gdata_Photos_Extension_Width); - $this->verifyProperty2($entry, "gphotoWidth", "text", - "2560"); - $this->verifyProperty3($entry, "gphotoWidth", "text", - "2560"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoHeight() - { - $entry = $this->photoEntry; - - // Assert that the entry's height is correct - $this->assertTrue($entry->getGphotoHeight() instanceof Zend_Gdata_Photos_Extension_Height); - $this->verifyProperty2($entry, "gphotoHeight", "text", - "1600"); - $this->verifyProperty3($entry, "gphotoHeight", "text", - "1600"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoSize() - { - $entry = $this->photoEntry; - - // Assert that the entry's size is correct - $this->assertTrue($entry->getGphotoSize() instanceof Zend_Gdata_Photos_Extension_Size); - $this->verifyProperty2($entry, "gphotoSize", "text", - "798334"); - $this->verifyProperty3($entry, "gphotoSize", "text", - "798334"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoClient() - { - $entry = $this->photoEntry; - - // Assert that the entry's client is correct - $this->assertTrue($entry->getGphotoClient() instanceof Zend_Gdata_Photos_Extension_Client); - $this->verifyProperty2($entry, "gphotoClient", "text", - ""); - $this->verifyProperty3($entry, "gphotoClient", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoChecksum() - { - $entry = $this->photoEntry; - - // Assert that the entry's checksum is correct - $this->assertTrue($entry->getGphotoChecksum() instanceof Zend_Gdata_Photos_Extension_Checksum); - $this->verifyProperty2($entry, "gphotoChecksum", "text", - ""); - $this->verifyProperty3($entry, "gphotoChecksum", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoTimestamp() - { - $entry = $this->photoEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); - $this->verifyProperty2($entry, "gphotoTimestamp", "text", - "1189025363000"); - $this->verifyProperty3($entry, "gphotoTimestamp", "text", - "1189025363000"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentingEnabled() - { - $entry = $this->photoEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); - $this->verifyProperty2($entry, "gphotoCommentingEnabled", "text", - "true"); - $this->verifyProperty3($entry, "gphotoCommentingEnabled", "text", - "true"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentCount() - { - $entry = $this->photoEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); - $this->verifyProperty2($entry, "gphotoCommentCount", "text", - "0"); - $this->verifyProperty3($entry, "gphotoCommentCount", "text", - "0"); - } - - /** - * Check for the existence of a - */ - public function testMediaGroup() - { - $entry = $this->photoEntry; - - // Assert that the entry's media group exists - $this->assertTrue($entry->getMediaGroup() instanceof Zend_Gdata_Media_Extension_MediaGroup); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosPhotoFeedTest.php b/tests/Zend/Gdata/Photos/PhotosPhotoFeedTest.php deleted file mode 100644 index c5244fbe3..000000000 --- a/tests/Zend/Gdata/Photos/PhotosPhotoFeedTest.php +++ /dev/null @@ -1,436 +0,0 @@ -photoFeed = new Zend_Gdata_Photos_PhotoFeed($photoFeedText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of appropriate entry type and object count matches. - */ - public function testPhotoFeedToAndFromString() - { - $entryCount = 0; - foreach ($this->photoFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Photos_CommentEntry || - $entry instanceof Zend_Gdata_Photos_TagEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->photoFeed and convert back to objects */ - $newListFeed = new Zend_Gdata_Photos_PhotoFeed( - $this->photoFeed->saveXML()); - $newEntryCount = 0; - foreach ($newListFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Photos_CommentEntry || - $entry instanceof Zend_Gdata_Photos_TagEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that the number of entries equals the number - * of entries defined in the sample file. - */ - public function testEntryCount() - { - $entryCount = 0; - foreach ($this->photoFeed as $entry) { - $entryCount++; - } - $this->assertEquals(3, $entryCount); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $feed = $this->photoFeed; - - // Assert that the feed's ID is correct - $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($feed, "id", "text", - "http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100"); - - // Assert that all entries have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - } - - // Assert one of the entry's IDs - $entry = $feed[0]; - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/tag"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $feed = $this->photoFeed; - - // Assert that the feed's updated date is correct - $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($feed, "updated", "text", - "2007-09-21T18:23:05.000Z"); - - // Assert that all entries have an Atom Updated object - foreach ($feed as $entry) { - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - } - - // Assert one of the entry's Updated dates - $entry = $feed[0]; - $this->verifyProperty2($entry, "updated", "text", "2007-09-21T18:23:05.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $feed = $this->photoFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($feed, "title", "text", "Aqua Blue.jpg"); - - // Assert that all entries have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - } - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSubtitle() - { - $feed = $this->photoFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); - $this->verifyProperty2($feed, "subtitle", "text", - "Blue"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGenerator() - { - $feed = $this->photoFeed; - - // Assert that the feed's generator is correct - $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); - $this->verifyProperty2($feed, "generator", "version", "1.00"); - $this->verifyProperty2($feed, "generator", "uri", "http://picasaweb.google.com/"); - $this->verifyProperty2($feed, "generator", "text", "Picasaweb"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testIcon() - { - $feed = $this->photoFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getIcon() instanceof Zend_Gdata_App_Extension_Icon); - $this->verifyProperty2($feed, "icon", "text", - "http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoId() - { - $feed = $this->photoFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); - $this->verifyProperty2($feed, "gphotoId", "text", - "100"); - $this->verifyProperty3($feed, "gphotoId", "text", - "100"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoVersion() - { - $feed = $this->photoFeed; - - // Assert that the feed's version is correct - $this->assertTrue($feed->getGphotoVersion() instanceof Zend_Gdata_Photos_Extension_Version); - $this->verifyProperty2($feed, "gphotoVersion", "text", - "1190398985145172"); - $this->verifyProperty3($feed, "gphotoVersion", "text", - "1190398985145172"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoAlbumId() - { - $feed = $this->photoFeed; - - // Assert that the feed's albumid is correct - $this->assertTrue($feed->getGphotoAlbumId() instanceof Zend_Gdata_Photos_Extension_AlbumId); - $this->verifyProperty2($feed, "gphotoAlbumId", "text", - "1"); - $this->verifyProperty3($feed, "gphotoAlbumId", "text", - "1"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoTimestamp() - { - $feed = $this->photoFeed; - - // Assert that the feed's timestamp is correct - $this->assertTrue($feed->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); - $this->verifyProperty2($feed, "gphotoTimestamp", "text", - "1189025362000"); - $this->verifyProperty3($feed, "gphotoTimestamp", "text", - "1189025362000"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoWidth() - { - $feed = $this->photoFeed; - - // Assert that the feed's width is correct - $this->assertTrue($feed->getGphotoWidth() instanceof Zend_Gdata_Photos_Extension_Width); - $this->verifyProperty2($feed, "gphotoWidth", "text", - "2560"); - $this->verifyProperty3($feed, "gphotoWidth", "text", - "2560"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoHeight() - { - $feed = $this->photoFeed; - - // Assert that the feed's height is correct - $this->assertTrue($feed->getGphotoHeight() instanceof Zend_Gdata_Photos_Extension_Height); - $this->verifyProperty2($feed, "gphotoHeight", "text", - "1600"); - $this->verifyProperty3($feed, "gphotoHeight", "text", - "1600"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoSize() - { - $feed = $this->photoFeed; - - // Assert that the feed's size is correct - $this->assertTrue($feed->getGphotoSize() instanceof Zend_Gdata_Photos_Extension_Size); - $this->verifyProperty2($feed, "gphotoSize", "text", - "883405"); - $this->verifyProperty3($feed, "gphotoSize", "text", - "883405"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoClient() - { - $feed = $this->photoFeed; - - // Assert that the feed's client is correct - $this->assertTrue($feed->getGphotoClient() instanceof Zend_Gdata_Photos_Extension_Client); - $this->verifyProperty2($feed, "gphotoClient", "text", - ""); - $this->verifyProperty3($feed, "gphotoClient", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoChecksum() - { - $feed = $this->photoFeed; - - // Assert that the feed's checksum is correct - $this->assertTrue($feed->getGphotoChecksum() instanceof Zend_Gdata_Photos_Extension_Checksum); - $this->verifyProperty2($feed, "gphotoChecksum", "text", - ""); - $this->verifyProperty3($feed, "gphotoChecksum", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentingEnabled() - { - $feed = $this->photoFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); - $this->verifyProperty2($feed, "gphotoCommentingEnabled", "text", - "true"); - $this->verifyProperty3($feed, "gphotoCommentingEnabled", "text", - "true"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoCommentCount() - { - $feed = $this->photoFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); - $this->verifyProperty2($feed, "gphotoCommentCount", "text", - "1"); - $this->verifyProperty3($feed, "gphotoCommentCount", "text", - "1"); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosPhotoQueryTest.php b/tests/Zend/Gdata/Photos/PhotosPhotoQueryTest.php deleted file mode 100644 index e0a7b1884..000000000 --- a/tests/Zend/Gdata/Photos/PhotosPhotoQueryTest.php +++ /dev/null @@ -1,134 +0,0 @@ -setUser("sample.user"); - $query->setAlbumId("1"); - $query->setPhotoId("1"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of a user feed request - * Projection is set to base - */ - public function testBasePhotoQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/base/user/sample.user/albumid/1/photoid/1"; - - $query = new Zend_Gdata_Photos_PhotoQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setPhotoId("1"); - $query->setProjection("base"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check for thrown exceptions upon improper photoid setting - */ - public function testPhotoQueryExceptions() - { - $query = new Zend_Gdata_Photos_PhotoQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - - try { - $generatedString = $query->getQueryUrl(); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - } - - /** - * Check the consistency of a user feed request filtered - * for a specific tag - */ - public function testTagFilterPhotoQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/1?tag=test"; - - $query = new Zend_Gdata_Photos_PhotoQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setPhotoId("1"); - $query->setTag("test"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of a user feed request for private data - */ - public function testPrivatePhotoQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/1?access=private"; - - $query = new Zend_Gdata_Photos_PhotoQuery(); - $query->setUser("sample.user"); - $query->setAlbumId("1"); - $query->setPhotoId("1"); - $query->setAccess("private"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosTagEntryTest.php b/tests/Zend/Gdata/Photos/PhotosTagEntryTest.php deleted file mode 100644 index 5e338217a..000000000 --- a/tests/Zend/Gdata/Photos/PhotosTagEntryTest.php +++ /dev/null @@ -1,131 +0,0 @@ -tagEntry = new Zend_Gdata_Photos_TagEntry($tagEntryText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $entry = $this->tagEntry; - - // Assert that the entry's ID is correct - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/tag/tag"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $entry = $this->tagEntry; - - // Assert that the entry's updated date is correct - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($entry, "updated", "text", - "1970-01-01T00:01:01.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $entry = $this->tagEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($entry, "title", "text", "tag"); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosUserEntryTest.php b/tests/Zend/Gdata/Photos/PhotosUserEntryTest.php deleted file mode 100644 index 05afd70b2..000000000 --- a/tests/Zend/Gdata/Photos/PhotosUserEntryTest.php +++ /dev/null @@ -1,229 +0,0 @@ -userEntry = new Zend_Gdata_Photos_UserEntry($userEntryText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $entry = $this->userEntry; - - // Assert that the entry's author is correct - $entryAuthor = $entry->getAuthor(); - $this->assertEquals($entryAuthor, $entry->author); - $this->assertEquals(1, count($entryAuthor)); - $this->assertTrue($entryAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); - $this->assertTrue($entryAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $entry = $this->userEntry; - - // Assert that the entry's ID is correct - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $entry = $this->userEntry; - - // Assert that the photo entry has an Atom Published object - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - $this->verifyProperty2($entry, "published", "text", "2007-09-24T23:45:49.059Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $entry = $this->userEntry; - - // Assert that the entry's updated date is correct - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($entry, "updated", "text", - "2007-09-24T23:45:49.059Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $entry = $this->userEntry; - - // Assert that the entry's title is correct - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($entry, "title", "text", "sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoUser() - { - $entry = $this->userEntry; - - // Assert that the entry's user is correct - $this->assertTrue($entry->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); - $this->verifyProperty2($entry, "gphotoUser", "text", "sample.user"); - $this->verifyProperty3($entry, "gphotoUser", "text", "sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoNickname() - { - $entry = $this->userEntry; - - // Assert that the entry's nickname is correct - $this->assertTrue($entry->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); - $this->verifyProperty2($entry, "gphotoNickname", "text", "sample"); - $this->verifyProperty3($entry, "gphotoNickname", "text", "sample"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoThumbnail() - { - $entry = $this->userEntry; - - // Assert that the entry's thumbnail is correct - $this->assertTrue($entry->getGphotoThumbnail() instanceof Zend_Gdata_Photos_Extension_Thumbnail); - $this->verifyProperty2($entry, "gphotoThumbnail", "text", - "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); - $this->verifyProperty3($entry, "gphotoThumbnail", "text", - "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosUserFeedTest.php b/tests/Zend/Gdata/Photos/PhotosUserFeedTest.php deleted file mode 100644 index 0e1b90b55..000000000 --- a/tests/Zend/Gdata/Photos/PhotosUserFeedTest.php +++ /dev/null @@ -1,361 +0,0 @@ -userFeed = new Zend_Gdata_Photos_UserFeed($userFeedText); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty2($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Verify that a given property is set to a specific value, - * that it keeps that value when set using the setter, - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty3($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $propSetter = "set" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - $secondSetter = "set" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $obj->$propSetter($obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - /** - * Convert sample feed to XML then back to objects. Ensure that - * all objects are instances of appropriate entry type and object count matches. - */ - public function testUserFeedToAndFromString() - { - $entryCount = 0; - foreach ($this->userFeed as $entry) { - $entryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Photos_AlbumEntry || - $entry instanceof Zend_Gdata_Photos_PhotoEntry || - $entry instanceof Zend_Gdata_Photos_TagEntry); - } - $this->assertTrue($entryCount > 0); - - /* Grab XML from $this->userFeed and convert back to objects */ - $newListFeed = new Zend_Gdata_Photos_UserFeed( - $this->userFeed->saveXML()); - $newEntryCount = 0; - foreach ($newListFeed as $entry) { - $newEntryCount++; - $this->assertTrue($entry instanceof Zend_Gdata_Photos_AlbumEntry || - $entry instanceof Zend_Gdata_Photos_PhotoEntry || - $entry instanceof Zend_Gdata_Photos_TagEntry); - } - $this->assertEquals($entryCount, $newEntryCount); - } - - /** - * Ensure that the number of entries equals the number - * of entries defined in the sample file. - */ - public function testEntryCount() - { - $entryCount = 0; - foreach ($this->userFeed as $entry) { - $entryCount++; - } - $this->assertEquals(3, $entryCount); - } - - /** - * Check for the existence of an and verify that they - * contain the expected values. - */ - public function testAuthor() - { - $feed = $this->userFeed; - - // Assert that the feed's author is correct - $feedAuthor = $feed->getAuthor(); - $this->assertEquals($feedAuthor, $feed->author); - $this->assertEquals(1, count($feedAuthor)); - $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); - $this->verifyProperty2($feedAuthor[0], "name", "text", "sample"); - $this->assertTrue($feedAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); - $this->verifyProperty2($feedAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - - // Assert that each entry has valid author data - foreach ($feed as $entry) { - if ($entry instanceof Zend_Gdata_Photos_AlbumEntry) { - $entryAuthor = $entry->getAuthor(); - $this->assertEquals(1, count($entryAuthor)); - $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); - $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); - } - } - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testId() - { - $feed = $this->userFeed; - - // Assert that the feed's ID is correct - $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); - $this->verifyProperty2($feed, "id", "text", - "http://picasaweb.google.com/data/feed/api/user/sample.user"); - - // Assert that all entries have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); - } - - // Assert one of the entry's IDs - $entry = $feed[0]; - $this->verifyProperty2($entry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testPublished() - { - $feed = $this->userFeed; - - // Assert that all entries have an Atom Published object - foreach ($feed as $entry) { - $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); - } - - // Assert one of the entry's Published dates - $entry = $feed[0]; - $this->verifyProperty2($entry, "published", "text", "2007-09-05T07:00:00.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testUpdated() - { - $feed = $this->userFeed; - - // Assert that the feed's updated date is correct - $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - $this->verifyProperty2($feed, "updated", "text", - "2007-09-20T21:09:39.111Z"); - - // Assert that all entries have an Atom Updated object - foreach ($feed as $entry) { - $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); - } - - // Assert one of the entry's Updated dates - $entry = $feed[0]; - $this->verifyProperty2($entry, "updated", "text", "2007-09-05T20:49:24.000Z"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testTitle() - { - $feed = $this->userFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); - $this->verifyProperty2($feed, "title", "text", - "sample.user"); - - // Assert that all entries have an Atom ID object - foreach ($feed as $entry) { - $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); - } - - // Assert one of the entry's Titles - $entry = $feed[0]; - $this->verifyProperty2($entry, "title", "text", "Test"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testSubtitle() - { - $feed = $this->userFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); - $this->verifyProperty2($feed, "subtitle", "text", - ""); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGenerator() - { - $feed = $this->userFeed; - - // Assert that the feed's generator is correct - $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); - $this->verifyProperty2($feed, "generator", "version", "1.00"); - $this->verifyProperty2($feed, "generator", "uri", "http://picasaweb.google.com/"); - $this->verifyProperty2($feed, "generator", "text", "Picasaweb"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testIcon() - { - $feed = $this->userFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getIcon() instanceof Zend_Gdata_App_Extension_Icon); - $this->verifyProperty2($feed, "icon", "text", - "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoUser() - { - $feed = $this->userFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); - $this->verifyProperty2($feed, "gphotoUser", "text", - "sample.user"); - $this->verifyProperty3($feed, "gphotoUser", "text", - "sample.user"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoNickname() - { - $feed = $this->userFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); - $this->verifyProperty2($feed, "gphotoNickname", "text", - "sample"); - $this->verifyProperty3($feed, "gphotoNickname", "text", - "sample"); - } - - /** - * Check for the existence of an and verify that it contains - * the expected value. - */ - public function testGphotoThumbnail() - { - $feed = $this->userFeed; - - // Assert that the feed's title is correct - $this->assertTrue($feed->getGphotoThumbnail() instanceof Zend_Gdata_Photos_Extension_Thumbnail); - $this->verifyProperty2($feed, "gphotoThumbnail", "text", - "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); - $this->verifyProperty3($feed, "gphotoThumbnail", "text", - "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); - } - -} diff --git a/tests/Zend/Gdata/Photos/PhotosUserQueryTest.php b/tests/Zend/Gdata/Photos/PhotosUserQueryTest.php deleted file mode 100644 index 02428abac..000000000 --- a/tests/Zend/Gdata/Photos/PhotosUserQueryTest.php +++ /dev/null @@ -1,135 +0,0 @@ -setUser("sample.user"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of a user feed request - * Projection is set to base - */ - public function testBaseUserQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/base/user/sample.user"; - - $query = new Zend_Gdata_Photos_UserQuery(); - $query->setUser("sample.user"); - $query->setProjection("base"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check for thrown exceptions upon improper albumname/id setting - */ - public function testUserQueryExceptions() - { - $query = new Zend_Gdata_Photos_UserQuery(); - $query->setUser("sample.user"); - $query->setProjection(null); - - try { - $generatedString = $query->getQueryUrl(); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - - $query->setProjection("api"); - $query->setUser(null); - - try { - $generatedString = $query->getQueryUrl(); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - } - - /** - * Check the consistency of a user feed request filtered - * for a specific tag - */ - public function testTagFilterUserQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user?tag=test"; - - $query = new Zend_Gdata_Photos_UserQuery(); - $query->setUser("sample.user"); - $query->setTag("test"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - - /** - * Check the consistency of a user feed request for private data - */ - public function testPrivateUserQuery() - { - $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user?access=private"; - - $query = new Zend_Gdata_Photos_UserQuery(); - $query->setUser("sample.user"); - $query->setAccess("private"); - - $generatedString = $query->getQueryUrl(); - - // Assert that the generated query matches the correct one - $this->assertEquals($queryString, $generatedString); - } - -} diff --git a/tests/Zend/Gdata/Photos/_files/TestAlbumEntry.xml b/tests/Zend/Gdata/Photos/_files/TestAlbumEntry.xml deleted file mode 100644 index 70bef7ad7..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestAlbumEntry.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1 - 2007-09-05T07:00:00.000Z - 2007-09-05T20:49:24.000Z - - Test - - public - - - - - sample - http://picasaweb.google.com/sample.user - - 1 - Test - - public - 1188975600000 - 2 - sample.user - sample - true - 0 - - Test - - - - - sample - - - - 42.87194 13.56738 - - - diff --git a/tests/Zend/Gdata/Photos/_files/TestAlbumFeed.xml b/tests/Zend/Gdata/Photos/_files/TestAlbumFeed.xml deleted file mode 100644 index b8758a33e..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestAlbumFeed.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1 - 2007-09-21T18:23:05.000Z - - Test - - public - http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/s160-c/Test.jpg - - - - - - sample - http://picasaweb.google.com/sample.user - - Picasaweb - 4 - 1 - 500 - 1 - Test - - public - 1188975600000 - 2 - sample.user - sample - true - 0 - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2 - 2007-09-05T20:49:23.000Z - 2007-09-21T18:23:05.000Z - - Aqua Blue.jpg - Blue - - - - - 2 - 1190398985145172 - 0.0 - 1 - 2560 - 1600 - 883405 - - - 1189025362000 - - true - c041ce17aaa637eb656c81d9cf526c24 - - true - 1 - - Aqua Blue.jpg - Blue - tag, test - - - - - sample - - - - 41.87194 12.56738 - - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/3 - 2007-09-05T20:49:24.000Z - 2007-09-21T18:19:38.000Z - - Aqua Graphite.jpg - Gray - - - - - 3 - 1190398778006402 - 1.0 - 1 - 2560 - 1600 - 798334 - - - 1189025363000 - - true - a5ce2e36b9df7d3cb081511c72e73926 - - true - 0 - - Aqua Graphite.jpg - Gray - - - - - - sample - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/tag/tag - 2007-09-05T20:49:24.000Z - - tag - tag - - - - sample - http://picasaweb.google.com/sample.user - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/tag/test - 2007-09-05T20:49:24.000Z - - test - test - - - - sample - http://picasaweb.google.com/sample.user - - - diff --git a/tests/Zend/Gdata/Photos/_files/TestCommentEntry.xml b/tests/Zend/Gdata/Photos/_files/TestCommentEntry.xml deleted file mode 100644 index 5b3d4238f..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestCommentEntry.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5 - 2007-09-21T18:22:53.000Z - 2007-09-21T18:22:53.000Z - - sample - test comment - test comment - - - - sample - http://picasaweb.google.com/sample.user - sample.user - sample - http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s48-c/sample.user - - 5 - 100 - diff --git a/tests/Zend/Gdata/Photos/_files/TestPhotoEntry.xml b/tests/Zend/Gdata/Photos/_files/TestPhotoEntry.xml deleted file mode 100644 index 2f6e4b5d0..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestPhotoEntry.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100 - 2007-09-05T20:49:24.000Z - 2007-09-21T18:19:38.000Z - - Aqua Graphite.jpg - Gray - - - - - 100 - 1190398778006402 - 1 - 2560 - 1600 - 798334 - - - 1189025363000 - - 11.0 - 0.0040 - true - 22.0 - 200 - 1180950900000 - a5ce2e36b9df7d3cb081511c72e73926 - 0.0 - Fictitious Camera Company - AMAZING-100D - - true - 0 - - Aqua Graphite.jpg - Gray - - - - - - sample - - - - 41.87194 12.56738 - - - diff --git a/tests/Zend/Gdata/Photos/_files/TestPhotoFeed.xml b/tests/Zend/Gdata/Photos/_files/TestPhotoFeed.xml deleted file mode 100644 index ea3fb8fbf..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestPhotoFeed.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100 - 2007-09-21T18:23:05.000Z - - Aqua Blue.jpg - Blue - http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg - - - - Picasaweb - 3 - 1 - 500 - 100 - 1190398985145172 - 1 - 2560 - 1600 - 883405 - - - 1189025362000 - - true - c041ce17aaa637eb656c81d9cf526c24 - - true - 1 - - Aqua Blue.jpg - Blue - tag, test - - - - - sample - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/tag - 2007-09-21T18:23:05.000Z - - tag - tag - - - - sample - http://picasaweb.google.com/sample.user - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/test - 2007-09-21T18:23:05.000Z - - test - test - - - - sample - http://picasaweb.google.com/sample.user - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5 - 2007-09-21T18:22:53.000Z - 2007-09-21T18:22:53.000Z - - sample - test comment - test comment - - - - sample - http://picasaweb.google.com/sample.user - sample.user - sample - http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s48-c/sample.user - - 5 - 100 - - diff --git a/tests/Zend/Gdata/Photos/_files/TestTagEntry.xml b/tests/Zend/Gdata/Photos/_files/TestTagEntry.xml deleted file mode 100644 index 6e00dd586..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestTagEntry.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - http://picasaweb.google.com/data/entry/api/user/sample.user/tag/tag - 1970-01-01T00:01:01.000Z - - tag - tag - - - - sample - http://picasaweb.google.com/sample.user - - diff --git a/tests/Zend/Gdata/Photos/_files/TestUserEntry.xml b/tests/Zend/Gdata/Photos/_files/TestUserEntry.xml deleted file mode 100644 index 759818c47..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestUserEntry.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - http://picasaweb.google.com/data/entry/api/user/sample.user - 2007-09-24T23:45:49.059Z - 2007-09-24T23:45:49.059Z - - sample.user - - - - - - sample - http://picasaweb.google.com/sample.user - - sample.user - sample - http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user - diff --git a/tests/Zend/Gdata/Photos/_files/TestUserFeed.xml b/tests/Zend/Gdata/Photos/_files/TestUserFeed.xml deleted file mode 100644 index 58dd6b407..000000000 --- a/tests/Zend/Gdata/Photos/_files/TestUserFeed.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - http://picasaweb.google.com/data/feed/api/user/sample.user - 2007-09-20T21:09:39.111Z - - sample.user - - http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user - - - - - - sample - http://picasaweb.google.com/sample.user - - Picasaweb - 4 - 1 - 100 - sample.user - sample - http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100 - 2007-09-05T07:00:00.000Z - 2007-09-05T20:49:24.000Z - - Test - - public - - - - - sample - http://picasaweb.google.com/sample.user - - 100 - Test - - public - 1188975600000 - 2 - sample.user - sample - true - 0 - - Test - - - - - sample - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100/photoid/2 - 2007-09-05T20:49:24.000Z - 2007-09-05T20:49:23.000Z - - Second.jpg - - - - - - 2 - 1189025363424891 - 100 - 2560 - 1600 - 798334 - - - 1189025363000 - - true - a5ce2e36b9df7d3cb081511c72e73926 - - true - 0 - - Second.jpg - - - - - - - sample - - - - http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100/photoid/1 - 2007-09-05T20:49:23.000Z - 2007-09-05T20:49:22.000Z - - First.jpg - - - - - - 1 - 1189025362423722 - 100 - 2560 - 1600 - 883405 - - - 1189025362000 - - true - c041ce17aaa637eb656c81d9cf526c24 - - true - 0 - - First.jpg - - - - - - - sample - - - diff --git a/tests/Zend/Gdata/Photos/_files/test.jpg b/tests/Zend/Gdata/Photos/_files/test.jpg deleted file mode 100644 index d4a5a1098..000000000 Binary files a/tests/Zend/Gdata/Photos/_files/test.jpg and /dev/null differ diff --git a/tests/Zend/Gdata/PhotosOnlineTest.php b/tests/Zend/Gdata/PhotosOnlineTest.php deleted file mode 100644 index fcfa23ffb..000000000 --- a/tests/Zend/Gdata/PhotosOnlineTest.php +++ /dev/null @@ -1,289 +0,0 @@ -photos = new Zend_Gdata_Photos($client); - } - - /** - * Verify that a given property is set to a specific value - * and that the getter and magic variable return the same value. - * - * @param object $obj The object to be interrogated. - * @param string $name The name of the property to be verified. - * @param string $secondName 2nd level accessor function name - * @param object $value The expected value of the property. - */ - protected function verifyProperty($obj, $name, $secondName, $value) - { - $propName = $name; - $propGetter = "get" . ucfirst($name); - $secondGetter = "get" . ucfirst($secondName); - - $this->assertEquals($obj->$propGetter(), $obj->$propName); - $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); - } - - public function createAlbum() - { - $client = $this->photos; - - $album = new Zend_Gdata_Photos_AlbumEntry(); - $album->setTitle($client->newTitle("testAlbum")); - $album->setCategory(array($client->newCategory( - 'http://schemas.google.com/photos/2007#album', - 'http://schemas.google.com/g/2005#kind'))); - - $newAlbum = $client->insertAlbumEntry($album); - $this->assertEquals($album->getTitle(), $newAlbum->getTitle()); - $this->assertEquals($newAlbum->getTitle(), $client->getAlbumEntry($newAlbum->getLink('self')->href)->getTitle()); - - $albumFeedUri = $newAlbum->getLink('http://schemas.google.com/g/2005#feed')->href; - $albumFeed = $client->getAlbumFeed($albumFeedUri); - $this->verifyProperty($albumFeed, "title", "text", "testAlbum"); - - return $newAlbum; - } - - public function createPhoto($album) - { - $client = $this->photos; - - $fd = $client->newMediaFileSource('Zend/Gdata/_files/testImage.jpg'); - $fd->setContentType('image/jpeg'); - - $photo = new Zend_Gdata_Photos_PhotoEntry(); - $photo->setMediaSource($fd); - $photo->setTitle($client->newTitle("test photo")); - $photo->setCategory(array($client->newCategory( - 'http://schemas.google.com/photos/2007#photo', - 'http://schemas.google.com/g/2005#kind'))); - - $newPhoto = $client->insertPhotoEntry($photo, $album); - $this->assertEquals($photo->getTitle(), $newPhoto->getTitle()); - $this->assertEquals($newPhoto->getTitle(), $client->getPhotoEntry($newPhoto->getLink('self')->href)->getTitle()); - - $photoFeedUri = $newPhoto->getLink('http://schemas.google.com/g/2005#feed')->href; - $photoFeed = $client->getPhotoFeed($photoFeedUri); - $this->verifyProperty($photoFeed, "title", "text", "test photo"); - - return $newPhoto; - } - - public function updatePhotoMetaData() - { - $client = $this->photos; - $album = $this->createAlbum(); - $insertedEntry = $this->createPhoto($album); - - $insertedEntry->title->text = "New Photo"; - $insertedEntry->summary->text = "Photo caption"; - $keywords = new Zend_Gdata_Media_Extension_MediaKeywords(); - $keywords->setText("foo, bar, baz"); - $insertedEntry->mediaGroup->keywords = $keywords; - - $updatedEntry = $insertedEntry->save(); - return array($updatedEntry, $album); - } - - public function createComment($photo) - { - $client = $this->photos; - - $comment = new Zend_Gdata_Photos_CommentEntry(); - $comment->setTitle($client->newTitle("test comment")); - $comment->setContent($client->newContent("test comment")); - $comment->setCategory(array($client->newCategory( - 'http://schemas.google.com/photos/2007#comment', - 'http://schemas.google.com/g/2005#kind'))); - - $newComment = $client->insertCommentEntry($comment, $photo); - $this->assertEquals($comment->getContent(), $newComment->getContent()); - $this->assertEquals($newComment->getContent(), $client->getCommentEntry($newComment->getLink('self')->href)->getContent()); - - return $newComment; - } - - public function createTag($photo) - { - $client = $this->photos; - - $tag = new Zend_Gdata_Photos_TagEntry(); - $tag->setTitle($client->newTitle("test tag")); - $tag->setContent($client->newContent("test tag")); - $tag->setCategory(array($client->newCategory( - 'http://schemas.google.com/photos/2007#tag', - 'http://schemas.google.com/g/2005#kind'))); - - $newTag = $client->insertTagEntry($tag, $photo); - $this->assertEquals($tag->getTitle(), $newTag->getTitle()); - $this->assertEquals($newTag->getTitle(), $client->getTagEntry($newTag->getLink('self')->href)->getTitle()); - - return $newTag; - } - - public function testCreateAlbumAndUploadPhoto() - { - $client = $this->photos; - $album = $this->createAlbum(); - $photo = $this->createPhoto($album); - - // Clean up the mess - $client->deletePhotoEntry($photo, true); - $client->deleteAlbumEntry($album, true); - } - - public function testUpdatePhotoMetadata() - { - $client = $this->photos; - $dataArray = $this->updatePhotoMetaData(); - $updatedPhoto = $dataArray[0]; - $album = $dataArray[1]; - - $this->assertTrue($updatedPhoto instanceof Zend_Gdata_Photos_PhotoEntry); - - // Clean up the mess - $client->deletePhotoEntry($updatedPhoto, true); - $client->deleteAlbumEntry($album, true); - } - - public function testUserFeedAndEntry() - { - $client = $this->photos; - - $userEntryUri = "http://picasaweb.google.com/data/entry/api/user/" . - constant('TESTS_ZEND_GDATA_PHOTOS_USERNAME'); - - $userEntry = $client->getUserEntry($userEntryUri); - $this->verifyProperty($userEntry, "id", "text", - "http://picasaweb.google.com/data/entry/api/user/" . - constant('TESTS_ZEND_GDATA_PHOTOS_USERNAME')); - - - $userFeed = $client->getUserFeed(constant('TESTS_ZEND_GDATA_PHOTOS_USERNAME')); - $this->verifyProperty($userFeed, "id", "text", - "http://picasaweb.google.com/data/feed/api/user/" . - constant('TESTS_ZEND_GDATA_PHOTOS_USERNAME')); - } - - public function testCreatePhotoCommentAndTag() - { - $client = $this->photos; - $album = $this->createAlbum(); - $photo = $this->createPhoto($album); - $comment = $this->createComment($photo); - $tag = $this->createTag($photo); - - // Clean up the mess - $client->deleteTagEntry($tag, true); - $client->deleteCommentEntry($comment, true); - $client->deletePhotoEntry($photo, true); - $client->deleteAlbumEntry($album, true); - } - - public function testInvalidEntryFetchingAndInserting() - { - $client = $this->photos; - - try { - $userEntry = $client->getUserEntry(null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $userEntry = $client->getAlbumEntry(null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $photoEntry = $client->getPhotoEntry(null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $tagEntry = $client->getTagEntry(null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $commentEntry = $client->getCommentEntry(null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $photo = new Zend_Gdata_Photos_PhotoEntry(); - $result = $client->insertPhotoEntry($photo, null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $comment = new Zend_Gdata_Photos_CommentEntry(); - $result = $client->insertCommentEntry($comment, null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - try { - $tag = new Zend_Gdata_Photos_TagEntry(); - $result = $client->insertTagEntry($tag, null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - } - - public function testInvalidFeedFetching() - { - $client = $this->photos; - - try { - $albumFeed = $client->getAlbumFeed(null); - } catch (\Throwable $e) { - $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); - } - } - -} diff --git a/tests/Zend/Gdata/QueryTest.php b/tests/Zend/Gdata/QueryTest.php deleted file mode 100644 index 83646cf35..000000000 --- a/tests/Zend/Gdata/QueryTest.php +++ /dev/null @@ -1,123 +0,0 @@ -setAlt('rss'); - $this->assertEquals('rss', $query->alt); - $this->assertContains('alt=rss', $query->getQueryUrl()); - } - - public function testSetAndGetUpdatedMax() - { - $query = new Zend_Gdata_Query(); - $query->setUpdatedMax('2007-01-01'); - $this->assertEquals('2007-01-01', $query->getUpdatedMax()); - $this->assertContains('updated-max=2007-01-01', $query->getQueryUrl()); - } - - public function testSetAndGetUpdatedMin() - { - $query = new Zend_Gdata_Query(); - $query->setUpdatedMin('2007-01-01'); - $this->assertEquals('2007-01-01', $query->getUpdatedMin()); - $this->assertContains('updated-min=2007-01-01', $query->getQueryUrl()); - } - - public function testSetAndGetPublishedMax() - { - $query = new Zend_Gdata_Query(); - $query->setPublishedMax('2007-01-01'); - $this->assertEquals('2007-01-01', $query->getPublishedMax()); - $this->assertContains('published-max=2007-01-01', - $query->getQueryUrl()); - } - - public function testSetAndGetPublishedMin() - { - $query = new Zend_Gdata_Query(); - $query->setPublishedMin('2007-01-01'); - $this->assertEquals('2007-01-01', $query->getPublishedMin()); - $this->assertContains('published-min=2007-01-01', - $query->getQueryUrl()); - } - - public function testSetAndGetAuthor() - { - $query = new Zend_Gdata_Query(); - $query->setAuthor('My Name'); - $this->assertEquals('My Name', $query->getAuthor()); - $this->assertContains('author=My+Name', $query->getQueryUrl()); - } - - public function testSetAndGetMaxResults() - { - $query = new Zend_Gdata_Query(); - $query->setMaxResults('300'); - $this->assertEquals('300', $query->getMaxResults()); - $this->assertContains('max-results=300', $query->getQueryUrl()); - } - - public function testSetAndGetGenericParam() - { - $query = new Zend_Gdata_Query(); - $query->setParam('fw', 'zend'); - $this->assertEquals('zend', $query->getParam('fw')); - $this->assertContains('fw=zend', $query->getQueryUrl()); - } - - public function testSetAndGetFullTextQuery() - { - $query = new Zend_Gdata_Query(); - $query->setQuery('geek events'); - $this->assertEquals('geek events', $query->getQuery()); - $this->assertContains('q=geek+events', $query->getQueryUrl()); - } - - public function testSetAndGetStartIndex() - { - $query = new Zend_Gdata_Query(); - $query->setStartIndex(12); - $this->assertEquals(12, $query->getStartIndex()); - $this->assertContains('start-index=12', $query->getQueryUrl()); - } - -} diff --git a/tests/Zend/Gdata/RecurrenceExceptionTest.php b/tests/Zend/Gdata/RecurrenceExceptionTest.php deleted file mode 100644 index 926a0fba1..000000000 --- a/tests/Zend/Gdata/RecurrenceExceptionTest.php +++ /dev/null @@ -1,130 +0,0 @@ -recurrenceExceptionText = file_get_contents( - 'Zend/Gdata/_files/RecurrenceExceptionElementSample1.xml', - true); - $this->recurrenceException = new Zend_Gdata_Extension_RecurrenceException(); - } - - public function testEmptyRecurrenceExceptionShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->recurrenceException->extensionElements)); - $this->assertTrue(count($this->recurrenceException->extensionElements) == 0); - } - - public function testEmptyRecurrenceExceptionShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->recurrenceException->extensionAttributes)); - $this->assertTrue(count($this->recurrenceException->extensionAttributes) == 0); - } - - public function testSampleRecurrenceExceptionShouldHaveNoExtensionElements() { - $this->recurrenceException->transferFromXML($this->recurrenceExceptionText); - $this->assertTrue(is_array($this->recurrenceException->extensionElements)); - $this->assertTrue(count($this->recurrenceException->extensionElements) == 0); - } - - public function testSampleRecurrenceExceptionShouldHaveNoExtensionAttributes() { - $this->recurrenceException->transferFromXML($this->recurrenceExceptionText); - $this->assertTrue(is_array($this->recurrenceException->extensionAttributes)); - $this->assertTrue(count($this->recurrenceException->extensionAttributes) == 0); - } - - public function testNormalRecurrenceExceptionShouldHaveNoExtensionElements() { - $this->recurrenceException->specialized = false; - - $this->assertEquals(false, $this->recurrenceException->specialized); - - $this->assertEquals(0, count($this->recurrenceException->extensionElements)); - $newRecurrenceException = new Zend_Gdata_Extension_RecurrenceException(); - $newRecurrenceException->transferFromXML($this->recurrenceException->saveXML()); - $this->assertEquals(0, count($newRecurrenceException->extensionElements)); - $newRecurrenceException->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newRecurrenceException->extensionElements)); - $this->assertEquals(false, $newRecurrenceException->specialized); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newRecurrenceException2 = $gdata->newRecurrenceException(); - $newRecurrenceException2->transferFromXML($newRecurrenceException->saveXML()); - $this->assertEquals(1, count($newRecurrenceException2->extensionElements)); - $this->assertEquals(false, $newRecurrenceException2->specialized); - } - - public function testEmptyRecurrenceExceptionToAndFromStringShouldMatch() { - $recurrenceExceptionXml = $this->recurrenceException->saveXML(); - $newRecurrenceException = new Zend_Gdata_Extension_RecurrenceException(); - $newRecurrenceException->transferFromXML($recurrenceExceptionXml); - $newRecurrenceExceptionXml = $newRecurrenceException->saveXML(); - $this->assertTrue($recurrenceExceptionXml == $newRecurrenceExceptionXml); - } - - public function testRecurrenceExceptionWithValueToAndFromStringShouldMatch() { - $this->recurrenceException->specialized = false; - $recurrenceExceptionXml = $this->recurrenceException->saveXML(); - $newRecurrenceException = new Zend_Gdata_Extension_RecurrenceException(); - $newRecurrenceException->transferFromXML($recurrenceExceptionXml); - $newRecurrenceExceptionXml = $newRecurrenceException->saveXML(); - $this->assertTrue($recurrenceExceptionXml == $newRecurrenceExceptionXml); - $this->assertEquals(false, $this->recurrenceException->specialized); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->recurrenceException->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->recurrenceException->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->recurrenceException->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->recurrenceException->extensionAttributes['foo2']['value']); - $recurrenceExceptionXml = $this->recurrenceException->saveXML(); - $newRecurrenceException = new Zend_Gdata_Extension_RecurrenceException(); - $newRecurrenceException->transferFromXML($recurrenceExceptionXml); - $this->assertEquals('bar', $newRecurrenceException->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newRecurrenceException->extensionAttributes['foo2']['value']); - } - - public function testConvertFullRecurrenceExceptionToAndFromString() { - $this->recurrenceException->transferFromXML($this->recurrenceExceptionText); - $this->assertEquals(true, $this->recurrenceException->specialized); - $this->assertTrue($this->recurrenceException->entryLink instanceof Zend_Gdata_Extension_EntryLink); - $this->assertEquals("http://www.google.com/calendar/feeds/default/private/full/hj4geu9lpkh3ebk6rvm4k8mhik", $this->recurrenceException->entryLink->href); - $this->assertTrue($this->recurrenceException->originalEvent instanceof Zend_Gdata_Extension_OriginalEvent); - $this->assertEquals("hj4geu9lpkh3ebk6rvm4k8mhik", $this->recurrenceException->originalEvent->id); - } - -} diff --git a/tests/Zend/Gdata/RecurrenceTest.php b/tests/Zend/Gdata/RecurrenceTest.php deleted file mode 100644 index 31b1b05f0..000000000 --- a/tests/Zend/Gdata/RecurrenceTest.php +++ /dev/null @@ -1,126 +0,0 @@ -recurrenceText = file_get_contents( - 'Zend/Gdata/_files/RecurrenceElementSample1.xml', - true); - $this->recurrence = new Zend_Gdata_Extension_Recurrence(); - } - - public function testEmptyRecurrenceShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->recurrence->extensionElements)); - $this->assertTrue(count($this->recurrence->extensionElements) == 0); - } - - public function testEmptyRecurrenceShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->recurrence->extensionAttributes)); - $this->assertTrue(count($this->recurrence->extensionAttributes) == 0); - } - - public function testSampleRecurrenceShouldHaveNoExtensionElements() { - $this->recurrence->transferFromXML($this->recurrenceText); - $this->assertTrue(is_array($this->recurrence->extensionElements)); - $this->assertTrue(count($this->recurrence->extensionElements) == 0); - } - - public function testSampleRecurrenceShouldHaveNoExtensionAttributes() { - $this->recurrence->transferFromXML($this->recurrenceText); - $this->assertTrue(is_array($this->recurrence->extensionAttributes)); - $this->assertTrue(count($this->recurrence->extensionAttributes) == 0); - } - - public function testNormalRecurrenceShouldHaveNoExtensionElements() { - $this->recurrence->text = "Foo"; - - $this->assertEquals("Foo", $this->recurrence->text); - - $this->assertEquals(0, count($this->recurrence->extensionElements)); - $newRecurrence = new Zend_Gdata_Extension_Recurrence(); - $newRecurrence->transferFromXML($this->recurrence->saveXML()); - $this->assertEquals(0, count($newRecurrence->extensionElements)); - $newRecurrence->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newRecurrence->extensionElements)); - $this->assertEquals("Foo", $newRecurrence->text); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newRecurrence2 = $gdata->newRecurrence(); - $newRecurrence2->transferFromXML($newRecurrence->saveXML()); - $this->assertEquals(1, count($newRecurrence2->extensionElements)); - $this->assertEquals("Foo", $newRecurrence2->text); - } - - public function testEmptyRecurrenceToAndFromStringShouldMatch() { - $recurrenceXml = $this->recurrence->saveXML(); - $newRecurrence = new Zend_Gdata_Extension_Recurrence(); - $newRecurrence->transferFromXML($recurrenceXml); - $newRecurrenceXml = $newRecurrence->saveXML(); - $this->assertTrue($recurrenceXml == $newRecurrenceXml); - } - - public function testRecurrenceWithValueToAndFromStringShouldMatch() { - $this->recurrence->text = "Foo"; - $recurrenceXml = $this->recurrence->saveXML(); - $newRecurrence = new Zend_Gdata_Extension_Recurrence(); - $newRecurrence->transferFromXML($recurrenceXml); - $newRecurrenceXml = $newRecurrence->saveXML(); - $this->assertTrue($recurrenceXml == $newRecurrenceXml); - $this->assertEquals("Foo", $this->recurrence->text); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->recurrence->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->recurrence->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->recurrence->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->recurrence->extensionAttributes['foo2']['value']); - $recurrenceXml = $this->recurrence->saveXML(); - $newRecurrence = new Zend_Gdata_Extension_Recurrence(); - $newRecurrence->transferFromXML($recurrenceXml); - $this->assertEquals('bar', $newRecurrence->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newRecurrence->extensionAttributes['foo2']['value']); - } - - public function testConvertFullRecurrenceToAndFromString() { - $this->recurrence->transferFromXML($this->recurrenceText); - $this->assertEquals("DTSTART;VALUE=DATE:20070501\nDTEND;VALUE=DATE:20070502\nRRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904", $this->recurrence->text); - } - -} diff --git a/tests/Zend/Gdata/ReminderTest.php b/tests/Zend/Gdata/ReminderTest.php deleted file mode 100644 index a9523c126..000000000 --- a/tests/Zend/Gdata/ReminderTest.php +++ /dev/null @@ -1,154 +0,0 @@ -reminderText = file_get_contents( - 'Zend/Gdata/_files/ReminderElementSample1.xml', - true); - $this->reminder = new Zend_Gdata_Extension_Reminder(); - } - - public function testEmptyReminderShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->reminder->extensionElements)); - $this->assertTrue(count($this->reminder->extensionElements) == 0); - } - - public function testEmptyReminderShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->reminder->extensionAttributes)); - $this->assertTrue(count($this->reminder->extensionAttributes) == 0); - } - - public function testSampleReminderShouldHaveNoExtensionElements() { - $this->reminder->transferFromXML($this->reminderText); - $this->assertTrue(is_array($this->reminder->extensionElements)); - $this->assertTrue(count($this->reminder->extensionElements) == 0); - } - - public function testSampleReminderShouldHaveNoExtensionAttributes() { - $this->reminder->transferFromXML($this->reminderText); - $this->assertTrue(is_array($this->reminder->extensionAttributes)); - $this->assertTrue(count($this->reminder->extensionAttributes) == 0); - } - - public function testNormalReminderShouldHaveNoExtensionElements() { - $this->reminder->days = "12"; - $this->reminder->minutes = "64"; - $this->reminder->absoluteTime = "2007-06-19T12:42:19-06:00"; - $this->reminder->method = "email"; - $this->reminder->hours = "80"; - - $this->assertEquals("12", $this->reminder->days); - $this->assertEquals("64", $this->reminder->minutes); - $this->assertEquals("2007-06-19T12:42:19-06:00", $this->reminder->absoluteTime); - $this->assertEquals("email", $this->reminder->method); - $this->assertEquals("80", $this->reminder->hours); - - $this->assertEquals(0, count($this->reminder->extensionElements)); - $newReminder = new Zend_Gdata_Extension_Reminder(); - $newReminder->transferFromXML($this->reminder->saveXML()); - $this->assertEquals(0, count($newReminder->extensionElements)); - $newReminder->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newReminder->extensionElements)); - $this->assertEquals("12", $newReminder->days); - $this->assertEquals("64", $newReminder->minutes); - $this->assertEquals("2007-06-19T12:42:19-06:00", $newReminder->absoluteTime); - $this->assertEquals("email", $newReminder->method); - $this->assertEquals("80", $newReminder->hours); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newReminder2 = $gdata->newReminder(); - $newReminder2->transferFromXML($newReminder->saveXML()); - $this->assertEquals(1, count($newReminder2->extensionElements)); - $this->assertEquals("12", $newReminder2->days); - $this->assertEquals("64", $newReminder2->minutes); - $this->assertEquals("2007-06-19T12:42:19-06:00", $newReminder2->absoluteTime); - $this->assertEquals("email", $newReminder2->method); - $this->assertEquals("80", $newReminder2->hours); - } - - public function testEmptyReminderToAndFromStringShouldMatch() { - $reminderXml = $this->reminder->saveXML(); - $newReminder = new Zend_Gdata_Extension_Reminder(); - $newReminder->transferFromXML($reminderXml); - $newReminderXml = $newReminder->saveXML(); - $this->assertTrue($reminderXml == $newReminderXml); - } - - public function testReminderWithValueToAndFromStringShouldMatch() { - $this->reminder->days = "12"; - $this->reminder->minutes = "64"; - $this->reminder->absoluteTime = "2007-06-19T12:42:19-06:00"; - $this->reminder->method = "email"; - $this->reminder->hours = "80"; - $reminderXml = $this->reminder->saveXML(); - $newReminder = new Zend_Gdata_Extension_Reminder(); - $newReminder->transferFromXML($reminderXml); - $newReminderXml = $newReminder->saveXML(); - $this->assertTrue($reminderXml == $newReminderXml); - $this->assertEquals("12", $this->reminder->days); - $this->assertEquals("64", $this->reminder->minutes); - $this->assertEquals("2007-06-19T12:42:19-06:00", $this->reminder->absoluteTime); - $this->assertEquals("email", $this->reminder->method); - $this->assertEquals("80", $this->reminder->hours); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->reminder->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->reminder->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->reminder->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->reminder->extensionAttributes['foo2']['value']); - $reminderXml = $this->reminder->saveXML(); - $newReminder = new Zend_Gdata_Extension_Reminder(); - $newReminder->transferFromXML($reminderXml); - $this->assertEquals('bar', $newReminder->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newReminder->extensionAttributes['foo2']['value']); - } - - public function testConvertFullReminderToAndFromString() { - $this->reminder->transferFromXML($this->reminderText); - $this->assertEquals("42", $this->reminder->days); - $this->assertEquals("50", $this->reminder->minutes); - $this->assertEquals("2005-06-06T16:55:00-08:00", $this->reminder->absoluteTime); - $this->assertEquals("sms", $this->reminder->method); - $this->assertEquals("20", $this->reminder->hours); - } - -} diff --git a/tests/Zend/Gdata/SkipTests.php b/tests/Zend/Gdata/SkipTests.php deleted file mode 100644 index 2aea35289..000000000 --- a/tests/Zend/Gdata/SkipTests.php +++ /dev/null @@ -1,57 +0,0 @@ -markTestSkipped("Zend_Gdata online tests are not enabled in TestConfiguration.php"); - } - - public function testOnline() - { - // this is here only so we have at least one test - } -} - -#[AllowDynamicProperties] -class Zend_Gdata_SkipClientLoginTest extends PHPUnit_Framework_TestCase -{ - public function setUp() - { - $this->markTestSkipped("Zend_Gdata authenticated tests are not enabled in TestConfiguration.php"); - } - - public function testClientLogin() - { - // this is here only so we have at least one test - } -} diff --git a/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php b/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php deleted file mode 100644 index 3f6d65235..000000000 --- a/tests/Zend/Gdata/Spreadsheets/CellEntryTest.php +++ /dev/null @@ -1,65 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php b/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php deleted file mode 100644 index 8c29afadd..000000000 --- a/tests/Zend/Gdata/Spreadsheets/CellFeedTest.php +++ /dev/null @@ -1,92 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php b/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php deleted file mode 100644 index ebb6d6d21..000000000 --- a/tests/Zend/Gdata/Spreadsheets/CellQueryTest.php +++ /dev/null @@ -1,139 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/CellTest.php b/tests/Zend/Gdata/Spreadsheets/CellTest.php deleted file mode 100644 index 2be6d9f27..000000000 --- a/tests/Zend/Gdata/Spreadsheets/CellTest.php +++ /dev/null @@ -1,68 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/ColCountTest.php b/tests/Zend/Gdata/Spreadsheets/ColCountTest.php deleted file mode 100644 index bcf8c4f5e..000000000 --- a/tests/Zend/Gdata/Spreadsheets/ColCountTest.php +++ /dev/null @@ -1,55 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/CustomTest.php b/tests/Zend/Gdata/Spreadsheets/CustomTest.php deleted file mode 100644 index 1a3f33fa9..000000000 --- a/tests/Zend/Gdata/Spreadsheets/CustomTest.php +++ /dev/null @@ -1,58 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php b/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php deleted file mode 100644 index 27c5e0284..000000000 --- a/tests/Zend/Gdata/Spreadsheets/DocumentQueryTest.php +++ /dev/null @@ -1,92 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php b/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php deleted file mode 100644 index 0e9de9422..000000000 --- a/tests/Zend/Gdata/Spreadsheets/ListEntryTest.php +++ /dev/null @@ -1,226 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php b/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php deleted file mode 100644 index d06f1e553..000000000 --- a/tests/Zend/Gdata/Spreadsheets/ListFeedTest.php +++ /dev/null @@ -1,69 +0,0 @@ -listFeed = new Zend_Gdata_Spreadsheets_ListFeed( - file_get_contents(__DIR__ . '/_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/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php b/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php deleted file mode 100644 index 04b265313..000000000 --- a/tests/Zend/Gdata/Spreadsheets/ListQueryTest.php +++ /dev/null @@ -1,110 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/RowCountTest.php b/tests/Zend/Gdata/Spreadsheets/RowCountTest.php deleted file mode 100644 index 9c63fd758..000000000 --- a/tests/Zend/Gdata/Spreadsheets/RowCountTest.php +++ /dev/null @@ -1,55 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php b/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php deleted file mode 100644 index ebd5979f6..000000000 --- a/tests/Zend/Gdata/Spreadsheets/SpreadsheetFeedTest.php +++ /dev/null @@ -1,66 +0,0 @@ -sprFeed = new Zend_Gdata_Spreadsheets_SpreadsheetFeed( - file_get_contents(__DIR__ . '/_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/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php b/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php deleted file mode 100644 index 41f4e48e4..000000000 --- a/tests/Zend/Gdata/Spreadsheets/WorksheetEntryTest.php +++ /dev/null @@ -1,58 +0,0 @@ -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/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php b/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php deleted file mode 100644 index ed2e3d177..000000000 --- a/tests/Zend/Gdata/Spreadsheets/WorksheetFeedTest.php +++ /dev/null @@ -1,66 +0,0 @@ -wksFeed = new Zend_Gdata_Spreadsheets_WorksheetFeed( - file_get_contents(__DIR__ . '/_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/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml b/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml deleted file mode 100644 index 229ee85a9..000000000 --- a/tests/Zend/Gdata/Spreadsheets/_files/TestDataCellFeedSample1.xml +++ /dev/null @@ -1,49 +0,0 @@ - - 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/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml b/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml deleted file mode 100644 index 264ca2c66..000000000 --- a/tests/Zend/Gdata/Spreadsheets/_files/TestDataListFeedSample1.xml +++ /dev/null @@ -1,56 +0,0 @@ - - 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/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml b/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml deleted file mode 100644 index 9f0ac3d13..000000000 --- a/tests/Zend/Gdata/Spreadsheets/_files/TestDataSpreadsheetFeedSample1.xml +++ /dev/null @@ -1,38 +0,0 @@ - - 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/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml b/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml deleted file mode 100644 index c4792eeed..000000000 --- a/tests/Zend/Gdata/Spreadsheets/_files/TestDataWorksheetFeedSample1.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 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 diff --git a/tests/Zend/Gdata/SpreadsheetsOnlineTest.php b/tests/Zend/Gdata/SpreadsheetsOnlineTest.php deleted file mode 100644 index 4f080e584..000000000 --- a/tests/Zend/Gdata/SpreadsheetsOnlineTest.php +++ /dev/null @@ -1,296 +0,0 @@ -sprKey = constant('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY'); - $this->wksId = constant('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID'); - $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME; - $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service); - $this->gdata = new Zend_Gdata_Spreadsheets($client); - } - - public function testGetSpreadsheetsAndWorksheetsAndData() - { - $spreadsheetCount = 0; - - $spreadsheets = $this->gdata->getSpreadsheets(); - $testedContents = false; - foreach($spreadsheets as $spreadsheet) { - $spreadsheetCount++; - $worksheetCount = 0; - $this->assertTrue($spreadsheet instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry, 'not instance of SpreadsheetEntry'); - foreach($spreadsheet->getWorksheets() as $worksheet) { - $this->assertTrue($worksheet instanceof Zend_Gdata_Spreadsheets_WorksheetEntry, 'not instance of WorksheetEntry'); - $worksheetCount++; - if ($spreadsheet->getTitle()->getText() == 'PHP Unit Test Sheet') { - $testedContents = true; - $contentAsCells = $worksheet->getContentsAsCells(); - $this->assertEquals('a1', $contentAsCells['A1']['value']); - $this->assertEquals('new', $contentAsCells['A2']['value']); - $this->assertEquals('row', $contentAsCells['B2']['value']); - $contentAsRows = $worksheet->getContentsAsRows(); - $this->assertEquals('new', $contentAsRows[0]['a1']); - $this->assertEquals('data', $contentAsRows[0]['c1']); - $this->assertEquals('here', $contentAsRows[0]['d1']); - } - } - $this->assertTrue($worksheetCount >= 1, 'didn\'t get >= 1 worksheet'); - } - $this->assertTrue($spreadsheetCount > 1, 'didn\'t get >1 spreadsheet'); - $this->assertTrue($testedContents, 'didn\'t test the contents of the worksheet'); - } - - public function testGetSpreadsheetFeed() - { - $feed = $this->gdata->getSpreadsheetFeed(); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_SpreadsheetFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $query = new Zend_Gdata_Spreadsheets_DocumentQuery(); - $feed = $this->gdata->getSpreadsheetFeed($query); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_SpreadsheetFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $uri = $query->getQueryUrl(); - $feed = $this->gdata->getSpreadsheetFeed($uri); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_SpreadsheetFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - } - - public function testGetWorksheetFeed() - { - $query = new Zend_Gdata_Spreadsheets_DocumentQuery(); - $query->setSpreadsheetKey($this->sprKey); - $feed = $this->gdata->getWorksheetFeed($query); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_WorksheetFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_WorksheetEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $uri = $query->getQueryUrl(); - $feed = $this->gdata->getWorksheetFeed($uri); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_WorksheetFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_WorksheetEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - } - - public function testGetCellFeed() - { - $query = new Zend_Gdata_Spreadsheets_CellQuery(); - $query->setSpreadsheetKey($this->sprKey); - $query->setWorksheetId($this->wksId); - $feed = $this->gdata->getCellFeed($query); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_CellFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $feed = $this->gdata->getCellFeed($query->getQueryUrl()); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_CellFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - } - - public function testGetListFeed() - { - $query = new Zend_Gdata_Spreadsheets_ListQuery(); - $query->setSpreadsheetKey($this->sprKey); - $query->setWorksheetId($this->wksId); - $feed = $this->gdata->getListFeed($query); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_ListFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - - $feed = $this->gdata->getListFeed($query->getQueryUrl()); - $this->assertTrue($feed instanceof Zend_Gdata_Spreadsheets_ListFeed); - foreach ($feed->entries as $entry) { - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry); - $this->assertTrue($entry->getHttpClient() == $feed->getHttpClient()); - } - } - - public function testGetSpreadsheetEntry() - { - $query = new Zend_Gdata_Spreadsheets_DocumentQuery(); - $query->setSpreadsheetKey($this->sprKey); - $entry = $this->gdata->getSpreadsheetEntry($query); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry); - - $entry = $this->gdata->getSpreadsheetEntry($query->getQueryUrl()); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry); - } - - public function testGetWorksheetEntry() - { - $query = new Zend_Gdata_Spreadsheets_DocumentQuery(); - $query->setSpreadsheetKey($this->sprKey); - $query->setWorksheetId($this->wksId); - $entry = $this->gdata->getWorksheetEntry($query); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_WorksheetEntry); - - $entry = $this->gdata->getWorksheetEntry($query->getQueryUrl()); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_WorksheetEntry); - } - - public function testGetCellEntry() - { - $query = new Zend_Gdata_Spreadsheets_CellQuery(); - $query->setSpreadsheetKey($this->sprKey); - $query->setCellId('R1C1'); - $entry = $this->gdata->getCellEntry($query); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry); - - $entry = $this->gdata->getCellEntry($query->getQueryUrl()); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry); - } - - public function testGetListEntry() - { - $query = new Zend_Gdata_Spreadsheets_ListQuery(); - $query->setSpreadsheetKey($this->sprKey); - $query->setStartIndex('1'); - $query->setMaxResults('1'); - $entry = $this->gdata->getListEntry($query); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry); - - $entry = $this->gdata->getListEntry($query->getQueryUrl()); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry); - } - - public function testUpdateCell() - { - $this->gdata->updateCell(5, 1, 'updated data', $this->sprKey, $this->wksId); - - $query = new Zend_Gdata_Spreadsheets_CellQuery(); - $query->setSpreadsheetKey($this->sprKey); - $query->setCellId('R5C1'); - $entry = $this->gdata->getCellEntry($query); - $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_CellEntry); - $this->assertTrue($entry->cell->getText() == 'updated data'); - - $this->gdata->updateCell(5, 1, '', $this->sprKey, $this->wksId); - } - - public function testInsertUpdateDeleteRow() - { - $rowData = array(); - $rowData['a1'] = 'new'; - $rowData['b1'] = 'row'; - $rowData['c1'] = 'data'; - $rowData['d1'] = 'here'; - $entry = $this->gdata->insertRow($rowData, $this->sprKey); - $rowData['a1'] = 'newer'; - $entry = $this->gdata->updateRow($entry, $rowData); - $this->gdata->deleteRow($entry); - } - - public function testInsertUpdateDeleteRow2() - { - $rowData = array(); - $rowData['a1'] = 'new'; - $rowData['b1'] = 'row'; - $rowData['c1'] = 'data'; - $rowData['d1'] = 'here'; - $entry = $this->gdata->insertRow($rowData, $this->sprKey); - $rowData['a1'] = 'newer'; - $entry = $this->gdata->updateRow($entry, $rowData); - $ssTest = new Zend_Gdata_Spreadsheets($entry->getHttpClient()); - $ssTest->delete($entry->getEditLink()->href); - } - - public function testInsertUpdateDeleteRow3() - { - $rowData = array(); - $rowData['a1'] = 'new'; - $rowData['b1'] = 'row'; - $rowData['c1'] = 'data'; - $rowData['d1'] = 'here'; - $entry = $this->gdata->insertRow($rowData, $this->sprKey); - $rowData['a1'] = 'newer'; - $entry = $this->gdata->updateRow($entry, $rowData); - $ssTest = new Zend_Gdata_Spreadsheets($entry->getHttpClient()); - $ssTest->delete($entry); - } - - public function testCustomElementsCollected() { - $rowData = array(); - $rowData['a1'] = 'new'; - $rowData['b1'] = 'row'; - $rowData['c1'] = 'data'; - $rowData['d1'] = 'here'; - $entry = $this->gdata->insertRow($rowData, $this->sprKey); - - $this->assertEquals(4, count($entry->custom)); - $this->assertEquals(4, count($entry->customByName)); - - $this->assertEquals('new', $entry->custom[0]->getText()); - $this->assertEquals('row', $entry->custom[1]->getText()); - $this->assertEquals('data', $entry->custom[2]->getText()); - $this->assertEquals('here', $entry->custom[3]->getText()); - - $this->assertEquals('new', $entry->customByName['a1']->getText()); - $this->assertEquals('row', $entry->customByName['b1']->getText()); - $this->assertEquals('data', $entry->customByName['c1']->getText()); - $this->assertEquals('here', $entry->customByName['d1']->getText()); - - $ssTest = new Zend_Gdata_Spreadsheets($entry->getHttpClient()); - $ssTest->delete($entry); - } - -} diff --git a/tests/Zend/Gdata/SpreadsheetsTest.php b/tests/Zend/Gdata/SpreadsheetsTest.php deleted file mode 100644 index 0609df264..000000000 --- a/tests/Zend/Gdata/SpreadsheetsTest.php +++ /dev/null @@ -1,49 +0,0 @@ -gdata = new Zend_Gdata_Spreadsheets(new Zend_Http_Client()); - } - - public function testSpreadsheets() - { - $this->assertTrue(true); - } - -} diff --git a/tests/Zend/Gdata/TestUtility/MockHttpClient.php b/tests/Zend/Gdata/TestUtility/MockHttpClient.php deleted file mode 100644 index 9fbc7eaeb..000000000 --- a/tests/Zend/Gdata/TestUtility/MockHttpClient.php +++ /dev/null @@ -1,83 +0,0 @@ -_requests = array(); - } - - public function popRequest() - { - if (count($this->_requests)) - return array_pop($this->_requests); - else - return NULL; - } - - public function write($method, - $uri, - $http_ver = '1.1', - $headers = array(), - $body = '') - { - $request = new Test_Zend_Gdata_MockHttpClient_Request(); - $request->method = $method; - $request->uri = $uri; - $request->http_ver = $http_ver; - $request->headers = $headers; - $request->body = $body; - array_push($this->_requests, $request); - return parent::write($method, $uri, $http_ver, $headers, $body); - } -} diff --git a/tests/Zend/Gdata/TransparencyTest.php b/tests/Zend/Gdata/TransparencyTest.php deleted file mode 100644 index 0bf99037e..000000000 --- a/tests/Zend/Gdata/TransparencyTest.php +++ /dev/null @@ -1,126 +0,0 @@ -transparencyText = file_get_contents( - 'Zend/Gdata/_files/TransparencyElementSample1.xml', - true); - $this->transparency = new Zend_Gdata_Extension_Transparency(); - } - - public function testEmptyTransparencyShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->transparency->extensionElements)); - $this->assertTrue(count($this->transparency->extensionElements) == 0); - } - - public function testEmptyTransparencyShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->transparency->extensionAttributes)); - $this->assertTrue(count($this->transparency->extensionAttributes) == 0); - } - - public function testSampleTransparencyShouldHaveNoExtensionElements() { - $this->transparency->transferFromXML($this->transparencyText); - $this->assertTrue(is_array($this->transparency->extensionElements)); - $this->assertTrue(count($this->transparency->extensionElements) == 0); - } - - public function testSampleTransparencyShouldHaveNoExtensionAttributes() { - $this->transparency->transferFromXML($this->transparencyText); - $this->assertTrue(is_array($this->transparency->extensionAttributes)); - $this->assertTrue(count($this->transparency->extensionAttributes) == 0); - } - - public function testNormalTransparencyShouldHaveNoExtensionElements() { - $this->transparency->value = "http://schemas.google.com/g/2005#event.opaque"; - - $this->assertEquals("http://schemas.google.com/g/2005#event.opaque", $this->transparency->value); - - $this->assertEquals(0, count($this->transparency->extensionElements)); - $newTransparency = new Zend_Gdata_Extension_Transparency(); - $newTransparency->transferFromXML($this->transparency->saveXML()); - $this->assertEquals(0, count($newTransparency->extensionElements)); - $newTransparency->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newTransparency->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.opaque", $newTransparency->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newTransparency2 = $gdata->newTransparency(); - $newTransparency2->transferFromXML($newTransparency->saveXML()); - $this->assertEquals(1, count($newTransparency2->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.opaque", $newTransparency2->value); - } - - public function testEmptyTransparencyToAndFromStringShouldMatch() { - $transparencyXml = $this->transparency->saveXML(); - $newTransparency = new Zend_Gdata_Extension_Transparency(); - $newTransparency->transferFromXML($transparencyXml); - $newTransparencyXml = $newTransparency->saveXML(); - $this->assertTrue($transparencyXml == $newTransparencyXml); - } - - public function testTransparencyWithValueToAndFromStringShouldMatch() { - $this->transparency->value = "http://schemas.google.com/g/2005#event.opaque"; - $transparencyXml = $this->transparency->saveXML(); - $newTransparency = new Zend_Gdata_Extension_Transparency(); - $newTransparency->transferFromXML($transparencyXml); - $newTransparencyXml = $newTransparency->saveXML(); - $this->assertTrue($transparencyXml == $newTransparencyXml); - $this->assertEquals("http://schemas.google.com/g/2005#event.opaque", $this->transparency->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->transparency->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->transparency->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->transparency->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->transparency->extensionAttributes['foo2']['value']); - $transparencyXml = $this->transparency->saveXML(); - $newTransparency = new Zend_Gdata_Extension_Transparency(); - $newTransparency->transferFromXML($transparencyXml); - $this->assertEquals('bar', $newTransparency->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newTransparency->extensionAttributes['foo2']['value']); - } - - public function testConvertFullTransparencyToAndFromString() { - $this->transparency->transferFromXML($this->transparencyText); - $this->assertEquals("http://schemas.google.com/g/2005#event.transparent", $this->transparency->value); - } - -} diff --git a/tests/Zend/Gdata/VisibilityTest.php b/tests/Zend/Gdata/VisibilityTest.php deleted file mode 100644 index 96d0c418f..000000000 --- a/tests/Zend/Gdata/VisibilityTest.php +++ /dev/null @@ -1,126 +0,0 @@ -visibilityText = file_get_contents( - 'Zend/Gdata/_files/VisibilityElementSample1.xml', - true); - $this->visibility = new Zend_Gdata_Extension_Visibility(); - } - - public function testEmptyVisibilityShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->visibility->extensionElements)); - $this->assertTrue(count($this->visibility->extensionElements) == 0); - } - - public function testEmptyVisibilityShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->visibility->extensionAttributes)); - $this->assertTrue(count($this->visibility->extensionAttributes) == 0); - } - - public function testSampleVisibilityShouldHaveNoExtensionElements() { - $this->visibility->transferFromXML($this->visibilityText); - $this->assertTrue(is_array($this->visibility->extensionElements)); - $this->assertTrue(count($this->visibility->extensionElements) == 0); - } - - public function testSampleVisibilityShouldHaveNoExtensionAttributes() { - $this->visibility->transferFromXML($this->visibilityText); - $this->assertTrue(is_array($this->visibility->extensionAttributes)); - $this->assertTrue(count($this->visibility->extensionAttributes) == 0); - } - - public function testNormalVisibilityShouldHaveNoExtensionElements() { - $this->visibility->value = "http://schemas.google.com/g/2005#event.private"; - - $this->assertEquals("http://schemas.google.com/g/2005#event.private", $this->visibility->value); - - $this->assertEquals(0, count($this->visibility->extensionElements)); - $newVisibility = new Zend_Gdata_Extension_Visibility(); - $newVisibility->transferFromXML($this->visibility->saveXML()); - $this->assertEquals(0, count($newVisibility->extensionElements)); - $newVisibility->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newVisibility->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.private", $newVisibility->value); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newVisibility2 = $gdata->newVisibility(); - $newVisibility2->transferFromXML($newVisibility->saveXML()); - $this->assertEquals(1, count($newVisibility2->extensionElements)); - $this->assertEquals("http://schemas.google.com/g/2005#event.private", $newVisibility2->value); - } - - public function testEmptyVisibilityToAndFromStringShouldMatch() { - $visibilityXml = $this->visibility->saveXML(); - $newVisibility = new Zend_Gdata_Extension_Visibility(); - $newVisibility->transferFromXML($visibilityXml); - $newVisibilityXml = $newVisibility->saveXML(); - $this->assertTrue($visibilityXml == $newVisibilityXml); - } - - public function testVisibilityWithValueToAndFromStringShouldMatch() { - $this->visibility->value = "http://schemas.google.com/g/2005#event.private"; - $visibilityXml = $this->visibility->saveXML(); - $newVisibility = new Zend_Gdata_Extension_Visibility(); - $newVisibility->transferFromXML($visibilityXml); - $newVisibilityXml = $newVisibility->saveXML(); - $this->assertTrue($visibilityXml == $newVisibilityXml); - $this->assertEquals("http://schemas.google.com/g/2005#event.private", $this->visibility->value); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->visibility->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->visibility->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->visibility->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->visibility->extensionAttributes['foo2']['value']); - $visibilityXml = $this->visibility->saveXML(); - $newVisibility = new Zend_Gdata_Extension_Visibility(); - $newVisibility->transferFromXML($visibilityXml); - $this->assertEquals('bar', $newVisibility->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newVisibility->extensionAttributes['foo2']['value']); - } - - public function testConvertFullVisibilityToAndFromString() { - $this->visibility->transferFromXML($this->visibilityText); - $this->assertEquals("http://schemas.google.com/g/2005#event.confidential", $this->visibility->value); - } - -} diff --git a/tests/Zend/Gdata/WhenTest.php b/tests/Zend/Gdata/WhenTest.php deleted file mode 100644 index 7e0432a61..000000000 --- a/tests/Zend/Gdata/WhenTest.php +++ /dev/null @@ -1,145 +0,0 @@ -whenText = file_get_contents( - 'Zend/Gdata/_files/WhenElementSample1.xml', - true); - $this->when = new Zend_Gdata_Extension_When(); - } - - public function testEmptyWhenShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->when->extensionElements)); - $this->assertTrue(count($this->when->extensionElements) == 0); - } - - public function testEmptyWhenShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->when->extensionAttributes)); - $this->assertTrue(count($this->when->extensionAttributes) == 0); - } - - public function testSampleWhenShouldHaveNoExtensionElements() { - $this->when->transferFromXML($this->whenText); - $this->assertTrue(is_array($this->when->extensionElements)); - $this->assertTrue(count($this->when->extensionElements) == 0); - } - - public function testSampleWhenShouldHaveNoExtensionAttributes() { - $this->when->transferFromXML($this->whenText); - $this->assertTrue(is_array($this->when->extensionAttributes)); - $this->assertTrue(count($this->when->extensionAttributes) == 0); - } - - public function testNormalWhenShouldHaveNoExtensionElements() { - $this->when->valueString = "Later"; - $this->when->endTime = "2007-06-21T21:31:56-07:00"; - $this->when->startTime = "2007-06-19T05:42:19-06:00"; - - $this->assertEquals("Later", $this->when->valueString); - $this->assertEquals("2007-06-21T21:31:56-07:00", $this->when->endTime); - $this->assertEquals("2007-06-19T05:42:19-06:00", $this->when->startTime); - - $this->assertEquals(0, count($this->when->extensionElements)); - $newWhen = new Zend_Gdata_Extension_When(); - $newWhen->transferFromXML($this->when->saveXML()); - $this->assertEquals(0, count($newWhen->extensionElements)); - $newWhen->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newWhen->extensionElements)); - $this->assertEquals("Later", $newWhen->valueString); - $this->assertEquals("2007-06-21T21:31:56-07:00", $newWhen->endTime); - $this->assertEquals("2007-06-19T05:42:19-06:00", $newWhen->startTime); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newWhen2 = $gdata->newWhen(); - $newWhen2->transferFromXML($newWhen->saveXML()); - $this->assertEquals(1, count($newWhen2->extensionElements)); - $this->assertEquals("Later", $newWhen2->valueString); - $this->assertEquals("2007-06-21T21:31:56-07:00", $newWhen2->endTime); - $this->assertEquals("2007-06-19T05:42:19-06:00", $newWhen2->startTime); - } - - public function testEmptyWhenToAndFromStringShouldMatch() { - $whenXml = $this->when->saveXML(); - $newWhen = new Zend_Gdata_Extension_When(); - $newWhen->transferFromXML($whenXml); - $newWhenXml = $newWhen->saveXML(); - $this->assertTrue($whenXml == $newWhenXml); - } - - public function testWhenWithValueToAndFromStringShouldMatch() { - $this->when->valueString = "Later"; - $this->when->endTime = "2007-06-21T21:31:56-07:00"; - $this->when->startTime = "2007-06-19T05:42:19-06:00"; - $whenXml = $this->when->saveXML(); - $newWhen = new Zend_Gdata_Extension_When(); - $newWhen->transferFromXML($whenXml); - $newWhenXml = $newWhen->saveXML(); - $this->assertTrue($whenXml == $newWhenXml); - $this->assertEquals("Later", $this->when->valueString); - $this->assertEquals("2007-06-21T21:31:56-07:00", $this->when->endTime); - $this->assertEquals("2007-06-19T05:42:19-06:00", $this->when->startTime); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->when->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->when->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->when->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->when->extensionAttributes['foo2']['value']); - $whenXml = $this->when->saveXML(); - $newWhen = new Zend_Gdata_Extension_When(); - $newWhen->transferFromXML($whenXml); - $this->assertEquals('bar', $newWhen->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newWhen->extensionAttributes['foo2']['value']); - } - - public function testConvertFullWhenToAndFromString() { - $this->when->transferFromXML($this->whenText); - $this->assertEquals("Tomorrow @ 5 PM", $this->when->valueString); - $this->assertEquals("2005-06-06T18:00:00-08:00", $this->when->endTime); - $this->assertEquals("2005-06-06T17:00:00-08:00", $this->when->startTime); - } - - public function testToStringCanReturnValueString() { - $this->when->transferFromXML($this->whenText); - $this->assertEquals('Tomorrow @ 5 PM', $this->when->__toString()); - } - -} diff --git a/tests/Zend/Gdata/WhereTest.php b/tests/Zend/Gdata/WhereTest.php deleted file mode 100644 index 39153d694..000000000 --- a/tests/Zend/Gdata/WhereTest.php +++ /dev/null @@ -1,142 +0,0 @@ -whereText = file_get_contents( - 'Zend/Gdata/_files/WhereElementSample1.xml', - true); - $this->where = new Zend_Gdata_Extension_Where(); - } - - public function testEmptyWhereShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->where->extensionElements)); - $this->assertTrue(count($this->where->extensionElements) == 0); - } - - public function testEmptyWhereShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->where->extensionAttributes)); - $this->assertTrue(count($this->where->extensionAttributes) == 0); - } - - public function testSampleWhereShouldHaveNoExtensionElements() { - $this->where->transferFromXML($this->whereText); - $this->assertTrue(is_array($this->where->extensionElements)); - $this->assertTrue(count($this->where->extensionElements) == 0); - } - - public function testSampleWhereShouldHaveNoExtensionAttributes() { - $this->where->transferFromXML($this->whereText); - $this->assertTrue(is_array($this->where->extensionAttributes)); - $this->assertTrue(count($this->where->extensionAttributes) == 0); - } - - public function testNormalWhereShouldHaveNoExtensionElements() { - $this->where->valueString = "Test Value String"; - $this->where->rel = "http://schemas.google.com/g/2005#event.alternate"; - $this->where->label = "Test Label"; - - $this->assertEquals("Test Value String", $this->where->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.alternate", $this->where->rel); - $this->assertEquals("Test Label", $this->where->label); - - $this->assertEquals(0, count($this->where->extensionElements)); - $newWhere = new Zend_Gdata_Extension_Where(); - $newWhere->transferFromXML($this->where->saveXML()); - $this->assertEquals(0, count($newWhere->extensionElements)); - $newWhere->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newWhere->extensionElements)); - $this->assertEquals("Test Value String", $newWhere->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.alternate", $newWhere->rel); - $this->assertEquals("Test Label", $newWhere->label); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newWhere2 = $gdata->newWhere(); - $newWhere2->transferFromXML($newWhere->saveXML()); - $this->assertEquals(1, count($newWhere2->extensionElements)); - $this->assertEquals("Test Value String", $newWhere2->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.alternate", $newWhere2->rel); - $this->assertEquals("Test Label", $newWhere2->label); - } - - public function testEmptyWhereToAndFromStringShouldMatch() { - $whereXml = $this->where->saveXML(); - $newWhere = new Zend_Gdata_Extension_Where(); - $newWhere->transferFromXML($whereXml); - $newWhereXml = $newWhere->saveXML(); - $this->assertTrue($whereXml == $newWhereXml); - } - - public function testWhereWithValueToAndFromStringShouldMatch() { - $this->where->valueString = "Test Value String"; - $this->where->rel = "http://schemas.google.com/g/2005#event.alternate"; - $this->where->label = "Test Label"; - $whereXml = $this->where->saveXML(); - $newWhere = new Zend_Gdata_Extension_Where(); - $newWhere->transferFromXML($whereXml); - $newWhereXml = $newWhere->saveXML(); - $this->assertTrue($whereXml == $newWhereXml); - $this->assertEquals("Test Value String", $this->where->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.alternate", $this->where->rel); - $this->assertEquals("Test Label", $this->where->label); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->where->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->where->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->where->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->where->extensionAttributes['foo2']['value']); - $whereXml = $this->where->saveXML(); - $newWhere = new Zend_Gdata_Extension_Where(); - $newWhere->transferFromXML($whereXml); - $this->assertEquals('bar', $newWhere->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newWhere->extensionAttributes['foo2']['value']); - } - - public function testConvertFullWhereToAndFromString() { - $this->where->transferFromXML($this->whereText); - $this->assertEquals("Joe's Pub", $this->where->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event", $this->where->rel); - $this->assertEquals("1234 Anywhere Ln., New York, NY", $this->where->label); - $this->assertTrue($this->where->entryLink instanceof Zend_Gdata_Extension_EntryLink); - $this->assertEquals("http://local.example.com/10018/JoesPub", $this->where->entryLink->href); - } - -} diff --git a/tests/Zend/Gdata/WhoTest.php b/tests/Zend/Gdata/WhoTest.php deleted file mode 100644 index c141a74ef..000000000 --- a/tests/Zend/Gdata/WhoTest.php +++ /dev/null @@ -1,146 +0,0 @@ -whoText = file_get_contents( - 'Zend/Gdata/_files/WhoElementSample1.xml', - true); - $this->who = new Zend_Gdata_Extension_Who(); - } - - public function testEmptyWhoShouldHaveNoExtensionElements() { - $this->assertTrue(is_array($this->who->extensionElements)); - $this->assertTrue(count($this->who->extensionElements) == 0); - } - - public function testEmptyWhoShouldHaveNoExtensionAttributes() { - $this->assertTrue(is_array($this->who->extensionAttributes)); - $this->assertTrue(count($this->who->extensionAttributes) == 0); - } - - public function testSampleWhoShouldHaveNoExtensionElements() { - $this->who->transferFromXML($this->whoText); - $this->assertTrue(is_array($this->who->extensionElements)); - $this->assertTrue(count($this->who->extensionElements) == 0); - } - - public function testSampleWhoShouldHaveNoExtensionAttributes() { - $this->who->transferFromXML($this->whoText); - $this->assertTrue(is_array($this->who->extensionAttributes)); - $this->assertTrue(count($this->who->extensionAttributes) == 0); - } - - public function testNormalWhoShouldHaveNoExtensionElements() { - $this->who->valueString = "Test Value String"; - $this->who->rel = "http://schemas.google.com/g/2005#event.speaker"; - $this->who->email = "testemail@somewhere.domain.invalid"; - - $this->assertEquals("Test Value String", $this->who->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.speaker", $this->who->rel); - $this->assertEquals("testemail@somewhere.domain.invalid", $this->who->email); - - $this->assertEquals(0, count($this->who->extensionElements)); - $newWho = new Zend_Gdata_Extension_Who(); - $newWho->transferFromXML($this->who->saveXML()); - $this->assertEquals(0, count($newWho->extensionElements)); - $newWho->extensionElements = array( - new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar')); - $this->assertEquals(1, count($newWho->extensionElements)); - $this->assertEquals("Test Value String", $newWho->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.speaker", $newWho->rel); - $this->assertEquals("testemail@somewhere.domain.invalid", $newWho->email); - - /* try constructing using magic factory */ - $gdata = new Zend_Gdata(); - $newWho2 = $gdata->newWho(); - $newWho2->transferFromXML($newWho->saveXML()); - $this->assertEquals(1, count($newWho2->extensionElements)); - $this->assertEquals("Test Value String", $newWho2->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.speaker", $newWho2->rel); - $this->assertEquals("testemail@somewhere.domain.invalid", $newWho2->email); - } - - public function testEmptyWhoToAndFromStringShouldMatch() { - $whoXml = $this->who->saveXML(); - $newWho = new Zend_Gdata_Extension_Who(); - $newWho->transferFromXML($whoXml); - $newWhoXml = $newWho->saveXML(); - $this->assertTrue($whoXml == $newWhoXml); - } - - public function testWhoWithValueToAndFromStringShouldMatch() { - $this->who->valueString = "Test Value String"; - $this->who->rel = "http://schemas.google.com/g/2005#event.speaker"; - $this->who->email = "testemail@somewhere.domain.invalid"; - $whoXml = $this->who->saveXML(); - $newWho = new Zend_Gdata_Extension_Who(); - $newWho->transferFromXML($whoXml); - $newWhoXml = $newWho->saveXML(); - $this->assertTrue($whoXml == $newWhoXml); - $this->assertEquals("Test Value String", $this->who->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.speaker", $this->who->rel); - $this->assertEquals("testemail@somewhere.domain.invalid", $this->who->email); - } - - public function testExtensionAttributes() { - $extensionAttributes = $this->who->extensionAttributes; - $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar'); - $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab'); - $this->who->extensionAttributes = $extensionAttributes; - $this->assertEquals('bar', $this->who->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $this->who->extensionAttributes['foo2']['value']); - $whoXml = $this->who->saveXML(); - $newWho = new Zend_Gdata_Extension_Who(); - $newWho->transferFromXML($whoXml); - $this->assertEquals('bar', $newWho->extensionAttributes['foo1']['value']); - $this->assertEquals('rab', $newWho->extensionAttributes['foo2']['value']); - } - - public function testConvertFullWhoToAndFromString() { - $this->who->transferFromXML($this->whoText); - $this->assertEquals("Jo", $this->who->valueString); - $this->assertEquals("http://schemas.google.com/g/2005#event.attendee", $this->who->rel); - $this->assertEquals("jo@nowhere.invalid", $this->who->email); - $this->assertTrue($this->who->attendeeStatus instanceof Zend_Gdata_Extension_AttendeeStatus); - $this->assertEquals("http://schemas.google.com/g/2005#event.tentative", $this->who->attendeeStatus->value); - $this->assertTrue($this->who->attendeeType instanceof Zend_Gdata_Extension_AttendeeType); - $this->assertEquals("http://schemas.google.com/g/2005#event.required", $this->who->attendeeType->value); - $this->assertTrue($this->who->entryLink instanceof Zend_Gdata_Extension_EntryLink); - $this->assertEquals("http://gmail.com/jo/contacts/Jo", $this->who->entryLink->href); - } - -} diff --git a/tests/Zend/Gdata/_files/AppSample1.txt b/tests/Zend/Gdata/_files/AppSample1.txt deleted file mode 100644 index 0a4a31750..000000000 --- a/tests/Zend/Gdata/_files/AppSample1.txt +++ /dev/null @@ -1,30 +0,0 @@ -HTTP/1.1 200 OK -Content-Type: application/atom+xml; charset=UTF-8 -Last-Modified: Sun, 07 Sep 2008 17:53:51 GMT -Cache-Control: max-age=0 private -ETag: W/"CkcHQH8_fCp7ImA9WxRTGEw." -Gdata-Version: 1.2 -Date: Sun, 07 Sep 2008 21:23:39 GMT -Content-Length: 1450 -Server: GFE/1.3 - - - - - 12345678901234567890 - 2008-09-07T10:53:00.001-07:00 - 2008-09-07T10:53:51.144-07:00 - 2008-09-07T10:53:51.144-07:00 - Hello world - <p>Hello world!</p> - - - - - - - John Doe - http://www.blogger.com/profile/5555555555555555 - jdoe@example.com - - diff --git a/tests/Zend/Gdata/_files/AppSample2.txt b/tests/Zend/Gdata/_files/AppSample2.txt deleted file mode 100644 index 93f8f6261..000000000 --- a/tests/Zend/Gdata/_files/AppSample2.txt +++ /dev/null @@ -1,29 +0,0 @@ -HTTP/1.1 200 OK -Content-Type: application/atom+xml; charset=UTF-8 -Last-Modified: Sun, 07 Sep 2008 17:53:51 GMT -Cache-Control: max-age=0 private -ETag: W/"CkcHQH8_fCp7ImA9WxRTGEw." -Date: Sun, 07 Sep 2008 21:23:39 GMT -Content-Length: 1450 -Server: GFE/1.3 - - - - - 12345678901234567890 - 2008-09-07T10:53:00.001-07:00 - 2008-09-07T10:53:51.144-07:00 - 2008-09-07T10:53:51.144-07:00 - Hello world - <p>Hello world!</p> - - - - - - - John Doe - http://www.blogger.com/profile/5555555555555555 - jdoe@example.com - - diff --git a/tests/Zend/Gdata/_files/AppSample3.txt b/tests/Zend/Gdata/_files/AppSample3.txt deleted file mode 100644 index acd00242a..000000000 --- a/tests/Zend/Gdata/_files/AppSample3.txt +++ /dev/null @@ -1,68 +0,0 @@ -HTTP/1.1 200 OK -Content-Type: application/atom+xml; charset=UTF-8 -Last-Modified: Sun, 07 Sep 2008 17:53:51 GMT -Cache-Control: max-age=0 private -ETag: W/"CkcHQH8_fCp7ImA9WxRTGEw." -Gdata-Version: 1.2 -Date: Sun, 07 Sep 2008 21:23:39 GMT -Content-Length: 1450 -Server: GFE/1.3 - - - - - tag:blogger.com,1999:blog-8273578352962669317 - 2008-11-11T20:09:14.238-08:00 - Test Blog - This is my description. - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - Blogger - 30 - 1 - 25 - - tag:blogger.com,1999:blog-8273578352962669317.post-4858063079003295518 - 2008-11-11T20:09:00.001-08:00 - 2008-11-11T20:09:14.251-08:00 - 2008-11-11T20:09:14.251-08:00 - Test Image - FOO - - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - 0 - - \ No newline at end of file diff --git a/tests/Zend/Gdata/_files/AppSample4.txt b/tests/Zend/Gdata/_files/AppSample4.txt deleted file mode 100644 index a97663259..000000000 --- a/tests/Zend/Gdata/_files/AppSample4.txt +++ /dev/null @@ -1,67 +0,0 @@ -HTTP/1.1 200 OK -Content-Type: application/atom+xml; charset=UTF-8 -Last-Modified: Sun, 07 Sep 2008 17:53:51 GMT -Cache-Control: max-age=0 private -ETag: W/"CkcHQH8_fCp7ImA9WxRTGEw." -Date: Sun, 07 Sep 2008 21:23:39 GMT -Content-Length: 1450 -Server: GFE/1.3 - - - - - tag:blogger.com,1999:blog-8273578352962669317 - 2008-11-11T20:09:14.238-08:00 - Test Blog - This is my description. - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - Blogger - 30 - 1 - 25 - - tag:blogger.com,1999:blog-8273578352962669317.post-4858063079003295518 - 2008-11-11T20:09:00.001-08:00 - 2008-11-11T20:09:14.251-08:00 - 2008-11-11T20:09:14.251-08:00 - Test Image - FOO - - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - 0 - - \ No newline at end of file diff --git a/tests/Zend/Gdata/_files/AttendeeStatusElementSample1.xml b/tests/Zend/Gdata/_files/AttendeeStatusElementSample1.xml deleted file mode 100644 index 3ffc5e507..000000000 --- a/tests/Zend/Gdata/_files/AttendeeStatusElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/AttendeeTypeElementSample1.xml b/tests/Zend/Gdata/_files/AttendeeTypeElementSample1.xml deleted file mode 100644 index 547f1eeaa..000000000 --- a/tests/Zend/Gdata/_files/AttendeeTypeElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/CommentsElementSample1.xml b/tests/Zend/Gdata/_files/CommentsElementSample1.xml deleted file mode 100644 index 67ffd1d5e..000000000 --- a/tests/Zend/Gdata/_files/CommentsElementSample1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/tests/Zend/Gdata/_files/DocsTest.csv b/tests/Zend/Gdata/_files/DocsTest.csv deleted file mode 100644 index d83012da7..000000000 --- a/tests/Zend/Gdata/_files/DocsTest.csv +++ /dev/null @@ -1,4 +0,0 @@ -name,favoriteColor -fred,blue -john,red -doug,green diff --git a/tests/Zend/Gdata/_files/EntryLinkElementSample1.xml b/tests/Zend/Gdata/_files/EntryLinkElementSample1.xml deleted file mode 100644 index d5ba1384f..000000000 --- a/tests/Zend/Gdata/_files/EntryLinkElementSample1.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - http://gmail.com/jo/contacts/Jo - - Jo March - - diff --git a/tests/Zend/Gdata/_files/EntrySample1.xml b/tests/Zend/Gdata/_files/EntrySample1.xml deleted file mode 100644 index e1433bbf6..000000000 --- a/tests/Zend/Gdata/_files/EntrySample1.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - tag:blogger.com,1999:blog-8273578352962669317.post-6938730899689776686 - 2008-09-07T10:53:00.001-07:00 - 2008-09-07T10:53:51.144-07:00 - 2008-09-07T10:53:51.144-07:00 - Hello world - <p>Hello world!</p> - - - - - - - John Doe - http://www.blogger.com/profile/12345678901234567890 - jdoe@example.com - - diff --git a/tests/Zend/Gdata/_files/EventStatusElementSample1.xml b/tests/Zend/Gdata/_files/EventStatusElementSample1.xml deleted file mode 100644 index e59159543..000000000 --- a/tests/Zend/Gdata/_files/EventStatusElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/ExtendedPropertyElementSample1.xml b/tests/Zend/Gdata/_files/ExtendedPropertyElementSample1.xml deleted file mode 100644 index 3acb8210a..000000000 --- a/tests/Zend/Gdata/_files/ExtendedPropertyElementSample1.xml +++ /dev/null @@ -1,3 +0,0 @@ - - \ No newline at end of file diff --git a/tests/Zend/Gdata/_files/FeedLinkElementSample1.xml b/tests/Zend/Gdata/_files/FeedLinkElementSample1.xml deleted file mode 100644 index d56687ad6..000000000 --- a/tests/Zend/Gdata/_files/FeedLinkElementSample1.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - 2007-06-19T00:48:41.230Z - - Comments for: Sample Event - - - diff --git a/tests/Zend/Gdata/_files/FeedSampleV1.xml b/tests/Zend/Gdata/_files/FeedSampleV1.xml deleted file mode 100644 index be92553d1..000000000 --- a/tests/Zend/Gdata/_files/FeedSampleV1.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - tag:blogger.com,1999:blog-8273578352962669317 - 2008-11-11T20:09:14.238-08:00 - Test Blog - This is my description. - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - Blogger - 30 - 1 - 25 - - tag:blogger.com,1999:blog-8273578352962669317.post-4858063079003295518 - 2008-11-11T20:09:00.001-08:00 - 2008-11-11T20:09:14.251-08:00 - 2008-11-11T20:09:14.251-08:00 - Test Image - FOO - - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - 0 - - \ No newline at end of file diff --git a/tests/Zend/Gdata/_files/FeedSampleV2.xml b/tests/Zend/Gdata/_files/FeedSampleV2.xml deleted file mode 100644 index a9b2fe3bb..000000000 --- a/tests/Zend/Gdata/_files/FeedSampleV2.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - tag:blogger.com,1999:blog-8273578352962669317 - 2008-11-11T20:09:14.238-08:00 - Test Blog - This is my description. - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - Blogger - 30 - 1 - 25 - - tag:blogger.com,1999:blog-8273578352962669317.post-4858063079003295518 - 2008-11-11T20:09:00.001-08:00 - 2008-11-11T20:09:14.251-08:00 - 2008-11-11T20:09:14.251-08:00 - Test Image - FOO - - - - - - - John Doe - http://www.blogger.com/profile/05925487542352262450 - tmjdev@gmail.com - - 0 - - \ No newline at end of file diff --git a/tests/Zend/Gdata/_files/MediaMimeStreamSample1.txt b/tests/Zend/Gdata/_files/MediaMimeStreamSample1.txt deleted file mode 100644 index 5c42df717..000000000 --- a/tests/Zend/Gdata/_files/MediaMimeStreamSample1.txt +++ /dev/null @@ -1 +0,0 @@ -aaa---fakeBinary---bbb \ No newline at end of file diff --git a/tests/Zend/Gdata/_files/OpenSearchItemsPerPageElementSample1.xml b/tests/Zend/Gdata/_files/OpenSearchItemsPerPageElementSample1.xml deleted file mode 100644 index 6c7aa6017..000000000 --- a/tests/Zend/Gdata/_files/OpenSearchItemsPerPageElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - -25 diff --git a/tests/Zend/Gdata/_files/OpenSearchStartIndexElementSample1.xml b/tests/Zend/Gdata/_files/OpenSearchStartIndexElementSample1.xml deleted file mode 100644 index 4fd667380..000000000 --- a/tests/Zend/Gdata/_files/OpenSearchStartIndexElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - -5 diff --git a/tests/Zend/Gdata/_files/OpenSearchTotalResultsElementSample1.xml b/tests/Zend/Gdata/_files/OpenSearchTotalResultsElementSample1.xml deleted file mode 100644 index b3f0a0c25..000000000 --- a/tests/Zend/Gdata/_files/OpenSearchTotalResultsElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - -12 diff --git a/tests/Zend/Gdata/_files/OriginalEventElementSample1.xml b/tests/Zend/Gdata/_files/OriginalEventElementSample1.xml deleted file mode 100644 index 7955fd513..000000000 --- a/tests/Zend/Gdata/_files/OriginalEventElementSample1.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/tests/Zend/Gdata/_files/RecurrenceElementSample1.xml b/tests/Zend/Gdata/_files/RecurrenceElementSample1.xml deleted file mode 100644 index d252ec798..000000000 --- a/tests/Zend/Gdata/_files/RecurrenceElementSample1.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -DTSTART;VALUE=DATE:20070501 -DTEND;VALUE=DATE:20070502 -RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904 - diff --git a/tests/Zend/Gdata/_files/RecurrenceExceptionElementSample1.xml b/tests/Zend/Gdata/_files/RecurrenceExceptionElementSample1.xml deleted file mode 100644 index 768993c10..000000000 --- a/tests/Zend/Gdata/_files/RecurrenceExceptionElementSample1.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/Zend/Gdata/_files/ReminderElementSample1.xml b/tests/Zend/Gdata/_files/ReminderElementSample1.xml deleted file mode 100644 index aaa4961b8..000000000 --- a/tests/Zend/Gdata/_files/ReminderElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/RsaCert.pem b/tests/Zend/Gdata/_files/RsaCert.pem deleted file mode 100644 index 445542cb3..000000000 --- a/tests/Zend/Gdata/_files/RsaCert.pem +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICxTCCAi6gAwIBAgIJALIWLob1fh/YMA0GCSqGSIb3DQEBBQUAMEwxCzAJBgNV -BAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEYMBYG -A1UEAxMPd3d3LmV4YW1wbGUuY29tMB4XDTA4MDYyOTIwMDEyMVoXDTA5MDYyOTIw -MDEyMVowTDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3Vu -dGFpbiBWaWV3MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20wgZ8wDQYJKoZIhvcN -AQEBBQADgY0AMIGJAoGBAN8jNUSm/KkypB2sTIRIob/GPVJAeDUSFOQ+HOT0sruM -lf0RzY8wLBQdVshLfq1PsdE49jPavnOR9+CBI4f1LUC24XUcDQ0W1MTltdOrx1Rr -FWQHrNE6R19N2eYLC0o0VBJhp4o6VERr8MhKiQT4GqtZjJpycF/G0M5ysDZCvaA9 -AgMBAAGjga4wgaswHQYDVR0OBBYEFH3/umQGqQAzS6zm8Vi29FKuk9K/MHwGA1Ud -IwR1MHOAFH3/umQGqQAzS6zm8Vi29FKuk9K/oVCkTjBMMQswCQYDVQQGEwJVUzEL -MAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxGDAWBgNVBAMTD3d3 -dy5leGFtcGxlLmNvbYIJALIWLob1fh/YMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcN -AQEFBQADgYEAwBPAqlfAM0prZ7GNfVkFjxZv5/HALtcd54CYIiSk0FHFMmRrQbDr -DgaMcB4TVVF9ldVoRqvP4MpB4/SzYlEHMctjrJwbdVLZl7zACuTElsl4yr+Dzv6h -zVj1cIz9+lzwPZ8e0HJRRWmdEe+zoCed5iUigtEViMUvhszLzLcGmEc= ------END CERTIFICATE----- diff --git a/tests/Zend/Gdata/_files/RsaKey.pem b/tests/Zend/Gdata/_files/RsaKey.pem deleted file mode 100644 index b2deeca62..000000000 --- a/tests/Zend/Gdata/_files/RsaKey.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXwIBAAKBgQDfIzVEpvypMqQdrEyESKG/xj1SQHg1EhTkPhzk9LK7jJX9Ec2P -MCwUHVbIS36tT7HROPYz2r5zkffggSOH9S1AtuF1HA0NFtTE5bXTq8dUaxVkB6zR -OkdfTdnmCwtKNFQSYaeKOlREa/DISokE+BqrWYyacnBfxtDOcrA2Qr2gPQIDAQAB -AoGBAMetwyJvaJSk67ZeFI8gTBbIeOGdLbUYPDfP2Z2N2E/7S9GO1+u2CQvrAVj2 -LiM7uP1owvG+Y0Yarr5p8fjdj6K4FBFZIsv7ugm9+lhwHMQXBMT8RdnPUtAupzRT -YuNlJgBluFyV2C6JZakmHKbn+RJxTnBAiWAMe+8zXQTNlhXBAkEA/0yk2o6q4yTR -hMg9REHyA8mNlZYgFm41tJmNIoshK+xWEyx+mvKEt3VHdkz0kDqzZo5XR/PoqH8P -FTsVntGyTQJBAN+/+Ckiw5XCBkeJMVmuynSP+PXXViczzBZiTJQeMf+ja+uL9XXH -cf2Y1Hg+0YGdr+NzGb3EKxH+CzLaaz3ZPbECQQDmFXUdZCauv6f0O2K7+ZLbxvJL -NhmFHZ5ZPWntD+a9ZynL7fXMP3VMwe29uG1Q7xZv/yi6OCAeeyRkxfMeR26hAkEA -y80hjuZ5W/kkmxgdeWC6S72vuM1xTbfiVykmM2vlgsIp1Jzg8Wy/KYyBSx182yD0 -SqpWcgEycesB7EoCkI1FoQJBALU/zXYUn0Jmh/qKruPo+7PwyQqgiO+muWoYxVC2 -vYdtqvvIAKUhERjA8vkbPdqp4zzjjzs6hjTeOmGqmmrFhxk= ------END RSA PRIVATE KEY----- diff --git a/tests/Zend/Gdata/_files/TransparencyElementSample1.xml b/tests/Zend/Gdata/_files/TransparencyElementSample1.xml deleted file mode 100644 index fe9028df9..000000000 --- a/tests/Zend/Gdata/_files/TransparencyElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/VisibilityElementSample1.xml b/tests/Zend/Gdata/_files/VisibilityElementSample1.xml deleted file mode 100644 index 5c9c4b836..000000000 --- a/tests/Zend/Gdata/_files/VisibilityElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/WhenElementSample1.xml b/tests/Zend/Gdata/_files/WhenElementSample1.xml deleted file mode 100644 index 2ecf824de..000000000 --- a/tests/Zend/Gdata/_files/WhenElementSample1.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/Zend/Gdata/_files/WhereElementSample1.xml b/tests/Zend/Gdata/_files/WhereElementSample1.xml deleted file mode 100644 index 1b01f15b5..000000000 --- a/tests/Zend/Gdata/_files/WhereElementSample1.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/tests/Zend/Gdata/_files/WhoElementSample1.xml b/tests/Zend/Gdata/_files/WhoElementSample1.xml deleted file mode 100644 index 8df48804b..000000000 --- a/tests/Zend/Gdata/_files/WhoElementSample1.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tests/Zend/Gdata/_files/testImage.jpg b/tests/Zend/Gdata/_files/testImage.jpg deleted file mode 100644 index b378f7a39..000000000 Binary files a/tests/Zend/Gdata/_files/testImage.jpg and /dev/null differ diff --git a/tests/Zend/Tool/AllTests.php b/tests/Zend/Tool/AllTests.php deleted file mode 100644 index c7d39bddd..000000000 --- a/tests/Zend/Tool/AllTests.php +++ /dev/null @@ -1,60 +0,0 @@ -addTestSuite('Zend_Tool_Framework_AllTests'); - $suite->addTestSuite('Zend_Tool_Project_AllTests'); - - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Tool_AllTests::main') { - Zend_Tool_AllTests::main(); -} - diff --git a/tests/Zend/Tool/Framework/Action/BaseTest.php b/tests/Zend/Tool/Framework/Action/BaseTest.php deleted file mode 100644 index 312e5611f..000000000 --- a/tests/Zend/Tool/Framework/Action/BaseTest.php +++ /dev/null @@ -1,58 +0,0 @@ -assertEquals('Foo', $baseAction->getName()); - } - - public function testBaseActionCanGetAndSetName() - { - $baseAction = new Zend_Tool_Framework_Action_Base(); - $this->assertEquals('Base', $baseAction->getName()); - $baseAction->setName('Foo'); - $this->assertEquals('Foo', $baseAction->getName()); - } - - -} diff --git a/tests/Zend/Tool/Framework/Action/RepositoryTest.php b/tests/Zend/Tool/Framework/Action/RepositoryTest.php deleted file mode 100644 index 1cfa9637c..000000000 --- a/tests/Zend/Tool/Framework/Action/RepositoryTest.php +++ /dev/null @@ -1,144 +0,0 @@ -_repository = new Zend_Tool_Framework_Action_Repository(); - } - - public function teardown() - { - $this->_repository = null; - } - - public function testRepositoryIsEmpty() - { - $this->assertEquals(0, count($this->_repository)); - } - - public function testAddActionCanHandleActionObjects() - { - $fooAction = new Zend_Tool_Framework_Action_Base(); - $fooAction->setName('Foo'); - $this->_repository->addAction($fooAction); - - $this->assertEquals(1, count($this->_repository)); - $this->assertEquals('Zend_Tool_Framework_Action_Base', get_class($this->_repository->getAction('Foo'))); - } - - public function testAddActionWillParseNameFromClassNameOnExtendedActions() - { - $this->_repository->addAction(new Zend_Tool_Framework_Action_Foo()); - $this->assertEquals('Zend_Tool_Framework_Action_Foo', get_class($this->_repository->getAction('Foo'))); - } - - /** - * @expectedException Zend_Tool_Framework_Action_Exception - */ - public function testAddActionThrowsExceptionOnDuplicateNameAction() - { - $this->_repository->addAction(new Zend_Tool_Framework_Action_Foo()); - $this->_repository->addAction(new Zend_Tool_Framework_Action_Foo()); - } - - /** - * @expectedException Zend_Tool_Framework_Action_Exception - */ - public function testAddActionThrowsExceptionOnActionWithNoName() - { - $this->_repository->addAction(new Zend_Tool_Framework_Action_Base()); - } - - public function testGetActionReturnsNullOnNonExistentAction() - { - $this->assertNull($this->_repository->getAction('Foo')); - } - - public function testRepositoryIsCountable() - { - $this->assertTrue($this->_repository instanceof Countable); - } - - public function testRepositoryIsIterable() - { - $this->assertTrue($this->_repository instanceof Traversable); - } - - public function testRepositoryCanIterate() - { - $this->_repository->addAction(new Zend_Tool_Framework_Action_Base('Foo')); - $this->_repository->addAction(new Zend_Tool_Framework_Action_Base('Bar')); - $i=0; - foreach ($this->_repository as $action) { - $i++; - $this->assertEquals('Zend_Tool_Framework_Action_Base', get_class($action)); - } - $this->assertEquals(2, $i); - } - - public function testGetActionsReturnsAnArrayOfActions() - { - $this->_repository->addAction(new Zend_Tool_Framework_Action_Base('Foo')); - $this->_repository->addAction(new Zend_Tool_Framework_Action_Base('Bar')); - $i=0; - foreach ($this->_repository->getActions() as $action) { - $i++; - $this->assertEquals('Zend_Tool_Framework_Action_Base', get_class($action)); - } - $this->assertEquals(2, $i); - } - - public function testProcessMethodReturnsNull() - { - $this->assertNull($this->_repository->process()); - } - - - -} diff --git a/tests/Zend/Tool/Framework/Action/_files/Foo.php b/tests/Zend/Tool/Framework/Action/_files/Foo.php deleted file mode 100644 index 6e904b4f9..000000000 --- a/tests/Zend/Tool/Framework/Action/_files/Foo.php +++ /dev/null @@ -1,41 +0,0 @@ -addTestSuite('Zend_Tool_Framework_RegistryTest'); - $suite->addTestSuite('Zend_Tool_Framework_Action_BaseTest'); - $suite->addTestSuite('Zend_Tool_Framework_Action_RepositoryTest'); - $suite->addTestSuite('Zend_Tool_Framework_Client_RequestTest'); - $suite->addTestSuite('Zend_Tool_Framework_Client_ResponseTest'); - //$suite->addTestSuite('Zend_Tool_Framework_Manifest_MetadataTest'); - //$suite->addTestSuite('Zend_Tool_Framework_Manifest_ProviderMetadataTest'); - //$suite->addTestSuite('Zend_Tool_Framework_Manifest_ActionMetadataTest'); - $suite->addTestSuite('Zend_Tool_Framework_Manifest_RepositoryTest'); - $suite->addTestSuite('Zend_Tool_Framework_Provider_AbstractTest'); - $suite->addTestSuite('Zend_Tool_Framework_Provider_RepositoryTest'); - $suite->addTestSuite('Zend_Tool_Framework_Provider_SignatureTest'); - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Tool_Framework_AllTests::main') { - Zend_Tool_Framework_AllTests::main(); -} diff --git a/tests/Zend/Tool/Framework/Client/Console/ArgumentParserTest.php b/tests/Zend/Tool/Framework/Client/Console/ArgumentParserTest.php deleted file mode 100644 index d3c64ea8c..000000000 --- a/tests/Zend/Tool/Framework/Client/Console/ArgumentParserTest.php +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/tests/Zend/Tool/Framework/Client/Console/HelpSystemTest.php b/tests/Zend/Tool/Framework/Client/Console/HelpSystemTest.php deleted file mode 100644 index d3c64ea8c..000000000 --- a/tests/Zend/Tool/Framework/Client/Console/HelpSystemTest.php +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/tests/Zend/Tool/Framework/Client/RequestTest.php b/tests/Zend/Tool/Framework/Client/RequestTest.php deleted file mode 100644 index 3ec698ad3..000000000 --- a/tests/Zend/Tool/Framework/Client/RequestTest.php +++ /dev/null @@ -1,115 +0,0 @@ -_request = new Zend_Tool_Framework_Client_Request(); - } - - public function testProviderNameGetterAndSetter() - { - $this->_request->setProviderName('foo'); - $this->assertEquals('foo', $this->_request->getProviderName()); - } - - public function testSpecialtyNameGetterAndSetter() - { - $this->_request->setSpecialtyName('foo'); - $this->assertEquals('foo', $this->_request->getSpecialtyName()); - } - - public function testActionNameGetterAndSetter() - { - $this->_request->setActionName('foo'); - $this->assertEquals('foo', $this->_request->getActionName()); - } - - public function testActionParametersGetterAndSetter() - { - $this->_request->setActionParameter('foo', 'bar'); - $this->_request->setActionParameter('bar', 'baz'); - $this->assertEquals('bar', $this->_request->getActionParameter('foo')); - $this->assertArrayHasKey('foo', $this->_request->getActionParameters()); - $this->assertArrayHasKey('bar', $this->_request->getActionParameters()); - $this->assertEquals(2, count($this->_request->getActionParameters())); - } - - public function testProviderParameterGetterAndSetter() - { - $this->_request->setProviderParameter('foo', 'bar'); - $this->_request->setProviderParameter('bar', 'baz'); - $this->assertEquals('bar', $this->_request->getProviderParameter('foo')); - $this->assertArrayHasKey('foo', $this->_request->getProviderParameters()); - $this->assertArrayHasKey('bar', $this->_request->getProviderParameters()); - $this->assertEquals(2, count($this->_request->getProviderParameters())); - } - - public function testPretendGetterAndSetter() - { - $this->assertFalse($this->_request->isPretend()); - $this->_request->setPretend(true); - $this->assertTrue($this->_request->isPretend()); - } - - public function testDispatchableGetterAndSetter() - { - $this->assertTrue($this->_request->isDispatchable()); - $this->_request->setDispatchable(false); - $this->assertFalse($this->_request->isDispatchable()); - } - - /* - protected $_providerName = null; - protected $_specialtyName = null; - protected $_actionName = null; - protected $_actionParameters = array(); - protected $_providerParameters = array(); - protected $_isPretend = false; - protected $_isDispatchable = true; - */ - -} diff --git a/tests/Zend/Tool/Framework/Client/ResponseTest.php b/tests/Zend/Tool/Framework/Client/ResponseTest.php deleted file mode 100644 index 392dd3750..000000000 --- a/tests/Zend/Tool/Framework/Client/ResponseTest.php +++ /dev/null @@ -1,152 +0,0 @@ -_response = new Zend_Tool_Framework_Client_Response(); - } - - public function testContentGetterAndSetter() - { - $this->_response->setContent('foo'); - $this->assertEquals('foo', $this->_response->getContent()); - - $this->_response->setContent('bar'); - $this->assertEquals('bar', $this->_response->getContent()); - } - - public function testContentCanBeAppended() - { - $this->_response->setContent('foo'); - $this->assertEquals('foo', $this->_response->getContent()); - - $this->_response->setContent('bar'); - $this->assertEquals('bar', $this->_response->getContent()); - - $this->_response->appendContent('foo'); - $this->assertEquals('barfoo', $this->_response->getContent()); - } - - public function testContentCallback() - { - $this->_response->setContentCallback(array($this, '_responseCallback')); - $this->_response->appendContent('foo'); - $this->assertEquals('foo', implode('', $this->_responseBuffer)); - $this->_response->appendContent('bar'); - $this->_response->appendContent('baz'); - $this->assertEquals('foo-bar-baz', implode('-', $this->_responseBuffer)); - } - - public function testExceptionHandling() - { - $this->assertFalse($this->_response->isException()); - $this->_response->setException(new Exception('my response exception')); - $this->assertTrue($this->_response->isException()); - $this->assertEquals('my response exception', $this->_response->getException()->getMessage()); - } - - /** - * @expectedException Zend_Tool_Framework_Client_Exception - */ - public function testSetCallbackThrowsExceptionOnInvalidCallback() - { - $this->_response->setContentCallback(5); - } - - public function testCastingToString() - { - $this->_response->appendContent('foo'); - $this->_response->appendContent('boo'); - $this->assertEquals('fooboo', $this->_response->__toString()); - } - - public function testAddContentDecoratorPersistsDecorators() - { - $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); - $this->_response->addContentDecorator($separator); - $decorators = $this->_response->getContentDecorators(); - $this->assertArrayHasKey('separator', $decorators); - $this->assertContains($separator, $decorators); - } - - public function testResponseWillApplyDecorator() - { - $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); - $this->_response->addContentDecorator($separator); - $this->_response->appendContent('foo', array('separator' => true)); - $this->_response->appendContent('boo', array('separator' => true)); - $this->assertEquals('foo' . PHP_EOL . 'boo' . PHP_EOL, $this->_response->__toString()); - } - - public function testResponseWillIgnoreUnknownDecoratorOptions() - { - $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); - $this->_response->addContentDecorator($separator); - $this->_response->appendContent('foo', array('foo' => 'foo')); - $this->_response->appendContent('boo', array('bar' => 'bar')); - $this->assertEquals('fooboo', $this->_response->__toString()); - } - - public function testResponseWillApplyDecoratorWithDefaultOptions() - { - $separator = new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator(); - $this->_response->addContentDecorator($separator); - $this->_response->setDefaultDecoratorOptions(array('separator' => true)); - $this->_response->appendContent('foo'); - $this->_response->appendContent('boo'); - $this->assertEquals('foo' . PHP_EOL . 'boo' . PHP_EOL, $this->_response->__toString()); - } - - public function _responseCallback($content) - { - $this->_responseBuffer[] = $content; - } -} diff --git a/tests/Zend/Tool/Framework/Loader/IncludePathLoaderTest.php b/tests/Zend/Tool/Framework/Loader/IncludePathLoaderTest.php deleted file mode 100644 index ca1a0b2e4..000000000 --- a/tests/Zend/Tool/Framework/Loader/IncludePathLoaderTest.php +++ /dev/null @@ -1,83 +0,0 @@ -load(); - $files = $loader->getLoadRetrievedFiles(); - foreach ($files as $index => $file) { - $files[$index] = substr((string) $file, strpos((string) $file, 'Zend')); - } - $this->assertContains('Zend/Tool/Framework/System/Manifest.php', $files); - } - - public function testLoaderFindsIncludePathFilesAreLoaded() - { - $loader = new Zend_Tool_Framework_Loader_IncludePathLoader(); - $loader->load(); - $classes = $loader->getLoadLoadedClasses(); - $this->assertContains('Zend_Tool_Framework_System_Manifest', $classes); - } - - */ - -} diff --git a/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php b/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php deleted file mode 100644 index 37c32d1bd..000000000 --- a/tests/Zend/Tool/Framework/Manifest/ProviderMetadataTest.php +++ /dev/null @@ -1,133 +0,0 @@ -_metadata = new Zend_Tool_Framework_Manifest_ProviderMetadata(); - } - - public function teardown() - { - $this->_metadata = null; - } - - public function testInitialTypeNameIsCorrect() - { - $this->assertEquals('Provider', $this->_metadata->getType()); - } - - public function testConstructorWillAcceptAndPersistValues() - { - $obj1 = new ArrayObject(); - - $metadata = new Zend_Tool_Framework_Manifest_ProviderMetadata(array( - 'name' => 'Foo', - 'providerName' => 'FooBar', - 'actionName' => 'BarBaz', - 'specialtyName' => 'FooBarBaz', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Foo', $metadata->getName()); - $this->assertEquals('FooBar', $metadata->getProviderName()); - $this->assertEquals('BarBaz', $metadata->getActionName()); - $this->assertEquals('FooBarBaz', $metadata->getSpecialtyName()); - $this->assertEquals('Bar', $metadata->getValue()); - $this->assertTrue($obj1 === $metadata->getReference()); - } - - public function testSetOptionsPersistValues() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'providerName' => 'FooBar', - 'actionName' => 'BarBaz', - 'specialtyName' => 'FooBarBaz', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Foo', $this->_metadata->getName()); - $this->assertEquals('FooBar', $this->_metadata->getProviderName()); - $this->assertEquals('BarBaz', $this->_metadata->getActionName()); - $this->assertEquals('FooBarBaz', $this->_metadata->getSpecialtyName()); - $this->assertEquals('Bar', $this->_metadata->getValue()); - $this->assertTrue($obj1 === $this->_metadata->getReference()); - } - - public function testSettersPersistValuesAndAreRetievableThroughGetters() - { - $this->_metadata->setProviderName('Foo'); - $this->assertEquals('Foo', $this->_metadata->getProviderName()); - - $this->_metadata->setActionName('Bar'); - $this->assertEquals('Bar', $this->_metadata->getActionName()); - - $this->_metadata->setSpecialtyName('FooBar'); - $this->assertEquals('FooBar', $this->_metadata->getSpecialtyName()); - } - - public function testMetadataObjectCanCastToStringRepresentation() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'providerName' => 'FooBar', - 'actionName' => 'BarBaz', - 'specialtyName' => 'FooBarBaz', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Type: Provider, Name: Foo, Value: Bar (ProviderName: FooBar, ActionName: BarBaz, SpecialtyName: FooBarBaz)', (string) $this->_metadata); - } - -} diff --git a/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php b/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php deleted file mode 100644 index b6c5e137b..000000000 --- a/tests/Zend/Tool/Framework/Manifest/RepositoryTest.php +++ /dev/null @@ -1,261 +0,0 @@ -_repository = new Zend_Tool_Framework_Manifest_Repository(); - - // setup the registry components required to test with - $this->_registry = new Zend_Tool_Framework_Registry(); - $this->_registry->setProviderRepository(new Zend_Tool_Framework_Provider_Repository()); - $this->_registry->setActionRepository(new Zend_Tool_Framework_Action_Repository()); - $this->_registry->setManifestRepository($this->_repository); - } - - public function teardown() - { - $this->_registry->reset(); - $this->_repository = null; - } - - public function testAddManfestsWillPersistManifests() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodOne()); - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodTwo()); - $this->assertEquals(2, count($this->_repository->getManifests())); - - $actionRepository = $this->_registry->getActionRepository(); - $actionRepository->process(); - - $providerRepository = $this->_registry->getProviderRepository(); - $providerRepository->process(); - - $actions = $actionRepository->getActions(); - $this->assertArrayHasKey('actionone', $actions); - $this->assertArrayHasKey('actiontwo', $actions); - $this->assertArrayHasKey('foo', $actions); - - $providers = $providerRepository->getProviders(); - $this->assertArrayHasKey('providerone', $providers); - $this->assertArrayHasKey('providertwo', $providers); - - } - - public function testAddManfestsWillPersistManifestsAndObeyIndex() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodTwo()); - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodOne()); - - - $manifests = $this->_repository->getManifests(); - - $this->assertEquals(2, count($manifests)); - $this->assertTrue(array_shift($manifests) instanceof Zend_Tool_Framework_Manifest_ManifestGoodOne); - $this->assertTrue(array_shift($manifests) instanceof Zend_Tool_Framework_Manifest_ManifestGoodTwo); - - } - - /** - * @expectedException Zend_Tool_Framework_Manifest_Exception - */ - public function testAddManifestThrowsExceptionOnBadGetProviders() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestBadProvider()); - } - - public function testProcessAddsMetadataToManifest() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodTwo()); - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodOne()); - $this->_repository->process(); - - //die(); // @todo ensure that we check whats actually in the repository - $this->assertEquals(3, count($this->_repository)); - $this->assertEquals(2, count($this->_repository->getManifests())); - } - - /** - * @expectedException Zend_Tool_Framework_Manifest_Exception - */ - public function testProcessThrowsExceptionOnBadMetadata() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestBadMetadata()); - $this->_repository->process(); - } - - public function testRepositoryIsCastableToString() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodTwo()); - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodOne()); - $this->_repository->process(); - - $expected = 'Basic' . PHP_EOL . ' Type: Basic, Name: FooOne, Value: Bar' . PHP_EOL - . ' Type: Basic, Name: FooTwo, Value: Baz1' . PHP_EOL - . ' Type: Basic, Name: FooThree, Value: Baz2' . PHP_EOL; - - $this->assertEquals($expected, (string) $this->_repository); - } - - public function testRepositoryIsCountable() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodOne()); - $this->_repository->process(); - - $this->assertTrue($this->_repository instanceof Countable); - $this->assertEquals(1, count($this->_repository)); - } - - public function testRepositoryIsIterable() - { - $this->_repository->addManifest(new Zend_Tool_Framework_Manifest_ManifestGoodOne()); - $this->_repository->process(); - - $this->assertTrue($this->_repository instanceof Traversable); - foreach ($this->_repository as $thing) { - $this->assertTrue(true); - } - } - - public function testManifestGetMetadatasCollectionSearchWorks() - { - $metadata1 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Foo', - 'value' => 'Bar', - )); - - $metadata2 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Bar', - 'value' => 'Baz', - )); - - $metadata3 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Baz', - 'value' => 'Foo', - )); - - $this->_repository->addMetadata($metadata1); - $this->_repository->addMetadata($metadata2); - $this->_repository->addMetadata($metadata3); - - $resultMetadatas = $this->_repository->getMetadatas(array('name' => 'Bar')); - $this->assertEquals(1, count($resultMetadatas)); - $this->assertTrue($metadata2 === array_shift($resultMetadatas)); - - - } - - public function testManifestGetMetadataSingularSearchWorks() - { - $metadata1 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Foo', - 'value' => 'Bar', - )); - - $metadata2 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Bar', - 'value' => 'Baz', - )); - - $metadata3 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Baz', - 'value' => 'Foo', - )); - - $this->_repository->addMetadata($metadata1); - $this->_repository->addMetadata($metadata2); - $this->_repository->addMetadata($metadata3); - - $resultMetadata = $this->_repository->getMetadata(array('name' => 'Baz')); - $this->assertTrue($metadata3 === $resultMetadata); - - } - - public function testManifestGetMetadatasCollectionSearchWorksWithNonExistentProperties() - { - $metadata1 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Foo', - 'value' => 'Bar', - )); - - $metadata2 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Bar', - 'value' => 'Baz', - )); - - $metadata3 = new Zend_Tool_Framework_Metadata_Basic(array( - 'name' => 'Baz', - 'value' => 'Foo', - )); - - $this->_repository->addMetadata($metadata1); - $this->_repository->addMetadata($metadata2); - $this->_repository->addMetadata($metadata3); - - $resultMetadatas = $this->_repository->getMetadatas(array('name' => 'Bar', 'blah' => 'boo')); - $this->assertEquals(1, count($resultMetadatas)); - - $resultMetadatas = $this->_repository->getMetadatas(array('name' => 'Bar', 'blah' => 'boo'), false); - $this->assertEquals(0, count($resultMetadatas)); - //$this->assertTrue($metadata2 === array_shift($resultMetadatas)); - - } - -} diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ActionOne.php b/tests/Zend/Tool/Framework/Manifest/_files/ActionOne.php deleted file mode 100644 index 880a8e8cc..000000000 --- a/tests/Zend/Tool/Framework/Manifest/_files/ActionOne.php +++ /dev/null @@ -1,39 +0,0 @@ - 'FooTwo', 'value' => 'Baz1')), - new ArrayObject() - ); - - } - -} diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadProvider.php b/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadProvider.php deleted file mode 100644 index ea740aeb6..000000000 --- a/tests/Zend/Tool/Framework/Manifest/_files/ManifestBadProvider.php +++ /dev/null @@ -1,49 +0,0 @@ - 'FooOne', 'value' => 'Bar')); - } - -} diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php b/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php deleted file mode 100644 index d23e90a87..000000000 --- a/tests/Zend/Tool/Framework/Manifest/_files/ManifestGoodTwo.php +++ /dev/null @@ -1,84 +0,0 @@ -_registry = $registry; - } - - public function getIndex() - { - return 10; - } - - public function getProviders() - { - return array( - new Zend_Tool_Framework_Manifest_ProviderTwo() - ); - } - - public function getActions() - { - return array( - new Zend_Tool_Framework_Manifest_ActionTwo(), - 'Foo' - ); - } - - public function getMetadata() - { - return array( - new Zend_Tool_Framework_Metadata_Basic(array('name' => 'FooTwo', 'value' => 'Baz1')), - new Zend_Tool_Framework_Metadata_Basic(array('name' => 'FooThree', 'value' => 'Baz2')) - ); - - } - -} diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ProviderOne.php b/tests/Zend/Tool/Framework/Manifest/_files/ProviderOne.php deleted file mode 100644 index 9e5364d2c..000000000 --- a/tests/Zend/Tool/Framework/Manifest/_files/ProviderOne.php +++ /dev/null @@ -1,45 +0,0 @@ -_registry = $registry; - } - -} diff --git a/tests/Zend/Tool/Framework/Manifest/_files/ProviderTwo.php b/tests/Zend/Tool/Framework/Manifest/_files/ProviderTwo.php deleted file mode 100644 index ed2b4f753..000000000 --- a/tests/Zend/Tool/Framework/Manifest/_files/ProviderTwo.php +++ /dev/null @@ -1,36 +0,0 @@ -_metadata = new Zend_Tool_Framework_Manifest_ActionMetadata(); - } - - public function teardown() - { - $this->_metadata = null; - } - - public function testInitialTypeNameIsCorrect() - { - $this->assertEquals('Action', $this->_metadata->getType()); - } - - public function testConstructorWillAcceptAndPersistValues() - { - $obj1 = new ArrayObject(); - - $metadata = new Zend_Tool_Framework_Manifest_ActionMetadata(array( - 'name' => 'Foo', - 'actionName' => 'BarBaz', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Foo', $metadata->getName()); - $this->assertEquals('BarBaz', $metadata->getActionName()); - $this->assertEquals('Bar', $metadata->getValue()); - $this->assertTrue($obj1 === $metadata->getReference()); - } - - public function testSetOptionsPersistValues() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'actionName' => 'BarBaz', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Foo', $this->_metadata->getName()); - $this->assertEquals('BarBaz', $this->_metadata->getActionName()); - $this->assertEquals('Bar', $this->_metadata->getValue()); - $this->assertTrue($obj1 === $this->_metadata->getReference()); - } - - public function testSettersPersistValuesAndAreRetievableThroughGetters() - { - $this->_metadata->setActionName('Bar'); - $this->assertEquals('Bar', $this->_metadata->getActionName()); - } - - public function testMetadataObjectCanCastToStringRepresentation() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'actionName' => 'BarBaz', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Type: Action, Name: Foo, Value: Bar (ActionName: BarBaz)', (string) $this->_metadata); - } - -} diff --git a/tests/Zend/Tool/Framework/Metadata/MetadataTest.php b/tests/Zend/Tool/Framework/Metadata/MetadataTest.php deleted file mode 100644 index 2f25001c1..000000000 --- a/tests/Zend/Tool/Framework/Metadata/MetadataTest.php +++ /dev/null @@ -1,155 +0,0 @@ -_metadata = new Zend_Tool_Framework_Manifest_Metadata(); - } - - public function teardown() - { - $this->_metadata = null; - } - - public function testConstructorWillAcceptAndPersistValues() - { - $obj1 = new ArrayObject(); - - $metadata = new Zend_Tool_Framework_Manifest_Metadata(array( - 'name' => 'Foo', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Foo', $metadata->getName()); - $this->assertEquals('Bar', $metadata->getValue()); - $this->assertTrue($obj1 === $metadata->getReference()); - } - - public function testSetOptionsPersistValues() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Foo', $this->_metadata->getName()); - $this->assertEquals('Bar', $this->_metadata->getValue()); - $this->assertTrue($obj1 === $this->_metadata->getReference()); - } - - public function testGetTypeHasDefaultValue() - { - $this->assertEquals('Global', $this->_metadata->getType()); - } - - public function testTypeIsModifiable() - { - $this->_metadata->setType('foo'); - $this->assertEquals('foo', $this->_metadata->getType()); - } - - public function testSettersPersistValuesAndAreRetievableThroughGetters() - { - $this->_metadata->setName('Foo'); - $this->assertEquals('Foo', $this->_metadata->getName()); - $this->_metadata->setValue('Bar'); - $this->assertEquals('Bar', $this->_metadata->getValue()); - } - - public function testGetAttributesReturnsProperValues() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'value' => null, - 'reference' => $obj1 - )); - - $attributes = $this->_metadata->getAttributes(); - - $this->assertEquals(4, count($attributes)); - - $this->assertEquals('Global', $attributes['type']); - $this->assertEquals('Foo', $attributes['name']); - $this->assertEquals(null, $attributes['value']); - $this->assertTrue($obj1 === $attributes['reference']); - - $attributes = $this->_metadata->getAttributes(Zend_Tool_Framework_Manifest_Metadata::ATTRIBUTES_NO_PARENT); - - $this->assertEquals(0, count($attributes)); - - - $attributes = $this->_metadata->getAttributes(Zend_Tool_Framework_Manifest_Metadata::ATTRIBUTES_ALL, true); - - $this->assertEquals(4, count($attributes)); - - $this->assertEquals('Global', $attributes['type']); - $this->assertEquals('Foo', $attributes['name']); - $this->assertEquals('(null)', $attributes['value']); - $this->assertEquals('(object)', $attributes['reference']); - - } - - public function testMetadataObjectCanCastToStringRepresentation() - { - $obj1 = new ArrayObject(); - - $this->_metadata->setOptions(array( - 'name' => 'Foo', - 'value' => 'Bar', - 'reference' => $obj1 - )); - - $this->assertEquals('Type: Global, Name: Foo, Value: Bar', (string) $this->_metadata); - } - -} diff --git a/tests/Zend/Tool/Framework/Provider/AbstractTest.php b/tests/Zend/Tool/Framework/Provider/AbstractTest.php deleted file mode 100644 index 3eb639415..000000000 --- a/tests/Zend/Tool/Framework/Provider/AbstractTest.php +++ /dev/null @@ -1,67 +0,0 @@ -_request = new Zend_Tool_Framework_Client_Request(); - $this->_response = new Zend_Tool_Framework_Client_Response(); - $this->_registry = new Zend_Tool_Framework_Registry(); - - $this->_registry->setRequest($this->_request); - $this->_registry->setResponse($this->_response); - } - - public function testAbsractReturnsRequestAndResponse() - { - $provider = new Zend_Tool_Framework_Provider_ProviderFullFeatured(); - $provider->setRegistry($this->_registry); - $returnInternals = $provider->_testReturnInternals(); - $this->assertTrue(array_shift($returnInternals) === $this->_request); - $this->assertTrue(array_shift($returnInternals) === $this->_response); - } - -} diff --git a/tests/Zend/Tool/Framework/Provider/RepositoryTest.php b/tests/Zend/Tool/Framework/Provider/RepositoryTest.php deleted file mode 100644 index e2815afda..000000000 --- a/tests/Zend/Tool/Framework/Provider/RepositoryTest.php +++ /dev/null @@ -1,175 +0,0 @@ -_repository = new Zend_Tool_Framework_Provider_Repository(); - - // setup the registry components required to test with - $this->_registry = new Zend_Tool_Framework_Registry(); - $this->_registry->setProviderRepository($this->_repository); - $this->_registry->setActionRepository(new Zend_Tool_Framework_Action_Repository()); - } - - public function teardown() - { - $this->_registry->reset(); - $this->_repository = null; - } - - public function testRepositoryIsEmpty() - { - $this->assertEquals(0, count($this->_repository)); - } - - public function testAddProviderCanHandleProviderObjects() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - $this->_repository->process(); - $this->assertEquals(2, count($this->_repository)); - } - - public function testAddProviderCanHandleProviderWithAlternateName() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderAltName()); - $this->_repository->process(); - $this->assertEquals(3, count($this->_repository)); - $this->assertEquals('FooBar', $this->_repository->getProviderSignature('FooBar')->getName()); - } - - /** - * @expectedException Zend_Tool_Framework_Provider_Exception - */ - public function testAddProviderThrowsExceptionOnDuplicateName() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - } - - public function testAddProviderWillProcessOnCall() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - $this->_repository->process(); - $this->_repository->setProcessOnAdd(true); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderAltName()); - $this->assertEquals(3, count($this->_repository)); - $this->assertEquals('FooBar', $this->_repository->getProviderSignature('FooBar')->getName()); - } - - public function testGetProvidersReturnsProviders() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - $this->_repository->process(); - $this->assertEquals(2, count($this->_repository)); - foreach ($this->_repository->getProviders() as $provider) { - $this->assertTrue($provider instanceof Zend_Tool_Framework_Provider_Interface); - } - - } - - public function testGetProviderSignaturesReturnsProviderSignatures() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - $this->_repository->process(); - $this->assertEquals(2, count($this->_repository)); - foreach ($this->_repository->getProviderSignatures() as $providerSignature) { - $this->assertTrue($providerSignature instanceof Zend_Tool_Framework_Provider_Signature); - } - - } - - public function testHasProviderReturnsCorrectValues() - { - $this->_repository->addProvider(($providerOne = new Zend_Tool_Framework_Provider_ProviderOne())); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - - $this->assertTrue($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderOne', false)); - $this->assertTrue($this->_repository->hasProvider($providerOne, false)); - $this->assertTrue($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderTwo', false)); - $this->assertFalse($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderThree', false)); - $this->assertFalse($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderOne')); - - $this->_repository->process(); - $this->assertTrue($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderOne', false)); - $this->assertTrue($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderOne')); - $this->assertFalse($this->_repository->hasProvider('Zend_Tool_Framework_Provider_ProviderThree')); - } - - public function testGetProviderReturnsProvider() - { - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderOne()); - $this->_repository->addProvider(new Zend_Tool_Framework_Provider_ProviderTwo()); - $this->_repository->process(); - $this->assertTrue($this->_repository->getProvider('ProviderOne') instanceof Zend_Tool_Framework_Provider_Interface); - } - - - public function testRepositoryIsCountable() - { - $this->assertTrue($this->_repository instanceof Countable); - } - - public function testRepositoryIsIterable() - { - $this->assertTrue($this->_repository instanceof Traversable); - foreach ($this->_repository as $provider) { - $this->assertTrue(true); - } - } - -} diff --git a/tests/Zend/Tool/Framework/Provider/SignatureTest.php b/tests/Zend/Tool/Framework/Provider/SignatureTest.php deleted file mode 100644 index 697d14adb..000000000 --- a/tests/Zend/Tool/Framework/Provider/SignatureTest.php +++ /dev/null @@ -1,185 +0,0 @@ -_registry = new Zend_Tool_Framework_Registry(); - $this->_registry->setActionRepository(new Zend_Tool_Framework_Action_Repository()); - $this->_targetSignature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderFullFeatured()); - $this->_targetSignature->setRegistry($this->_registry); - $this->_targetSignature->process(); - } - - public function teardown() - { - $this->_registry->reset(); - } - - public function testSignatureCanBeCreatedFromProvider() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderOne()); - $signature->setRegistry($this->_registry); - $signature->process(); - $signature->process(); - $this->assertEquals('ProviderOne', $signature->getName()); - } - - public function testSignatureCanBeCreatedFromProviderWhenOverridingName() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderFullFeatured()); - $signature->setRegistry($this->_registry); - $signature->process(); - $this->assertEquals('FooBarBaz', $signature->getName()); - } - - public function testGetProviderReturnsProvider() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderOne()); - $signature->setRegistry($this->_registry); - $signature->process(); - $this->assertTrue($signature->getProvider() instanceof Zend_Tool_Framework_Provider_ProviderOne); - } - - public function testGetProviderReflectionWillReturnZendReflectionClassObject() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderOne()); - $signature->setRegistry($this->_registry); - $signature->process(); - $this->assertTrue($signature->getProviderReflection() instanceof Zend_Reflection_Class); - } - - public function testGetSpecialtiesReturnsParsedSpecialties() - { - $this->assertEquals(array('_Global', 'Hi', 'BloodyMurder', 'ForYourTeam'), $this->_targetSignature->getSpecialties()); - } - - public function testGetSpecialtiesReturnsParsedSpecialtiesFromMethodInsteadOfProperty() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderFullFeatured2()); - $signature->setRegistry($this->_registry); - $signature->process(); - $this->assertEquals(array('_Global', 'Hi', 'BloodyMurder', 'ForYourTeam'), $signature->getSpecialties()); - } - - /** - * @expectedException Zend_Tool_Framework_Provider_Exception - */ - public function testGetSpecialtiesReturnsParsedSpecialtiesThrowsExceptionOnBadPropertyValue() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderFullFeaturedBadSpecialties()); - $signature->setRegistry($this->_registry); - $signature->process(); - } - - /** - * @expectedException Zend_Tool_Framework_Provider_Exception - */ - public function testGetSpecialtiesReturnsParsedSpecialtiesThrowsExceptionOnBadReturnValue() - { - $signature = new Zend_Tool_Framework_Provider_Signature(new Zend_Tool_Framework_Provider_ProviderFullFeaturedBadSpecialties2()); - $signature->setRegistry($this->_registry); - $signature->process(); - } - - public function testGetActionsWillReturnProperActions() - { - $actionArray = $this->_targetSignature->getActions(); - $action = array_shift($actionArray); - $this->assertTrue($action instanceof Zend_Tool_Framework_Action_Base); - $this->assertEquals('Say', $action->getName()); - $action = array_shift($actionArray); - $this->assertTrue($action instanceof Zend_Tool_Framework_Action_Base); - $this->assertEquals('Scream', $action->getName()); - } - - public function testGetActionableMethodsReturnsAllActionableMethods() - { - $this->assertEquals(5, count($this->_targetSignature->getActionableMethods())); - - $actionableMethods = $this->_targetSignature->getActionableMethods(); - $actionableMethod = array_shift($actionableMethods); - $this->assertEquals('say', $actionableMethod['methodName']); - $actionableMethod = array_shift($actionableMethods); - $this->assertEquals('scream', $actionableMethod['methodName']); - $actionableMethod = array_shift($actionableMethods); - $this->assertEquals('sayHi', $actionableMethod['methodName']); - $actionableMethod = array_shift($actionableMethods); - $this->assertEquals('screamBloodyMurder', $actionableMethod['methodName']); - $actionableMethod = array_shift($actionableMethods); - $this->assertEquals('screamForYourTeam', $actionableMethod['methodName']); - } - - public function testGetActionableMethodReturnsCorrectActionableMethod() - { - $actionableMethod = $this->_targetSignature->getActionableMethod('scream'); - $this->assertEquals('Scream', $actionableMethod['actionName']); - - $this->assertFalse($this->_targetSignature->getActionableMethod('Foo')); - } - - public function testGetActionableMethodByActionNameReturnsCorrectActionableMethod() - { - $actionableMethod = $this->_targetSignature->getActionableMethodByActionName('Scream'); - $this->assertEquals('scream', $actionableMethod['methodName']); - - $this->assertFalse($this->_targetSignature->getActionableMethodByActionName('Foo')); - } - -} diff --git a/tests/Zend/Tool/Framework/Provider/_files/ProviderAltName.php b/tests/Zend/Tool/Framework/Provider/_files/ProviderAltName.php deleted file mode 100644 index fa98ac42c..000000000 --- a/tests/Zend/Tool/Framework/Provider/_files/ProviderAltName.php +++ /dev/null @@ -1,39 +0,0 @@ -_registry->getRequest(), $this->_registry->getResponse()); - } - -} - diff --git a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php b/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php deleted file mode 100644 index 1536cbd32..000000000 --- a/tests/Zend/Tool/Framework/Provider/_files/ProviderFullFeatured2.php +++ /dev/null @@ -1,82 +0,0 @@ -_registry = new Zend_Tool_Framework_Registry(); - } - - public function teardown() - { - $this->_registry->reset(); - } - - public function testRegistryCanGetAndSetClient() - { - $this->assertNull($this->_registry->getClient()); - $this->_registry->setClient($client = new Zend_Tool_Framework_EmptyClient()); - $this->assertTrue($this->_registry->getClient() === $client); - } - - public function testRegistryCanGetAndSetLoader() - { - $this->assertTrue($this->_registry->getLoader() instanceof Zend_Tool_Framework_Loader_Abstract); - $this->_registry->setLoader($loader = new Zend_Tool_Framework_EmptyLoader()); - $this->assertTrue($this->_registry->getLoader() === $loader); - } - - public function testRegistryCanGetAndSetActionRepository() - { - $this->assertTrue($this->_registry->getActionRepository() instanceof Zend_Tool_Framework_Action_Repository); - $this->_registry->setActionRepository($repo = new Zend_Tool_Framework_Action_Repository()); - $this->assertTrue($this->_registry->getActionRepository() === $repo); - } - - public function testRegistryCanGetAndSetProviderRepository() - { - $this->assertTrue($this->_registry->getProviderRepository() instanceof Zend_Tool_Framework_Provider_Repository); - $this->_registry->setProviderRepository($repo = new Zend_Tool_Framework_Provider_Repository()); - $this->assertTrue($this->_registry->getProviderRepository() === $repo); - } - - public function testRegistryCanGetAndSetManifestRepository() - { - $this->assertTrue($this->_registry->getManifestRepository() instanceof Zend_Tool_Framework_Manifest_Repository); - $this->_registry->setManifestRepository($repo = new Zend_Tool_Framework_Manifest_Repository()); - $this->assertTrue($this->_registry->getManifestRepository() === $repo); - } - - public function testRegistryCanGetAndSetRequest() - { - $this->assertTrue($this->_registry->getRequest() instanceof Zend_Tool_Framework_Client_Request); - $this->_registry->setRequest($req = new Zend_Tool_Framework_Client_Request()); - $this->assertTrue($this->_registry->getRequest() === $req); - } - - public function testRegistryCanGetAndSetResponse() - { - $this->assertTrue($this->_registry->getResponse() instanceof Zend_Tool_Framework_Client_Response); - $this->_registry->setResponse($resp = new Zend_Tool_Framework_Client_Response()); - $this->assertTrue($this->_registry->getResponse() === $resp); - } - - public function testMagicGetAndSetOfRegistryItems() - { - $this->assertTrue($this->_registry->request instanceof Zend_Tool_Framework_Client_Request); - $this->_registry->request = new Zend_Tool_Framework_Client_Request(); - $this->assertTrue($this->_registry->request instanceof Zend_Tool_Framework_Client_Request); - } - - /** - * @expectedException Zend_Tool_Framework_Exception - */ - public function testMagicGetThrowsExceptionOnNonExistentItem() - { - $foo = $this->_registry->foo; - } - - /** - * @expectedException Zend_Tool_Framework_Exception - */ - public function testMagicSetThrowsExceptionOnNonExistentItem() - { - $this->_registry->foo = 'foo'; - } - - /** - * @expectedException Zend_Tool_Framework_Exception - */ - public function testIsObjectRegistryEnablableWillThrowExceptionsOnNonObject() - { - $this->_registry->isObjectRegistryEnablable('foo'); - } - - /** - * @expectedException Zend_Tool_Framework_Exception - */ - public function testEnableRegistryOnObjectWillThrowExceptionsOnNonObject() - { - $this->_registry->enableRegistryOnObject(new ArrayObject()); - } - -} - diff --git a/tests/Zend/Tool/Framework/_files/EmptyClient.php b/tests/Zend/Tool/Framework/_files/EmptyClient.php deleted file mode 100644 index 4e256aec1..000000000 --- a/tests/Zend/Tool/Framework/_files/EmptyClient.php +++ /dev/null @@ -1,55 +0,0 @@ -_registry = $registry; - } - -} diff --git a/tests/Zend/Tool/Framework/_files/EmptyLoader.php b/tests/Zend/Tool/Framework/_files/EmptyLoader.php deleted file mode 100644 index 8d9a3feab..000000000 --- a/tests/Zend/Tool/Framework/_files/EmptyLoader.php +++ /dev/null @@ -1,39 +0,0 @@ -addTestSuite('Zend_Tool_Project_ProfileTest'); - $suite->addTestSuite('Zend_Tool_Project_Context_RepositoryTest'); - return $suite; - } -} - -if (PHPUnit_MAIN_METHOD == 'Zend_Tool_Project_AllTests::main') { - Zend_Tool_Project_AllTests::main(); -} diff --git a/tests/Zend/Tool/Project/Context/RegistryTest.php b/tests/Zend/Tool/Project/Context/RegistryTest.php deleted file mode 100644 index 327c718f7..000000000 --- a/tests/Zend/Tool/Project/Context/RegistryTest.php +++ /dev/null @@ -1,92 +0,0 @@ -assertEquals('Zend_Tool_Project_Context_Repository', get_class(Zend_Tool_Project_Context_Repository::getInstance())); - } - - public function testNewRegistryHasSystemContexts() - { - $this->assertEquals(3, Zend_Tool_Project_Context_Repository::getInstance()->count()); - } - - public function testRegistryReturnsSystemContext() - { - $this->assertEquals('Zend_Tool_Project_Context_System_ProjectProfileFile', get_class(Zend_Tool_Project_Context_Repository::getInstance()->getContext('projectProfileFile'))); - } - - public function testRegistryLoadsZFContexts() - { - $this->_loadZfSystem(); - // the number of initial ZF Components - $count = Zend_Tool_Project_Context_Repository::getInstance()->count(); - $this->assertGreaterThanOrEqual(32, $count); - } - - /** - * @expectedException Zend_Tool_Project_Context_Exception - */ - public function testRegistryThrowsExceptionOnUnallowedContextOverwrite() - { - - Zend_Tool_Project_Context_Repository::getInstance()->addContextClass('Zend_Tool_Project_Context_System_ProjectDirectory'); - } - - /** - * @expectedException Zend_Tool_Project_Context_Exception - */ - public function testRegistryThrowsExceptionOnUnknownContextRequest() - { - Zend_Tool_Project_Context_Repository::getInstance()->getContext('somethingUnknown'); - } - - - protected function _loadZfSystem() - { - $conextRegistry = Zend_Tool_Project_Context_Repository::getInstance(); - $conextRegistry->addContextsFromDirectory(__DIR__ . '/../../../../../packages/zend-tool/library/Zend/Tool/Project/Context/Zf/', 'Zend_Tool_Project_Context_Zf_'); - } -} diff --git a/tests/Zend/Tool/Project/ProfileTest.php b/tests/Zend/Tool/Project/ProfileTest.php deleted file mode 100644 index 61f85c177..000000000 --- a/tests/Zend/Tool/Project/ProfileTest.php +++ /dev/null @@ -1,298 +0,0 @@ -_projectDirectory = __DIR__ . '/_files/project1/'; - $this->_projectProfileFile = __DIR__ . '/_files/.zfproject.xml.orig'; - - $this->_removeProjectFiles(); - - Zend_Tool_Project_Context_Repository::resetInstance(); - - $contextRegistry = Zend_Tool_Project_Context_Repository::getInstance(); - $contextRegistry->addContextsFromDirectory(__DIR__ . '/../../../../packages/zend-tool/library/Zend/Tool/Project/Context/Zf/', 'Zend_Tool_Project_Context_Zf_'); - - $this->_standardProfileFromData = new Zend_Tool_Project_Profile(); - $this->_standardProfileFromData->setAttribute('profileData', file_get_contents($this->_projectProfileFile)); - $this->_standardProfileFromData->setAttribute('projectDirectory', $this->_projectDirectory); - } - - public function teardown() - { - $this->_removeProjectFiles(); - } - - public function testAttibuteGettersAndSettersWork() - { - - $profile = new Zend_Tool_Project_Profile(array('foo' => 'bar')); - $profile->setAttributes(array('baz' => 'BAZ')); - $profile->setAttribute('boof', 'foob'); - - $this->assertEquals('foob', $profile->getAttribute('boof')); - $this->assertContains('bar', $profile->getAttributes()); - $this->assertContains('BAZ', $profile->getAttributes()); - - } - - public function testProfileLoadsFromExistingFileGivenProjectDirectory() - { - copy($this->_projectProfileFile, $this->_projectDirectory . '/.zfproject.xml'); - - $profile = new Zend_Tool_Project_Profile(); - $profile->setAttribute('projectDirectory', $this->_projectDirectory); - $profile->loadFromFile(); - - // first item in here should be 'projectDirectory' - $projectDirectoryResource = $profile->current(); - - $this->assertEquals(1, count($profile)); - $this->assertEquals('Zend_Tool_Project_Profile_Resource', get_class($projectDirectoryResource)); - $this->assertEquals('Zend_Tool_Project_Context_System_ProjectDirectory', get_class($projectDirectoryResource->getContext())); - } - - public function testProfileLoadsFromExistingFileGivenProfileFile() - { - - $profile = new Zend_Tool_Project_Profile(array( - 'projectProfileFile' => $this->_projectProfileFile, - 'projectDirectory' => $this->_projectDirectory - )); - $profile->loadFromFile(); - - $projectDirectoryResource = $profile->current(); - - $this->assertEquals('Zend_Tool_Project_Profile_Resource', get_class($projectDirectoryResource)); - $this->assertEquals('Zend_Tool_Project_Context_System_ProjectDirectory', get_class($projectDirectoryResource->getContext())); - } - - public function testProfileFromVariousSourcesIsLoadableFromFile() - { - - $profile = new Zend_Tool_Project_Profile(); - - // no options, should return false - $this->assertFalse($profile->isLoadableFromFile()); - - // invalid file path, should be false - $profile->setAttribute('projectProfileFile', $this->_projectProfileFile . '.invalid-file'); - $this->assertFalse($profile->isLoadableFromFile()); - - // valid file path, shoudl be true - $profile->setAttribute('projectProfileFile', $this->_projectProfileFile); - $this->assertTrue($profile->isLoadableFromFile()); - - // just project directory - $profile = new Zend_Tool_Project_Profile(); - - // shoudl be false with non existent directory - $profile->setAttribute('projectDirectory', $this->_projectDirectory . 'non-existent/dir/'); - $this->assertFalse($profile->isLoadableFromFile()); - - // should return true for proper directory - copy($this->_projectProfileFile, $this->_projectDirectory . '/.zfproject.xml'); - $profile->setAttribute('projectDirectory', $this->_projectDirectory); - $this->assertTrue($profile->isLoadableFromFile()); - } - - public function testLoadFromDataIsSameAsLoadFromFile() - { - - $profile = new Zend_Tool_Project_Profile(array('projectProfileFile' => $this->_projectProfileFile)); - $profile->setAttribute('projectDirectory', $this->_projectDirectory); - $profile->loadFromFile(); - - $profile2 = new Zend_Tool_Project_Profile(); - $profile2->setAttribute('profileData', file_get_contents($this->_projectProfileFile)); - $profile2->setAttribute('projectDirectory', $this->_projectDirectory); - $profile2->loadFromData(); - - $this->assertEquals($profile->__toString(), $profile2->__toString()); - } - - public function testProfileCanReturnStorageData() - { - $this->_standardProfileFromData->loadFromData(); - $expectedValue = ' '; - $this->assertEquals($expectedValue, str_replace(array("\r\n", "\n"), '', $this->_standardProfileFromData->storeToData())); - } - - public function testProfileCanSaveStorageDataToFile() - { - $this->_standardProfileFromData->loadFromData(); - $this->_standardProfileFromData->setAttribute('projectProfileFile', $this->_projectDirectory . 'my-xml-file.xml'); - $this->_standardProfileFromData->storeToFile(); - $this->assertTrue(file_exists((string) $this->_projectDirectory . 'my-xml-file.xml')); - } - - public function testProfileCanFindResource() - { - $profile = new Zend_Tool_Project_Profile(array( - 'projectProfileFile' => $this->_projectProfileFile, - 'projectDirectory' => $this->_projectDirectory - )); - $profile->loadFromFile(); - - $modelsDirectoryResource = $profile->search('modelsDirectory'); - - $this->assertEquals('Zend_Tool_Project_Profile_Resource', get_class($modelsDirectoryResource)); - $this->assertEquals('Zend_Tool_Project_Context_Zf_ModelsDirectory', get_class($modelsDirectoryResource->getContext())); - - $publicIndexFile = $profile->search(array('publicDirectory', 'publicIndexFile')); - - $this->assertEquals('Zend_Tool_Project_Profile_Resource', get_class($publicIndexFile)); - $this->assertEquals('Zend_Tool_Project_Context_Zf_PublicIndexFile', get_class($publicIndexFile->getContext())); - - } - - public function testProfileCanRecursivelyCreateParentFirst() - { - $this->_standardProfileFromData->loadFromData(); - - foreach ($this->_standardProfileFromData->getIterator() as $resource) { - $resource->getContext()->create(); - } - - $this->assertTrue(file_exists((string) $this->_projectDirectory . 'public/index.php')); - } - - public function testProfileCanDelete() - { - $this->_standardProfileFromData->loadFromData(); - - foreach ($this->_standardProfileFromData->getIterator() as $resource) { - $resource->getContext()->create(); - } - - $this->assertTrue(file_exists((string) $this->_projectDirectory . 'public/index.php')); - - $publicIndexFile = $this->_standardProfileFromData->search('publicIndexFile'); - $publicIndexFile->getContext()->delete(); - - $this->assertFalse(file_exists((string) $this->_projectDirectory . 'public/index.php')); - - $appConfigFile = $this->_standardProfileFromData->search('applicationConfigFile'); - $appConfigFile->getContext()->delete(); - $configsDirectory = $this->_standardProfileFromData->search('configsDirectory'); - $configsDirectory->getContext()->delete(); - - $this->assertFalse(file_exists((string) $this->_projectDirectory . 'application/configs')); - } - - /** - * - * @expectedException Zend_Tool_Project_Exception - */ - public function testProfileThrowsExceptionOnLoadFromData() - { - $profile = new Zend_Tool_Project_Profile(); - - // missing data from attributes should throw exception here - $profile->loadFromData(); - } - - /** - * - * @expectedException Zend_Tool_Project_Exception - */ - public function testProfileThrowsExceptionOnLoadFromFile() - { - $profile = new Zend_Tool_Project_Profile(); - - // missing file path or project path - $profile->loadFromFile(); - } - - /** - * - * @expectedException Zend_Tool_Project_Exception - */ - public function testProfileThrowsExceptionOnStoreToFile() - { - $profile = new Zend_Tool_Project_Profile(); - - // missing file path or project path - $profile->storeToFile(); - } - - /** - * - * @expectedException Zend_Tool_Project_Exception - */ - public function testProfileThrowsExceptionOnLoadFromFileWithBadPathForProfileFile() - { - $profile = new Zend_Tool_Project_Profile(); - $profile->setAttribute('projectProfileFile', '/path/should/not/exist'); - - // missing file path or project path - $profile->loadFromFile(); - } - - protected function _removeProjectFiles() - { - $rdi = new RecursiveDirectoryIterator($this->_projectDirectory); - - foreach (new RecursiveIteratorIterator($rdi, RecursiveIteratorIterator::CHILD_FIRST) as $dirIteratorItem) { - - $basename = $dirIteratorItem->getBasename(); - if (stristr($dirIteratorItem->getPathname(), '.svn') - || '.' === $basename - || '..' === $basename - || '.gitignore' === $basename) - { - continue; - } - - if ($dirIteratorItem->isDir()) { - rmdir($dirIteratorItem->getPathname()); - } elseif ($dirIteratorItem->isFile()) { - unlink($dirIteratorItem->getPathname()); - } - } - } -} diff --git a/tests/Zend/Tool/Project/Provider/ControllerTest.php b/tests/Zend/Tool/Project/Provider/ControllerTest.php deleted file mode 100644 index 937d0797d..000000000 --- a/tests/Zend/Tool/Project/Provider/ControllerTest.php +++ /dev/null @@ -1,53 +0,0 @@ -assertFalse(Zend_Tool_Project_Provider_Controller::hasResource(new Zend_Tool_Project_Profile(), - 'NewController', 'NonexistentModule')); - } - -} diff --git a/tests/Zend/Tool/Project/_files/.zfproject.xml.orig b/tests/Zend/Tool/Project/_files/.zfproject.xml.orig deleted file mode 100644 index 74c2b4c57..000000000 --- a/tests/Zend/Tool/Project/_files/.zfproject.xml.orig +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/Zend/Tool/Project/_files/project1/.gitignore b/tests/Zend/Tool/Project/_files/project1/.gitignore deleted file mode 100644 index d6b7ef32c..000000000 --- a/tests/Zend/Tool/Project/_files/project1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore