Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testing PHP 7.0 #96

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ php:
- 5.6
- 5.5
- hhvm
matrix:
allow_failures:
- php: hhvm
before_script:
- cp tests/config/config.travis-ci.php tests/config/config.php
- composer install --dev
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,23 @@ For more information about the Experience API visit:

http://experienceapi.com/

### Requirements

Requires PHP 5.5 or later. (If you must run something older you should look at the 0.x release series or the PHP_5_2 branch.)

Compatible with HHVM 3.4.0 through 3.14.5.
HHVM 3.15.0 introduced a bug that causes ```RemoteLRS->sendRequest()``` to fail. The
[issue](https://github.com/facebook/hhvm/issues/7684) has been reported and fixed in
[PR #8048](https://github.com/facebook/hhvm/pull/8048). Until the fix is released, edit ```RemoteLRS->sendRequest()```,
search for this line:
```php
$context = stream_context_create(array( 'http' => $http ));
```
and precede it with this line.
```php
$http['header'] = implode("\r\n", $http['header']);
```

### Installation

TinCanPHP is available via [Composer](http://getcomposer.org).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "@stable"
"phpunit/phpunit": "4.8.* || 5.7.*"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 2 additions & 1 deletion tests/AboutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\About;

class AboutTest extends \PHPUnit_Framework_TestCase {
class AboutTest extends TestCase {
const VERSION_1 = '1.0.0';

public function testInstantiation() {
Expand Down
3 changes: 2 additions & 1 deletion tests/ActivityDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\ActivityDefinition;

class ActivityDefinitionTest extends \PHPUnit_Framework_TestCase {
class ActivityDefinitionTest extends TestCase {
const NAME = 'testName';

private $emptyProperties = array(
Expand Down
3 changes: 2 additions & 1 deletion tests/ActivityProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\ActivityProfile;
use TinCan\Activity;

class ActivityProfileTest extends \PHPUnit_Framework_TestCase {
class ActivityProfileTest extends TestCase {
public function testSetActivity() {
$profile = new ActivityProfile();
$profile->setActivity(['id' => COMMON_ACTIVITY_ID]);
Expand Down
3 changes: 2 additions & 1 deletion tests/ActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Activity;

class ActivityTest extends \PHPUnit_Framework_TestCase {
class ActivityTest extends TestCase {
use TestCompareWithSignatureTrait;

static private $DEFINITION;
Expand Down
3 changes: 2 additions & 1 deletion tests/AgentAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\AgentAccount;

class AgentAccountTest extends \PHPUnit_Framework_TestCase {
class AgentAccountTest extends TestCase {
use TestCompareWithSignatureTrait;

const HOMEPAGE = 'http://tincanapi.com';
Expand Down
3 changes: 2 additions & 1 deletion tests/AgentProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\AgentProfile;
use TinCan\Agent;
use TinCan\Group;

class AgentProfileTest extends \PHPUnit_Framework_TestCase {
class AgentProfileTest extends TestCase {
public function testSetAgent() {
$profile = new AgentProfile();
$profile->setAgent(['mbox' => COMMON_MBOX]);
Expand Down
3 changes: 2 additions & 1 deletion tests/AgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Agent;
use TinCan\AgentAccount;

class AgentTest extends \PHPUnit_Framework_TestCase {
class AgentTest extends TestCase {
use TestCompareWithSignatureTrait;

public function testInstantiation() {
Expand Down
4 changes: 3 additions & 1 deletion tests/AsVersionTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

namespace TinCanTest;

class AsVersionTraitTest extends \PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

class AsVersionTraitTest extends TestCase
{
public function testTraitExists() {
$this->assertTrue(trait_exists('TinCan\AsVersionTrait'));
Expand Down
3 changes: 2 additions & 1 deletion tests/AttachmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Attachment;
use TinCan\Version;

class AttachmentTest extends \PHPUnit_Framework_TestCase {
class AttachmentTest extends TestCase {
use TestCompareWithSignatureTrait;

const USAGE_TYPE = 'http://id.tincanapi.com/attachment/supporting_media';
Expand Down
3 changes: 2 additions & 1 deletion tests/ContextActivitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Activity;
use TinCan\ContextActivities;

class ContextActivitiesTest extends \PHPUnit_Framework_TestCase {
class ContextActivitiesTest extends TestCase {
use TestCompareWithSignatureTrait;

static private $listProps = ['category', 'parent', 'grouping', 'other'];
Expand Down
3 changes: 2 additions & 1 deletion tests/ContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Agent;
use TinCan\Context;
use TinCan\ContextActivities;
Expand All @@ -25,7 +26,7 @@
use TinCan\StatementRef;
use TinCan\Util;

class ContextTest extends \PHPUnit_Framework_TestCase {
class ContextTest extends TestCase {
use TestCompareWithSignatureTrait;

private $emptyProperties = array(
Expand Down
3 changes: 2 additions & 1 deletion tests/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Document;

class StubDocument extends Document {}

class DocumentTest extends \PHPUnit_Framework_TestCase {
class DocumentTest extends TestCase {
public function testExceptionOnInvalidDateTime() {
$this->setExpectedException(
"InvalidArgumentException",
Expand Down
3 changes: 2 additions & 1 deletion tests/ExtensionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Extensions;

class ExtensionsTest extends \PHPUnit_Framework_TestCase {
class ExtensionsTest extends TestCase {
use TestCompareWithSignatureTrait;

public function testInstantiation() {
Expand Down
3 changes: 2 additions & 1 deletion tests/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Agent;
use TinCan\AgentAccount;
use TinCan\Group;

class GroupTest extends \PHPUnit_Framework_TestCase {
class GroupTest extends TestCase {
use TestCompareWithSignatureTrait;

public function testInstantiation() {
Expand Down
3 changes: 2 additions & 1 deletion tests/ISO8601Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

use DateTime;
use DateTimeZone;
use PHPUnit\Framework\TestCase;
use TinCan\Statement;
use TinCan\State;

class ISO8601Test extends \PHPUnit_Framework_TestCase {
class ISO8601Test extends TestCase {
public function testProperties() {
$str_datetime = '2014-12-15T19:16:05+00:00';
$str_datetime_tz = '2014-12-15T13:16:05-06:00';
Expand Down
5 changes: 4 additions & 1 deletion tests/JSONParseErrorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
limitations under the License.
*/

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\JSONParseErrorException;

class JSONParseErrorExceptionTest extends PHPUnit_Framework_TestCase
class JSONParseErrorExceptionTest extends TestCase
{
private $exception;
private $malformedValue = '.....';
Expand Down
3 changes: 2 additions & 1 deletion tests/LRSResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\LRSResponse;

class LRSResponseTest extends \PHPUnit_Framework_TestCase {
class LRSResponseTest extends TestCase {
public function testInstantiation() {
$obj = new LRSResponse(true, '', false);
$this->assertTrue($obj->success);
Expand Down
3 changes: 2 additions & 1 deletion tests/LanguageMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\LanguageMap;

class LanguageMapTest extends \PHPUnit_Framework_TestCase {
class LanguageMapTest extends TestCase {
const NAME = 'testName';

public function testInstantiation() {
Expand Down
3 changes: 2 additions & 1 deletion tests/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Map;

class StubMap extends Map {}

class MapTest extends \PHPUnit_Framework_TestCase {
class MapTest extends TestCase {
public function testInstantiation() {
$obj = new StubMap();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/PersonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Person;

class PersonTest extends \PHPUnit_Framework_TestCase {
class PersonTest extends TestCase {
use TestCompareWithSignatureTrait;

public function testInstantiation() {
Expand Down
3 changes: 2 additions & 1 deletion tests/RemoteLRSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Activity;
use TinCan\Agent;
use TinCan\Attachment;
Expand All @@ -28,7 +29,7 @@
use TinCan\Verb;
use TinCan\Version;

class RemoteLRSTest extends \PHPUnit_Framework_TestCase {
class RemoteLRSTest extends TestCase {
static private $endpoint;
static private $version;
static private $username;
Expand Down
3 changes: 2 additions & 1 deletion tests/ResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Extensions;
use TinCan\Result;
use TinCan\Score;

class ResultTest extends \PHPUnit_Framework_TestCase {
class ResultTest extends TestCase {
use TestCompareWithSignatureTrait;

private $emptyProperties = array(
Expand Down
3 changes: 2 additions & 1 deletion tests/ScoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\Score;

class ScoreTest extends \PHPUnit_Framework_TestCase {
class ScoreTest extends TestCase {
use TestCompareWithSignatureTrait;

private $emptyProperties = array(
Expand Down
4 changes: 3 additions & 1 deletion tests/SignatureComparisonTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;

class SignatureComparisonStub {
use \TinCan\SignatureComparisonTrait;

Expand All @@ -25,7 +27,7 @@ public static function runDoMatch($a, $b, $description) {
}
}

class SignatureComparisonTraitTest extends \PHPUnit_Framework_TestCase {
class SignatureComparisonTraitTest extends TestCase {
public function testDoMatch() {
$description = "A test Description";

Expand Down
3 changes: 2 additions & 1 deletion tests/StateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\State;
use TinCan\Group;

class StateTest extends \PHPUnit_Framework_TestCase {
class StateTest extends TestCase {
public function testCanSetActivityWithArray() {
$args = [
'id' => COMMON_ACTIVITY_ID,
Expand Down
3 changes: 2 additions & 1 deletion tests/StatementBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace TinCanTest;

use PHPUnit\Framework\TestCase;
use TinCan\StatementBase;
use TinCan\SubStatement;
use TinCan\Verb;
Expand All @@ -26,7 +27,7 @@

class StubStatementBase extends StatementBase {}

class StatementBaseTest extends \PHPUnit_Framework_TestCase {
class StatementBaseTest extends TestCase {
public function testInstantiation() {
$obj = new StubStatementBase();
}
Expand Down
Loading