diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7f2026e..4ca3202 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,17 +12,11 @@ jobs: strategy: matrix: - include: - - php-version: '7.1' - composer-options: '--prefer-stable' - - php-version: '7.2' - composer-options: '--prefer-lowest --prefer-stable' - - php-version: '7.3' - composer-options: '--prefer-stable' - - php-version: '7.4' - composer-options: '--prefer-stable' - - php-version: '8.0' - composer-options: '--prefer-stable' + php-version: + - '7.4' + - '8.0' + - '8.1' + - '8.2' steps: - name: 'Check out' diff --git a/composer.json b/composer.json index ebe787f..a563075 100644 --- a/composer.json +++ b/composer.json @@ -12,12 +12,12 @@ } ], "require": { - "php": "^7.1 || ^8.0", - "php-xapi/exception": "~0.1", - "ramsey/uuid": "^2.9 || ^3.0" + "php": "^7.4 || ^8.0", + "php-xapi/exception": "v1.0.0-rc.1 as 1.0.0", + "ramsey/uuid": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^5.0 || ^6.0 || ^7.0" + "phpspec/phpspec": "^6.0 || ^7.0" }, "conflict": { "xabbuh/xapi-model": "*" @@ -32,11 +32,10 @@ "spec\\Xabbuh\\XApi\\Model\\": "spec/" } }, - "extra": { - "branch-alias": { - "1.x-dev": "1.2.x-dev", - "2.x-dev": "2.2.x-dev", - "3.x-dev": "3.2.x-dev" + "repositories": [ + { + "type": "git", + "url": "https://github.com/erickr/php-xapi-exception.git" } - } + ] } diff --git a/spec/ActivityProfileDocumentSpec.php b/spec/ActivityProfileDocumentSpec.php index 3f7dcec..c70a965 100644 --- a/spec/ActivityProfileDocumentSpec.php +++ b/spec/ActivityProfileDocumentSpec.php @@ -20,12 +20,16 @@ class ActivityProfileDocumentSpec extends ObjectBehavior { - function let() + public function let() { - $this->beConstructedWith(new ActivityProfile('id', new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'))), new DocumentData(array( - 'x' => 'foo', - 'y' => 'bar', - ))); + $this->beConstructedWith(new ActivityProfile('id', + new Activity(IRI::fromString('http://tincanapi.com/conformancetest/activityid'))), + new DocumentData(array( + 'x' => 'foo', + 'y' => 'bar', + ) + ) + ); } function it_is_a_document() @@ -35,11 +39,13 @@ function it_is_a_document() function its_data_can_be_read() { - $this->offsetExists('x')->shouldReturn(true); + //$this->offsetExists('x')->shouldReturn(true); + $this->shouldHaveKey('x'); $this->offsetGet('x')->shouldReturn('foo'); - $this->offsetExists('y')->shouldReturn(true); + //$this->offsetExists('y')->shouldReturn(true); + $this->shouldHaveKey('y'); $this->offsetGet('y')->shouldReturn('bar'); - $this->offsetExists('z')->shouldReturn(false); + //$this->offsetExists('z')->shouldReturn(false); } function it_throws_exception_when_not_existing_data_is_being_read() diff --git a/spec/AgentProfileDocumentSpec.php b/spec/AgentProfileDocumentSpec.php index e8dd7e0..995a57d 100644 --- a/spec/AgentProfileDocumentSpec.php +++ b/spec/AgentProfileDocumentSpec.php @@ -36,11 +36,11 @@ function it_is_a_document() function its_data_can_be_read() { - $this->offsetExists('x')->shouldReturn(true); + $this->shouldHaveKey('x'); $this->offsetGet('x')->shouldReturn('foo'); - $this->offsetExists('y')->shouldReturn(true); + $this->shouldHaveKey('y'); $this->offsetGet('y')->shouldReturn('bar'); - $this->offsetExists('z')->shouldReturn(false); + $this->shouldNotHaveKey('z'); } function it_throws_exception_when_not_existing_data_is_being_read() diff --git a/spec/ExtensionsSpec.php b/spec/ExtensionsSpec.php index a8a1472..d8765d9 100644 --- a/spec/ExtensionsSpec.php +++ b/spec/ExtensionsSpec.php @@ -27,16 +27,16 @@ function its_extensions_can_be_read() $extensions->attach(IRI::fromString('http://id.tincanapi.com/extension/starting-position'), 1); $this->beConstructedWith($extensions); - $this->offsetExists(IRI::fromString('http://id.tincanapi.com/extension/topic'))->shouldReturn(true); + $this->shouldHaveKey(IRI::fromString('http://id.tincanapi.com/extension/topic')); $this->offsetGet(IRI::fromString('http://id.tincanapi.com/extension/topic'))->shouldReturn('Conformance Testing'); - $this->offsetExists(IRI::fromString('http://id.tincanapi.com/extension/color'))->shouldReturn(true); + $this->shouldHaveKey(IRI::fromString('http://id.tincanapi.com/extension/color')); $this->offsetGet(IRI::fromString('http://id.tincanapi.com/extension/color'))->shouldReturn(array( 'model' => 'RGB', 'value' => '#FFFFFF', )); - $this->offsetExists(IRI::fromString('http://id.tincanapi.com/extension/starting-position'))->shouldReturn(true); + $this->shouldHaveKey(IRI::fromString('http://id.tincanapi.com/extension/starting-position')); $this->offsetGet(IRI::fromString('http://id.tincanapi.com/extension/starting-position'))->shouldReturn(1); $returnedExtensions = $this->getExtensions(); diff --git a/spec/Interaction/InteractionDefinitionSpec.php b/spec/Interaction/InteractionDefinitionSpec.php index 9be56a5..bbc7db9 100644 --- a/spec/Interaction/InteractionDefinitionSpec.php +++ b/spec/Interaction/InteractionDefinitionSpec.php @@ -15,11 +15,17 @@ use Xabbuh\XApi\Model\Definition; use Xabbuh\XApi\Model\Interaction\InteractionDefinition; -abstract class InteractionDefinitionSpec extends DefinitionSpec +class InteractionDefinitionSpec extends DefinitionSpec { - function it_is_a_definition() + + protected function createEmptyDefinition() { - $this->shouldHaveType(Definition::class); + return new InteractionDefinition(); + } + + public function it_is_a_definition() + { + $this->shouldHaveType(InteractionDefinition::class); } function it_is_an_interaction() diff --git a/spec/LanguageMapSpec.php b/spec/LanguageMapSpec.php index 2fa714d..c90b703 100644 --- a/spec/LanguageMapSpec.php +++ b/spec/LanguageMapSpec.php @@ -36,9 +36,9 @@ function it_can_be_created_with_an_existing_array_map() function it_returns_a_new_instance_with_an_added_entry() { $languageTag = $this->withEntry('en-US', 'attended'); - $languageTag->offsetExists('en-US')->shouldReturn(true); + $languageTag->shouldHaveKey('en-US'); $languageTag->shouldNotBe($this); - $this->offsetExists('en-US')->shouldReturn(false); + $this->offsetExists('en-US'); } function it_returns_a_new_instance_with_a_modified_entry() @@ -65,8 +65,8 @@ function it_throws_an_exception_when_a_non_existent_language_tag_is_requested() function it_can_be_asked_if_a_language_tag_is_known() { - $this->offsetExists('en-GB')->shouldReturn(true); - $this->offsetExists('en-US')->shouldReturn(false); + $this->shouldHaveKey('en-GB'); + $this->shouldNotHaveKey('en-US'); } function its_values_cannot_be_modified() diff --git a/spec/StateDocumentSpec.php b/spec/StateDocumentSpec.php index 0fb6657..b36e359 100644 --- a/spec/StateDocumentSpec.php +++ b/spec/StateDocumentSpec.php @@ -39,11 +39,11 @@ function it_is_a_document() function its_data_can_be_read() { - $this->offsetExists('x')->shouldReturn(true); + $this->shouldHaveKey('x'); $this->offsetGet('x')->shouldReturn('foo'); - $this->offsetExists('y')->shouldReturn(true); + $this->shouldHaveKey('y'); $this->offsetGet('y')->shouldReturn('bar'); - $this->offsetExists('z')->shouldReturn(false); + $this->shouldNotHaveKey('z'); } function it_throws_exception_when_not_existing_data_is_being_read() diff --git a/src/Interaction/InteractionDefinition.php b/src/Interaction/InteractionDefinition.php index 15018f0..c6df8ad 100644 --- a/src/Interaction/InteractionDefinition.php +++ b/src/Interaction/InteractionDefinition.php @@ -22,7 +22,7 @@ * * @author Christian Flothmann */ -abstract class InteractionDefinition extends Definition +class InteractionDefinition extends Definition { private $correctResponsesPattern;