Fixing a bug where PHPUnit is not included in the require-dev to run
the test suite. PHPUnit 4 added and the test suite passes. Change-Id: I57f9860127d0a0ac037e31776e5d8a6f233a350e Closes-Bug: 1295358
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,8 +1,10 @@
|
|||||||
bin/build/*
|
bin/build/*
|
||||||
dist/*
|
dist/*
|
||||||
|
build/
|
||||||
mageekguy.atoum.phar
|
mageekguy.atoum.phar
|
||||||
test/settings.ini*
|
test/settings.ini*
|
||||||
.DS_Store
|
.DS_Store
|
||||||
doc/api
|
doc/api
|
||||||
curl-output.txt
|
curl-output.txt
|
||||||
vendor
|
vendor
|
||||||
|
composer.lock
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.3.0"
|
||||||
},
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.*"
|
||||||
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"curl": ">=7.0.0"
|
"curl": ">=7.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -61,65 +61,36 @@ Cloud credentials, along with your preferred testing parameters.
|
|||||||
The easiest way to do this is to copy the example settings file, and
|
The easiest way to do this is to copy the example settings file, and
|
||||||
then make the necessary changes:
|
then make the necessary changes:
|
||||||
|
|
||||||
```
|
$ cd test/
|
||||||
$ cd test/
|
$ cp example.settings.ini settings.ini
|
||||||
$ cp example.settings.ini settings.ini
|
$ edit settings.ini
|
||||||
$ edit settings.ini
|
|
||||||
```
|
|
||||||
|
|
||||||
### Running Tests with Make
|
### Running Tests
|
||||||
|
|
||||||
The `Makefile` included with the PHP-Client library can run the tests.
|
The test suite uses PHPUnit and can generate a code coverage report if
|
||||||
Beginning from the root directory of the project, simply type the
|
xdebug is installed. To run the test suite make sure PHPUnit is installed
|
||||||
following:
|
via composer by using `composer install` or `composer update`. Once PHPUnit is
|
||||||
|
installed execute the following command from the root of the project.
|
||||||
|
|
||||||
```
|
$ ./vendor/bin/phpunit
|
||||||
$ make test
|
|
||||||
```
|
|
||||||
|
|
||||||
By default, this will run ALL of the unit tests. However, you can run
|
|
||||||
a subset of the tests using the TESTS argument:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make test TESTS="test/Tests/BootstrapTest.php test/Tests/ACLTest.php"
|
|
||||||
```
|
|
||||||
|
|
||||||
If you know which *group* of tests you want to run, you can run just
|
|
||||||
a select group of tests using the `test-group` target:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make test-group GROUP=deprecated
|
|
||||||
```
|
|
||||||
|
|
||||||
The above will run all of the unit tests in the `@group deprecated` group.
|
|
||||||
(Note: the library does not use group tests very often, so this is
|
|
||||||
unlikely to be a commonly required feature.)
|
|
||||||
|
|
||||||
### Running Tests Using `phpunit`
|
|
||||||
|
|
||||||
If for some reason the Makefile doesn't suite your needs, you have the
|
|
||||||
option of running the tests directly using `phpunit`.
|
|
||||||
|
|
||||||
Beginning from the root directory of the project (you should see `src/`
|
|
||||||
and `test/` in that directory), run this command to execute all of the
|
|
||||||
tests:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ phpunit test/Tests
|
|
||||||
```
|
|
||||||
|
|
||||||
This should generate output looking something like this:
|
This should generate output looking something like this:
|
||||||
|
|
||||||
```
|
PHPUnit 4.0.13 by Sebastian Bergmann.
|
||||||
phpunit test/Tests
|
|
||||||
PHPUnit 3.7.24 by Sebastian Bergmann.
|
|
||||||
|
|
||||||
..................................................
|
Configuration read from /path/to/openstack-sdk-php/phpunit.xml.dist
|
||||||
|
|
||||||
Time: 01:24, Memory: 6.50Mb
|
............................................................... 63 / 146 ( 43%)
|
||||||
|
............................................................... 126 / 146 ( 86%)
|
||||||
OK (50 tests, 125 assertions)
|
....................
|
||||||
```
|
|
||||||
|
Time: 4.94 minutes, Memory: 17.50Mb
|
||||||
|
|
||||||
|
OK (146 tests, 413 assertions)
|
||||||
|
|
||||||
|
Generating code coverage report in Clover XML format ... done
|
||||||
|
|
||||||
|
Generating code coverage report in HTML format ... done
|
||||||
|
|
||||||
If the tests fail, detailed information about the failure will be
|
If the tests fail, detailed information about the failure will be
|
||||||
displayed.
|
displayed.
|
||||||
@@ -131,14 +102,4 @@ reports and analyses can be done using those.
|
|||||||
|
|
||||||
Tests should be written according to the PHPUnit documentation. Tests
|
Tests should be written according to the PHPUnit documentation. Tests
|
||||||
should follow the same coding standards as all other parts of the
|
should follow the same coding standards as all other parts of the
|
||||||
library, with one caveat: The namespaces for tests are still
|
library.
|
||||||
non-standard.
|
|
||||||
|
|
||||||
The different namespacing is an historical relic resulting from two things:
|
|
||||||
|
|
||||||
* Originally, we used Atoum, which ascribes additional semantic (testing) value to
|
|
||||||
namespaces.
|
|
||||||
* PHPUnit's namespacing support is relatively new.
|
|
||||||
|
|
||||||
Eventually, the namespaces for the unit tests will all be standardized,
|
|
||||||
too.
|
|
||||||
|
|||||||
@@ -29,10 +29,6 @@
|
|||||||
|
|
||||||
namespace OpenStack\Tests;
|
namespace OpenStack\Tests;
|
||||||
|
|
||||||
require_once 'PHPUnit/Autoload.php';
|
|
||||||
require_once 'src/OpenStack/Autoloader.php';
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup Tests
|
* @ingroup Tests
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\ACL;
|
use \OpenStack\Storage\ObjectStorage\ACL;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Transport;
|
namespace OpenStack\Tests\Transport;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Transport;
|
use \OpenStack\Transport;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\Container;
|
use \OpenStack\Storage\ObjectStorage\Container;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Services;
|
namespace OpenStack\Tests\Services;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Services\IdentityService;
|
use \OpenStack\Services\IdentityService;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage;
|
namespace OpenStack\Tests\Storage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\Object;
|
use \OpenStack\Storage\ObjectStorage\Object;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage;
|
namespace OpenStack\Tests\Storage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\Object;
|
use \OpenStack\Storage\ObjectStorage\Object;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\RemoteObject;
|
use \OpenStack\Storage\ObjectStorage\RemoteObject;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\StreamWrapperFS;
|
use \OpenStack\Storage\ObjectStorage\StreamWrapperFS;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||||
|
|
||||||
require_once 'src/OpenStack/Bootstrap.php';
|
|
||||||
require_once 'test/TestCase.php';
|
require_once 'test/TestCase.php';
|
||||||
|
|
||||||
use \OpenStack\Storage\ObjectStorage\StreamWrapper;
|
use \OpenStack\Storage\ObjectStorage\StreamWrapper;
|
||||||
|
|||||||
Reference in New Issue
Block a user