Skip to content

Commit

Permalink
Update to use namespaced PHPunit tests. (#155)
Browse files Browse the repository at this point in the history
* Update to use namespaced PHPunit tests.

* Nuke unsupported php versions.

* More namespace updates.

* Support PHP5.3+ again.

* Update comment.
  • Loading branch information
jonathangreen authored and DiegoPino committed Apr 12, 2017
1 parent a53e36d commit 3720691
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 26 deletions.
14 changes: 8 additions & 6 deletions .travis.yml
@@ -1,17 +1,19 @@
language: php
php:
- "5.3"
- "5.4"
- "5.5"
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
env:
- FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
- FEDORA_VERSION="3.8.1"
# broken right now, should be fixed
# - FEDORA_VERSION="3.5"
before_script:
- composer install
- $TRAVIS_BUILD_DIR/tests/scripts/travis_setup.sh
script:
- phpunit -c tests/travis.xml tests/
- vendor/bin/phpunit -c tests/travis.xml tests/
notifications:
irc: "irc.freenode.org#islandora"
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -6,6 +6,7 @@
"require": {
"php": ">=5.3.0",
"lib-curl": "*",
"lib-xml": "*"
"lib-libxml": "*",
"phpunit/phpunit": ">=4.8.35|>=5.4.3.,<=5.0"
}
}
6 changes: 4 additions & 2 deletions tests/ApiUploadTest.php
@@ -1,7 +1,9 @@
<?php
require_once 'TestHelpers.php';

class UploadTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class UploadTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down Expand Up @@ -51,4 +53,4 @@ public function testManagedAdd() {
$this->assertEquals(file_get_contents($filepath), $object['test1']->content);
$this->assertEquals('this is a test... test test test', $object['test2']->content);
}
}
}
4 changes: 3 additions & 1 deletion tests/CacheTest.php
@@ -1,7 +1,9 @@
<?php
require_once "Cache.php";

class SimpleCacheTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class SimpleCacheTest extends TestCase {

function testAdd() {
SimpleCache::resetCache();
Expand Down
4 changes: 3 additions & 1 deletion tests/CopyDatastreamTest.php
Expand Up @@ -8,7 +8,9 @@
require_once 'Cache.php';
require_once 'TestHelpers.php';

class CopyDatastreamTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class CopyDatastreamTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
4 changes: 3 additions & 1 deletion tests/DatastreamTest.php
Expand Up @@ -8,7 +8,9 @@
require_once 'Cache.php';
require_once 'TestHelpers.php';

class DatastreamTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class DatastreamTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
6 changes: 4 additions & 2 deletions tests/FedoraApiTest.php
Expand Up @@ -9,7 +9,9 @@
require_once 'TestHelpers.php';
require_once 'FedoraDate.php';

class FedoraApiIngestTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class FedoraApiIngestTest extends TestCase {
protected $pids = array();
protected $files = array();

Expand Down Expand Up @@ -230,7 +232,7 @@ public function testIngestFormat() {
}


class FedoraApiFindObjectsTest extends PHPUnit_Framework_TestCase {
class FedoraApiFindObjectsTest extends TestCase {

public $apim;
public $apia;
Expand Down
4 changes: 3 additions & 1 deletion tests/FedoraDateTest.php
@@ -1,7 +1,9 @@
<?php
require_once "FedoraDate.php";

class FedoraDateTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class FedoraDateTest extends TestCase {

function testToString() {
$date = new FedoraDate("2012-03-13T19:15:07.529Z");
Expand Down
4 changes: 3 additions & 1 deletion tests/FedoraRelationshipsExternalTest.php
Expand Up @@ -8,7 +8,9 @@
require_once 'Cache.php';
require_once 'TestHelpers.php';

class FedoraRelationshipsExternalTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class FedoraRelationshipsExternalTest extends TestCase {

function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
4 changes: 3 additions & 1 deletion tests/FedoraRelationshipsInternalTest.php
@@ -1,7 +1,9 @@
<?php
require_once "FedoraRelationships.php";

class FedoraRelationshipsInternalTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class FedoraRelationshipsInternalTest extends TestCase {

function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
4 changes: 3 additions & 1 deletion tests/FedoraRelationshipsTest.php
Expand Up @@ -7,7 +7,9 @@
* @todo remove any calls to StringEqualsXmlString because it uses the
* domdocument cannonicalization function that doesn't work properly on cent
*/
class FedoraRelationshipsTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class FedoraRelationshipsTest extends TestCase {

function testAutoCommit() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
6 changes: 4 additions & 2 deletions tests/FoxmlDocumentTest.php
Expand Up @@ -8,7 +8,9 @@
require_once 'TestHelpers.php';
require_once 'FoxmlDocument.php';

class FoxmlDocumentTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class FoxmlDocumentTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down Expand Up @@ -155,4 +157,4 @@ public function testFoxmlDsLable() {
$this->assertEquals('Managed datastream', $this->object['MANAGED']->label);
}

}
}
4 changes: 3 additions & 1 deletion tests/HttpConnectionTest.php
@@ -1,7 +1,9 @@
<?php
require_once "HttpConnection.php";

class HttpConnectionTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class HttpConnectionTest extends TestCase {

protected function setUp() {
$this->xml = <<<foo
Expand Down
13 changes: 11 additions & 2 deletions tests/NewDatastreamTest.php
Expand Up @@ -8,7 +8,16 @@
require_once 'Cache.php';
require_once 'TestHelpers.php';

class NewDatastreamTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;
use \PHPUnit\Framework\Error\Error;

// XXX: PHPUnit6 moved the location of the Error class.
// This can be dropped when we drop support for PHP < 7.0 in our testing.
if (class_exists('\PHPUnit\Framework\Error\Error', TRUE)) {
class_alias('\PHPUnit\Framework\Error\Error', 'PHPUnit_Framework_Error');
}

class NewDatastreamTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down Expand Up @@ -94,4 +103,4 @@ public function testSetContentXString() {
$this->assertEquals('foo', file_get_contents($temp));
unlink($temp);
}
}
}
4 changes: 3 additions & 1 deletion tests/ObjectTest.php
Expand Up @@ -7,7 +7,9 @@
require_once 'Cache.php';
require_once 'TestHelpers.php';

class ObjectTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class ObjectTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
4 changes: 3 additions & 1 deletion tests/RepositoryQueryTest.php
Expand Up @@ -8,7 +8,9 @@
require_once 'RepositoryConnection.php';
require_once 'FedoraApi.php';

class RepositoryQueryTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class RepositoryQueryTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down
4 changes: 3 additions & 1 deletion tests/RepositoryTest.php
Expand Up @@ -8,7 +8,9 @@
require_once 'RepositoryConnection.php';
require_once 'FedoraApi.php';

class RepositoryTest extends PHPUnit_Framework_TestCase {
use \PHPUnit\Framework\TestCase;

class RepositoryTest extends TestCase {

protected function setUp() {
$connection = new RepositoryConnection(FEDORAURL, FEDORAUSER, FEDORAPASS);
Expand Down

0 comments on commit 3720691

Please sign in to comment.