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:
parent
670d1e9e6e
commit
e74180781b
|
@ -1,8 +1,10 @@
|
|||
bin/build/*
|
||||
dist/*
|
||||
build/
|
||||
mageekguy.atoum.phar
|
||||
test/settings.ini*
|
||||
.DS_Store
|
||||
doc/api
|
||||
curl-output.txt
|
||||
vendor
|
||||
composer.lock
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.*"
|
||||
},
|
||||
"suggest": {
|
||||
"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
|
||||
then make the necessary changes:
|
||||
|
||||
```
|
||||
$ cd test/
|
||||
$ cp example.settings.ini settings.ini
|
||||
$ edit settings.ini
|
||||
```
|
||||
$ cd test/
|
||||
$ cp example.settings.ini settings.ini
|
||||
$ edit settings.ini
|
||||
|
||||
### Running Tests with Make
|
||||
### Running Tests
|
||||
|
||||
The `Makefile` included with the PHP-Client library can run the tests.
|
||||
Beginning from the root directory of the project, simply type the
|
||||
following:
|
||||
The test suite uses PHPUnit and can generate a code coverage report if
|
||||
xdebug is installed. To run the test suite make sure PHPUnit is installed
|
||||
via composer by using `composer install` or `composer update`. Once PHPUnit is
|
||||
installed execute the following command from the root of the project.
|
||||
|
||||
```
|
||||
$ 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
|
||||
```
|
||||
$ ./vendor/bin/phpunit
|
||||
|
||||
This should generate output looking something like this:
|
||||
|
||||
```
|
||||
phpunit test/Tests
|
||||
PHPUnit 3.7.24 by Sebastian Bergmann.
|
||||
PHPUnit 4.0.13 by Sebastian Bergmann.
|
||||
|
||||
..................................................
|
||||
|
||||
Time: 01:24, Memory: 6.50Mb
|
||||
|
||||
OK (50 tests, 125 assertions)
|
||||
```
|
||||
Configuration read from /path/to/openstack-sdk-php/phpunit.xml.dist
|
||||
|
||||
............................................................... 63 / 146 ( 43%)
|
||||
............................................................... 126 / 146 ( 86%)
|
||||
....................
|
||||
|
||||
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
|
||||
displayed.
|
||||
|
@ -131,14 +102,4 @@ reports and analyses can be done using those.
|
|||
|
||||
Tests should be written according to the PHPUnit documentation. Tests
|
||||
should follow the same coding standards as all other parts of the
|
||||
library, with one caveat: The namespaces for tests are still
|
||||
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.
|
||||
library.
|
||||
|
|
|
@ -29,10 +29,6 @@
|
|||
|
||||
namespace OpenStack\Tests;
|
||||
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
require_once 'src/OpenStack/Autoloader.php';
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
|
||||
/**
|
||||
* @ingroup Tests
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\ACL;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Transport;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Transport;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\Container;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Services;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Services\IdentityService;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\Object;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\Object;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\RemoteObject;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\StreamWrapperFS;
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
namespace OpenStack\Tests\Storage\ObjectStorage;
|
||||
|
||||
require_once 'src/OpenStack/Bootstrap.php';
|
||||
require_once 'test/TestCase.php';
|
||||
|
||||
use \OpenStack\Storage\ObjectStorage\StreamWrapper;
|
||||
|
|
Loading…
Reference in New Issue