Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
Refactorings for Zend -> ZendService namespace change
Browse files Browse the repository at this point in the history
Added various files: license, readme, composer, travis, testing files
  • Loading branch information
ralphschindler committed Jul 19, 2012
1 parent 649120e commit 5123164
Show file tree
Hide file tree
Showing 22 changed files with 334 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
vendor/
17 changes: 17 additions & 0 deletions .travis.yml
@@ -0,0 +1,17 @@
language: php

php:
- 5.3.3
- 5.3
- 5.4

before_install:
- cp tests/TestConfiguration.php.travis tests/TestConfiguration.php
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev

script:
- php ./tests/run-tests.php

notifications:
irc: "irc.freenode.org#zftalk.2"
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Copyright (c) 2005-2012, 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.
11 changes: 11 additions & 0 deletions README.md
@@ -0,0 +1,11 @@
ZendService\GoGrid component

You can install using:

```
curl -s http://getcomposer.org/installer | php
php composer.phar install
```

At that point, follow the instructions in the documentation folder for actual
usage of the component. (Documentation is forthcoming.)
34 changes: 34 additions & 0 deletions composer.json
@@ -0,0 +1,34 @@
{
"name": "zendframework/zendservice-gogrid",
"description": "OOP wrapper for the GoGrid web service",
"type": "library",
"keywords": [
"zf2",
"akismet"
],
"homepage": "http://packages.zendframework.com/",
"license": "BSD-3-Clause",
"autoload": {
"psr-0": {
"ZendService": "library/"
}
},
"target-dir": "ZendService/GoGrid",
"repositories": [
{
"type": "composer",
"url": "http://packages.zendframework.com/"
}
],
"require": {
"php": ">=5.3.3",
"zendframework/zend-http": ">=2.0.0beta5",
"zendframework/zend-uri": ">=2.0.0beta5",
"zendframework/zend-version": ">=2.0.0beta5"
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
}
}
2 changes: 1 addition & 1 deletion library/ZendService/GoGrid/AbstractGoGrid.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid;
namespace ZendService\GoGrid;

use Zend\Http\Client as HttpClient;

Expand Down
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid\Exception;
namespace ZendService\GoGrid\Exception;

/**
* @category Zend
Expand Down
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid\Exception;
namespace ZendService\GoGrid\Exception;

/**
* @category Zend
Expand Down
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid\Exception;
namespace ZendService\GoGrid\Exception;

/**
* @category Zend
Expand Down
2 changes: 1 addition & 1 deletion library/ZendService/GoGrid/Exception/RuntimeException.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid\Exception;
namespace ZendService\GoGrid\Exception;

/**
* @category Zend
Expand Down
2 changes: 1 addition & 1 deletion library/ZendService/GoGrid/Job.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid;
namespace ZendService\GoGrid;

class Job extends AbstractGoGrid
{
Expand Down
2 changes: 1 addition & 1 deletion library/ZendService/GoGrid/Object.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid;
namespace ZendService\GoGrid;

class Object
{
Expand Down
10 changes: 5 additions & 5 deletions library/ZendService/GoGrid/ObjectList.php
Expand Up @@ -8,12 +8,12 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid;
namespace ZendService\GoGrid;

use ArrayAccess;
use Countable;
use Iterator;
use Zend\Service\GoGrid\Object;
use ZendService\GoGrid\Object;

/**
* List of servers retrived from the GoGrid web service
Expand All @@ -30,7 +30,7 @@ class ObjectList implements
const SUCCESS_STATUS= 'success';

/**
* @var array Array of Zend\Service\GoGrid\Object
* @var array Array of ZendService\GoGrid\Object
*/
protected $_objects = array();

Expand Down Expand Up @@ -135,7 +135,7 @@ public function count()
*
* Implement Iterator::current()
*
* @return Zend\Service\GoGrid\Object
* @return ZendService\GoGrid\Object
*/
public function current()
{
Expand Down Expand Up @@ -214,7 +214,7 @@ public function offsetExists($offset)
*
* @param int $offset
* @throws Exception\OutOfBoundsException
* @return Zend\Service\GoGrid\Object
* @return ZendService\GoGrid\Object
*/
public function offsetGet($offset)
{
Expand Down
2 changes: 1 addition & 1 deletion library/ZendService/GoGrid/Server.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\GoGrid;
namespace ZendService\GoGrid;

class Server extends AbstractGoGrid
{
Expand Down
92 changes: 92 additions & 0 deletions tests/Bootstrap.php
@@ -0,0 +1,92 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend
*/

/*
* Set error reporting to the level to which Zend Framework code must comply.
*/
error_reporting( E_ALL | E_STRICT );

$phpUnitVersion = PHPUnit_Runner_Version::id();
if ('@package_version@' !== $phpUnitVersion && version_compare($phpUnitVersion, '3.5.0', '<')) {
echo 'This version of PHPUnit (' . PHPUnit_Runner_Version::id() . ') is not supported in Zend Framework 2.x unit tests.' . PHP_EOL;
exit(1);
}
unset($phpUnitVersion);

/*
* Determine the root, library, and tests directories of the framework
* distribution.
*/
$zfRoot = realpath(dirname(__DIR__));
$zfCoreLibrary = "$zfRoot/library";
$zfCoreTests = "$zfRoot/tests";

/*
* Prepend the Zend Framework library/ and tests/ directories to the
* include_path. This allows the tests to run out of the box and helps prevent
* loading other copies of the framework code and tests that would supersede
* this copy.
*/
$path = array(
$zfCoreLibrary,
$zfCoreTests,
get_include_path(),
);
set_include_path(implode(PATH_SEPARATOR, $path));

/**
* Setup autoloading
*/
include __DIR__ . '/_autoload.php';

/*
* Load the user-defined test configuration file, if it exists; otherwise, load
* the default configuration.
*/
if (is_readable($zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php')) {
require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';
} else {
require_once $zfCoreTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php.dist';
}

if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true) {
$codeCoverageFilter = PHP_CodeCoverage_Filter::getInstance();

$lastArg = end($_SERVER['argv']);
if (is_dir($zfCoreTests . '/' . $lastArg)) {
$codeCoverageFilter->addDirectoryToWhitelist($zfCoreLibrary . '/' . $lastArg);
} else if (is_file($zfCoreTests . '/' . $lastArg)) {
$codeCoverageFilter->addDirectoryToWhitelist(dirname($zfCoreLibrary . '/' . $lastArg));
} else {
$codeCoverageFilter->addDirectoryToWhitelist($zfCoreLibrary);
}

/*
* Omit from code coverage reports the contents of the tests directory
*/
$codeCoverageFilter->addDirectoryToBlacklist($zfCoreTests, '');
$codeCoverageFilter->addDirectoryToBlacklist(PEAR_INSTALL_DIR, '');
$codeCoverageFilter->addDirectoryToBlacklist(PHP_LIBDIR, '');

unset($codeCoverageFilter);
}


/**
* Start output buffering, if enabled
*/
if (defined('TESTS_ZEND_OB_ENABLED') && constant('TESTS_ZEND_OB_ENABLED')) {
ob_start();
}

/*
* Unset global variables that are no longer needed.
*/
unset($zfRoot, $zfCoreLibrary, $zfCoreTests, $path);
45 changes: 45 additions & 0 deletions tests/TestConfiguration.php.dist
@@ -0,0 +1,45 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package UnitTests
*/

/**
* This file defines configuration for running the unit tests for the Zend
* Framework. Some tests have dependencies to PHP extensions or databases
* which may not necessary installed on the target system. For these cases,
* the ability to disable or configure testing is provided below. Tests for
* components which should run universally are always run by the master
* suite and cannot be disabled.
*
* Do not edit this file. Instead, copy this file to TestConfiguration.php,
* and edit the new file. Never commit passwords to the source code repository.
*/

/**
* Use the notation:
*
* defined(...) || define(...);
*
* This ensures that, when a test is marked to run in a separate process,
* PHP will not complain of a constant already being defined.
*/

/**
* GENERAL SETTINGS
*
* OB_ENABLED should be enabled for some tests to check if all functionality
* works as expected. Such tests include those for Zend\Soap and Zend\Session,
* which require that headers not be sent in order to work.
*/
defined('TESTS_ZEND_OB_ENABLED') || define('TESTS_ZEND_OB_ENABLED', false);

/**
* PHPUnit Code Coverage / Test Report
*/
defined('TESTS_GENERATE_REPORT') || define('TESTS_GENERATE_REPORT', false);
defined('TESTS_GENERATE_REPORT_TARGET') || define('TESTS_GENERATE_REPORT_TARGET', '/path/to/target');
20 changes: 20 additions & 0 deletions tests/TestConfiguration.php.travis
@@ -0,0 +1,20 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package UnitTests
*/

/**
* This file defines specific configuration that differs from the standard configuration
* for running the unit tests with Travis-CI (http://www.travis-ci.org)
*
* See TestConfiguration.php.dist to get more details.
*
* Never commit passwords to the source code repository.
*/

require_once __DIR__ . '/TestConfiguration.php.dist';

0 comments on commit 5123164

Please sign in to comment.