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 f808f36 commit 9ea5062
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 27 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\Nirvanix 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-nirvanix",
"description": "OOP wrapper for the Nirvanix web service",
"type": "library",
"keywords": [
"zf2",
"akismet"
],
"homepage": "http://packages.zendframework.com/",
"license": "BSD-3-Clause",
"autoload": {
"psr-0": {
"ZendService": "library/"
}
},
"target-dir": "ZendService/Nirvanix",
"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"
}
}
}
6 changes: 3 additions & 3 deletions library/ZendService/Nirvanix/Context/Base.php
Expand Up @@ -8,14 +8,14 @@
* @package Zend_Service
*/

namespace Zend\Service\Nirvanix\Context;
namespace ZendService\Nirvanix\Context;

use Traversable;
use Zend\Http\Client as HttpClient;
use Zend\Http\Request as HttpRequest;
use Zend\Http\Response as HttpResponse;
use Zend\Service\Nirvanix\Exception;
use Zend\Service\Nirvanix\Response;
use ZendService\Nirvanix\Exception;
use ZendService\Nirvanix\Response;
use Zend\Stdlib\ArrayUtils;

/**
Expand Down
4 changes: 2 additions & 2 deletions library/ZendService/Nirvanix/Context/Imfs.php
Expand Up @@ -8,10 +8,10 @@
* @package Zend_Service
*/

namespace Zend\Service\Nirvanix\Context;
namespace ZendService\Nirvanix\Context;

use Zend\Http\Request as HttpRequest;
use Zend\Service\Nirvanix\Response;
use ZendService\Nirvanix\Response;

/**
* Namespace proxy with additional convenience methods for the IMFS namespace.
Expand Down
2 changes: 1 addition & 1 deletion library/ZendService/Nirvanix/Exception/DomainException.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\Nirvanix\Exception;
namespace ZendService\Nirvanix\Exception;

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

namespace Zend\Service\Nirvanix\Exception;
namespace ZendService\Nirvanix\Exception;

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

namespace Zend\Service\Nirvanix\Exception;
namespace ZendService\Nirvanix\Exception;

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

namespace Zend\Service\Nirvanix\Exception;
namespace ZendService\Nirvanix\Exception;

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

namespace Zend\Service\Nirvanix;
namespace ZendService\Nirvanix;

use Traversable;
use Zend\Http\Client as HttpClient;
Expand Down
2 changes: 1 addition & 1 deletion library/ZendService/Nirvanix/Response.php
Expand Up @@ -8,7 +8,7 @@
* @package Zend_Service
*/

namespace Zend\Service\Nirvanix;
namespace ZendService\Nirvanix;

use SimpleXMLElement;

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';
4 changes: 2 additions & 2 deletions tests/ZendService/Nirvanix/Context/BaseTest.php
Expand Up @@ -8,9 +8,9 @@
* @package Zend_Service
*/

namespace ZendTest\Service\Nirvanix\Context;
namespace ZendServiceTest\Nirvanix\Context;

use ZendTest\Service\Nirvanix\FunctionalTestCase;
use ZendServiceTest\Nirvanix\FunctionalTestCase;

/**
* @category Zend
Expand Down
8 changes: 4 additions & 4 deletions tests/ZendService/Nirvanix/Context/ImfsTest.php
Expand Up @@ -8,10 +8,10 @@
* @package Zend_Service
*/

namespace ZendTest\Service\Nirvanix\Context;
namespace ZendServiceTest\Nirvanix\Context;

use Zend\Service\Nirvanix\Context\Imfs as ImfsContext;
use ZendTest\Service\Nirvanix\FunctionalTestCase;
use ZendService\Nirvanix\Context\Imfs as ImfsContext;
use ZendServiceTest\Nirvanix\FunctionalTestCase;

/**
* @category Zend
Expand All @@ -25,7 +25,7 @@ class ImfsTest extends FunctionalTestCase
public function testInheritsFromNirvanixBase()
{
$imfs = new ImfsContext();
$this->assertInstanceOf('Zend\Service\Nirvanix\Context\Base', $imfs);
$this->assertInstanceOf('ZendService\Nirvanix\Context\Base', $imfs);
}

// putContents()
Expand Down
4 changes: 2 additions & 2 deletions tests/ZendService/Nirvanix/FunctionalTestCase.php
Expand Up @@ -8,12 +8,12 @@
* @package Zend_Service
*/

namespace ZendTest\Service\Nirvanix;
namespace ZendServiceTest\Nirvanix;

use PHPUnit_Framework_TestCase as TestCase;
use Zend\Http\Client as HttpClient;
use Zend\Http\Client\Adapter\Test as TestAdapter;
use Zend\Service\Nirvanix\Nirvanix;
use ZendService\Nirvanix\Nirvanix;

/**
* @category Zend
Expand Down

0 comments on commit 9ea5062

Please sign in to comment.